ged-lab/khmer — pull request #649 by kdmurray91 (2014-11-06 04:26:20+00:00)
Title: Add CLI flag to load-into-counting.py allowing TSV output of basic stats

Hi all,

We're developing a few things based off khmer, and one of the metrics we're using is the total number of k-mers. I know this can be obtained programmatically via the khmer API (by loading in the counting hash and grabbing its occupancy), but this takes a while with many large hashes. So, currently, we're grepping through log files and .info files for the FPR and total number of kmers.

This PR adds a CLI flag to load-into-counting.py allowing it to output the FPR, total number of distinct k-mers (cm-sketch occupancy) and input files in a machine/R/spreadsheet readable format (tab-seperated file). This saves us from resorting to regex hacks to pull this info out of out.kh.info and logs. I've added a test of the tsv creation behaviour too, and pep8 is clean.

An example of the tsv format is below (markdown table-ified for prettyness):

```bash
python ./scripts/load-into-counting.py --machine-readable-info -x 1e7 -N 4 -k 20 tst data/100k-filtered.fa data/100k-surrendered.fa
```

| name | fpr | kmers | files |
|------|-------|---------|------------------------------------------------|
| tst | 0.010 | 3167409 | data/100k-filtered.fa;data/100k-surrendered.fa |

I've also make the info files contain all files used as input. (This can be reverted, I forgot to separate the commits)

Hope you find it helpful :smile:

Cheers,
Kevin