Commits

Mark Howison committed 8169144

debruijn: now takes Chrysalis debruijn graph as input instead of FASTQ

  • Participants
  • Parent commits b410958
  • Branches issue-7, issue7a

Comments (0)

Files changed (1)

 kmers = {}
 
 for fastq in args.READS:
-    for _, seq, _ in FastqGeneralIterator(open(fastq)):
-        nreads += 1
-        for i in range(0, len(seq)-K+1):
-            kmer = seq[i:i+K]
-            if alphabet.match(kmer):
+    for line in open(fastq):
+        try:
+            kmer = line.split()[3]
+            assert len(kmer) == K
+            nreads += 1
+            if kmer and alphabet.match(kmer):
                 kmers[kmer] = kmers.get(kmer, Node(kmer[-1]))
                 rkmer = reverse_complement(kmer)
                 kmers[rkmer] = kmers.get(rkmer, Node(rkmer[-1]))
+            else:
+                ndiscard += 1
+        except IndexError:
+            print "bad sequence:", line
 
 print "{:,d} reads / {:,d} kmers".format(nreads, len(kmers))