Answers.Body: <p>You can do all of that with <a href="http://khmer.readthedocs.io/en/v2.1.1/" rel="noreferrer">khmer</a>. For example, <code>abundance-dist-single.py</code> produces a file with columns: <code>k-mer abundance</code>, <code>k-mer count</code>, <code>cumulative count</code>, and fraction of total distinct k-mers<code>. So for question 1 you would sum column 2. For question 2 you would just get the</code>k-mer count<code>associated with a</code>k-mer abundance` of 1.</p>
  
  <p>That package also provides a python API (see the read the docs link above) if you need to customize things more.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-20T21:49:05.113Z
Answers.Text: Thanks a lot for that hint. I made a first test of khmer using A.thaliana: `python abundance-dist-single.py -k <k> -b <genome> <out>`. It looks great. It's fast and easy to use. However, I get an error for k > 32. Is there a way to go further than 32?
Answers.UserDisplayName: Jens
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-21T07:43:56.727Z
Answers.Text: I'm not sure it's possible with the command line script, but it appears to be [possible in the API](https://github.com/dib-lab/khmer/pull/1511).
Answers.UserDisplayName: Devon Ryan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-21T08:45:45.467Z
Answers.Text: Thanks for that hint, I'll check that. However, I also found out for some examples (and reading the documentation/papers afterwards ;) that it is not exact. Hence, I currently also use the parameters `-N 20 -x 1E7` to avoid too many mistakes. Just in case anyone like to do a similar case study. In addition, I have some problems with some species where khmer states `ERROR: abundance distribution is uniformly zero; nothing to report. Please verify that the input files are valid.` The files seem to be okay and have been used in other analysis. Any ideas?
Answers.UserDisplayName: Jens
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-21T12:28:54.340Z
Answers.Text: No, sorry, I've never seen that error.
Answers.UserDisplayName: Devon Ryan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-14T12:04:59.950Z
Answers.LastActivityDate: 2018-03-14T12:04:59.950Z
Answers.UserDisplayName: Devon Ryan
Body: <p>I'm looking for some software that can "efficiently" (time and memory) compute the exact percentage of non-unique k-mers in a genome for given k. I don't need the k-mers or the abundances itself, I just need the percentage.</p>
  
  <p>Alternatively, the result could be:</p>
  
  <ol>
  <li>the number of different k-mers observed in the genome</li>
  <li>the number of unique k-mers, i.e. k-mers that occur only once in the genome, <strong>or</strong> the number of non-unique k-mers, i.e., k-mers that occur more than once in the genome.</li>
  </ol>
  
  <p>which can be easily used to compute the requested percentage.</p>
  
  <p><strong>Requested features:</strong></p>
  
  <ul>
  <li>don't count k-mers with ambiguous nucleotides</li>
  <li>count a k-mer and its reverse complement together</li>
  <li>k upto 50 or 100</li>
  <li>for large genomes (upto some GB)  </li>
  <li>efficiency</li>
  </ul>
  
  <p>For the study in mind, I like to vary k. Hence, I will run the software several times with different k.</p>
  
  <p>Any help is welcome.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-14T10:14:26.613Z
Comments.Text: Welcome to the site. What is your current solution? Which non-efficient programs have you found (To avoid proposing them)? Can't the other answers in the [tag:k-mer] help you to make that program?
Comments.UserDisplayName: llrs
Tags: <genome><software-recommendation><k-mer>
Title: How to efficiently compute the exact percentage of non-unique k-mers in a genome for given k?
ThreadText: # How to efficiently compute the exact percentage of non-unique k-mers in a genome for given k?
  
  (Asked by: username_0 on 2018-03-14)
  
  I'm looking for some software that can "efficiently" (time and memory) compute the exact percentage of non-unique k-mers in a genome for given k. I don't need the k-mers or the abundances itself, I just need the percentage.
  
  Alternatively, the result could be:
  
  1. the number of different k-mers observed in the genome
  2. the number of unique k-mers, i.e. k-mers that occur only once in the genome, **or** the number of non-unique k-mers, i.e., k-mers that occur more than once in the genome.
  
  which can be easily used to compute the requested percentage.
  
  **Requested features:**
  
  * don't count k-mers with ambiguous nucleotides
  * count a k-mer and its reverse complement together
  * k upto 50 or 100
  * for large genomes (upto some GB)
  * efficiency
  
  For the study in mind, I like to vary k. Hence, I will run the software several times with different k.
  
  Any help is welcome.
  
  **Tags:** genome, software-recommendation, k-mer
  
  > **Comments:**
  > **username_1**: Welcome to the site. What is your current solution? Which non-efficient programs have you found (To avoid proposing them)? Can't the other answers in the [tag:k-mer] help you to make that program?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-03-14. Score: 5
  
  You can do all of that with [khmer](http://khmer.readthedocs.io/en/v2.1.1/). For example, `abundance-dist-single.py` produces a file with columns: `k-mer abundance`, `k-mer count`, `cumulative count`, and fraction of total distinct k-mers`. So for question 1 you would sum column 2. For question 2 you would just get the`k-mer count`associated with a`k-mer abundance` of 1.
  
  That package also provides a python API (see the read the docs link above) if you need to customize things more.
  
  > **Comments:**
  > **username_0**: Thanks a lot for that hint. I made a first test of khmer using A.thaliana: `python abundance-dist-single.py -k <k> -b <genome> <out>`. It looks great. It's fast and easy to use. However, I get an error for k > 32. Is there a way to go further than 32?  
  > **username_2**: I'm not sure it's possible with the command line script, but it appears to be [possible in the API](https://github.com/dib-lab/khmer/pull/1511).  
  > **username_0**: Thanks for that hint, I'll check that. However, I also found out for some examples (and reading the documentation/papers afterwards ;) that it is not exact. Hence, I currently also use the parameters `-N 20 -x 1E7` to avoid too many mistakes. Just in case anyone like to do a similar case study. In addition, I have some problems with some species where khmer states `ERROR: abundance distribution is uniformly zero; nothing to report. Please verify that the input files are valid.` The files seem to be okay and have been used in other analysis. Any ideas?  
  > **username_2**: No, sorry, I've never seen that error.  
  
  ---
  
  