Krona
Krona copied to clipboard
Kronagram from Kraken2 output?
We use Kraken (now kraken2) for a lot of our analysis, and it would be great if there was a way to read kraken2 data in to kronatools. There probably is a way to do it using ktImportText, but I can't figure it out!
Here's the sample output:
100.00 15885 0 R 1 root 100.00 15885 0 R1 131567 cellular organisms 100.00 15885 2 D 2 Bacteria 38.89 6177 0 D1 1783272 Terrabacteria group 27.10 4305 0 P 1239 Firmicutes 21.95 3487 1 C 91061 Bacilli 14.16 2250 0 O 186826 Lactobacillales 7.90 1255 0 F 1300 Streptococcaceae 7.90 1255 547 G 1301 Streptococcus 4.02 638 429 S 1309 Streptococcus mutans 1.32 209 209 S1 210007 Streptococcus mutans UA159 0.15 24 21 S 1314 Streptococcus pyogenes 0.01 2 0 S1 798299 Streptococcus pyogenes serotype M59 0.01 2 2 S2 798300 Streptococcus pyogenes MGAS15252 0.01 1 0 S1 301449 Streptococcus pyogenes serotype M5 0.01 1 1 S2 160491 Streptococcus pyogenes str. Manfredo 0.06 10 10 S 2420310 Streptococcus sp. FDAARGOS_522 0.06 10 7 S 1311 Streptococcus agalactiae
Your sample is the output using the --report option from kraken2 which generates a summary taxomomy/abundance tree. Additionally you can create a classification output using the --output option from kraken2, where each sequence will have its taxa classification. With this file you can import to Krona with the ImportTaxonomy script:
ImportTaxomoy.pl -q 2 -t 3 YourKrakenOutputFile -o YourKronaReportFile
-q and -t options are needed because in the kraken report the data krona needs are in the second and third column.
I was also confused by converting kranken2 results to krona file. @jchnaide , thank you very much!😀
I'm using the report file directly in combination with number of reads as magnitude values:
ImportTaxonomy.pl -m 3 -t 5 kraken.report -o kraken.html
This didn't work with my custom taxonomy and so I made a script to parse the kraken report directly
https://github.com/lskatz/lskScripts/blob/master/scripts/kraken2-translate.pl
$ kraken2-translate.pl --help
kraken2-translate.pl: changes kraken report to a format for ktImportText in Krona
Usage: kraken2-translate.pl [options] kraken.report
--help This useful help menu
Output is tab delimited:
* count of reads
* parent node 1
* ...
* last child node (usually genus/species)
for kraken2 output : ktImportTaxonomy -s 1 -m 2 -t 5 ngs.report -o krona.html
Be careful here @SolayMane, I believe this is wrong. The column number for the magnitude (-m
) should be 3 ("Number of fragments assigned directly to this taxon") instead of 2 ("Number of fragments covered by the clade rooted at this taxon"), because 2 already contains a cumulated number. (See kraken2 manual)
Also, I'm not sure if the "Percentage of fragments covered by the clade rooted at this taxon" interpreted as "score" here really makes sense. (-s 1
)
Hence I'm using:
ktImportTaxonomy -m 3 -t 5 ngs.report -o krona.html
(what @tolot27 recommended previously)