I have a Fastq file and I want to get the exact count of each possible kmer from this file.
On a previous post called How to use khmer to count k-mers? Daniel Standage proposed a custom script based on khmer methods that you can see down below :
>>> outfile = open('outfile.txt', 'w')
>>> seenkmers = set() # Consumes a lot of memory for large input!!!
>>> for read in khmer.ReadParser('reads.fq.gz'):
... for kmer in counts.get_kmers(read.sequence):
... if kmer not in seenkmers:
... print(kmer, counttable.get(kmer), file=outfile)
... seenkmers.add(kmer)
The code works if I switch counttable.get(kmer)
with counts.get(kmer)
but the main problem is that when I try on a customized fastq file with 300 occurrences of one kmer, the count will still be stuck at 255 and can't go further, and for some reason I can't pass through this limit.
Is this coming from the minimum table size ?
Does anyone know if there is a parameter that can work on a custom script to disable this limit ?