<div dir="ltr">Thanks Jordan and Titus!<div><br></div><div>Am I correct that Titus&#39;s script will also work with kt = khmer.new_counting_hash(KSIZE, starting_size)?  What is the difference between new_counting_hash and new_hashtable?</div>
<div><br></div><div style>Thanks again,</div><div style>Lester</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jun 14, 2013 at 7:36 AM, C. Titus Brown <span dir="ltr">&lt;<a href="mailto:ctb@msu.edu" target="_blank">ctb@msu.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks, Jordan.<br>
<br>
Lester -- if you want to do standard pentamer signature analysis, here&#39;s<br>
a script I wrote --<br>
<br>
---<br>
<br>
#! /usr/bin/env python<br>
import sys<br>
import khmer<br>
import screed<br>
<br>
KSIZE=5<br>
<br>
def main(inp_name, outp_name, min_seq_len):<br>
    outfp = open(outp_name, &#39;w&#39;)<br>
<br>
    min_seq_len = int(min_seq_len)<br>
<br>
    for record in screed.open(inp_name):<br>
        if len(record.sequence) &lt; min_seq_len:<br>
            continue<br>
<br>
        kt = khmer.new_ktable(KSIZE)<br>
        kt.consume(record.sequence[:min_seq_len])<br>
<br>
        x = []<br>
        for i in range(4**KSIZE):<br>
            x.append(&quot;%s&quot; % (kt.get(i),))<br>
<br>
        print &gt;&gt;outfp, &quot; &quot;.join(x)<br>
<br>
if __name__ == &#39;__main__&#39;:<br>
    main(*sys.argv[1:4])<br>
<br>
---<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Jun 14, 2013 at 08:53:22AM -0400, Jordan Fish wrote:<br>
&gt; Hi Lester,<br>
&gt;<br>
&gt; Unless you are working with fairly small k-values you will probably want to<br>
&gt; use the CountingHash.  Ktable handles simple exact counting so far<br>
&gt; large-ish values of k (&gt;12, according to<br>
&gt; <a href="http://khmer.readthedocs.org/en/latest/ktable.html" target="_blank">http://khmer.readthedocs.org/en/latest/ktable.html</a>) it&#39;ll blow up.<br>
&gt;<br>
&gt; The counting hash uses a bloom filter to limit memory usage at the cost of<br>
&gt; in-exact counting.  Hopefully titus will jump in here with a link to some<br>
&gt; documentation on the inexact counting.<br>
&gt;<br>
&gt; Finally, if you want to force khmer to treat a kmer and it&#39;s reverse<br>
&gt; complement as unique you will need to edit &#39;lib/Makefile&#39; and change the<br>
&gt; line<br>
&gt;<br>
&gt; NO_UNIQUE_RC=0<br>
&gt;<br>
&gt; to<br>
&gt;<br>
&gt; NO_UNIQUE_RC=1<br>
&gt;<br>
&gt; and rebuild khmer<br>
&gt;<br>
&gt; Jordan<br>
&gt;<br>
&gt; On Fri, Jun 14, 2013 at 3:22 AM, Lester Mackey &lt;<a href="mailto:lmackey@stanford.edu">lmackey@stanford.edu</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Dear khmer Discussion List,<br>
&gt; &gt;<br>
&gt; &gt; If my goal is to obtain a vector of kmer counts quickly from a FASTA or<br>
&gt; &gt; FASTQ file, is there any reason to prefer ktable to one of your other data<br>
&gt; &gt; structures, like the counting hash table?<br>
&gt; &gt;<br>
&gt;<br>
&gt; &gt; I&#39;ve noticed that ktable hashes a kmer and its reverse complement to the<br>
&gt; &gt; same bin.  Is there an easy way to disable this feature (and thereby count<br>
&gt; &gt; each kmer and reverse complement separately)?<br>
&gt; &gt;<br>
&gt; &gt; Thanks,<br>
&gt; &gt; Lester<br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; khmer mailing list<br>
&gt; &gt; <a href="mailto:khmer@lists.idyll.org">khmer@lists.idyll.org</a><br>
&gt; &gt; <a href="http://lists.idyll.org/listinfo/khmer" target="_blank">http://lists.idyll.org/listinfo/khmer</a><br>
&gt; &gt;<br>
&gt; &gt;<br>
<br>
&gt; _______________________________________________<br>
&gt; khmer mailing list<br>
&gt; <a href="mailto:khmer@lists.idyll.org">khmer@lists.idyll.org</a><br>
&gt; <a href="http://lists.idyll.org/listinfo/khmer" target="_blank">http://lists.idyll.org/listinfo/khmer</a><br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
C. Titus Brown, <a href="mailto:ctb@msu.edu">ctb@msu.edu</a><br>
</font></span></blockquote></div><br></div></div>