8000 kraken2? · Issue #10 · smdabdoub/kraken-biom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

kraken2? #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
raw937 opened this issue Aug 23, 2018 · 21 comments
Open

kraken2? #10

raw937 opened this issue Aug 23, 2018 · 21 comments

Comments

@raw937
Copy link
raw937 commented Aug 23, 2018

Does it work with kraken2 outputs?

Cheers and many thanks
Rick

@smdabdoub
Copy link
Owner

Hi Rick, thanks for the question!

From what I've read in the new manual, it should work with the v2 report output. However, I haven't had a chance to build a new database and run any samples, so I can't say for sure.

If you have a few files you've generated that you'd like to share, I would be happy to do some testing.

@raw937
Copy link
Author
raw937 commented Aug 24, 2018

Hello Shareef,

YES! YES!
I have the perfect data for you. We are having trouble resolving this short read data from 16S between two taxa dominant taxa that are similar but different genus. I would like to use kraken2 against the most current databases (greengenes, silva, RDP) as well NCBIs target loci sequences. Also include our full length 16S from our genomes.

Qiime has been unable to resolve this.

email me - raw937@gmail.com

I can send you the data to play with.

Cheers and many thanks
Rick

@misazaa
Copy link
misazaa commented Aug 30, 2018

Hi!

I'm running kraken 2 to do the taxonomic classification of some microbiome data (assembly of PE reads) and I'm using the greengages databased. I want to get an OTU table in the biom format but I when I run kraken-biom output_kraken_report.txt I get the error

AttributeError: 'NoneType' object has no attribute 'strip'

So I don't know if there is a problem with the lines in kraken2 or the kraken-biom is not compatible with kraken2

Have you tried your data yet?

Camila

@smdabdoub
Copy link
Owner

Hi Camila,

I have not yet created a kraken2 database for myself yet, so I don't have any example files to test it with. But I would be happy to take a look at the file you're having problems with if you can share it.

Shareef

@MaryoHg
Copy link
MaryoHg commented Sep 12, 2018

Hi, all.

I already tried to use kraken-biom on my kraken2-report-style files, and it worked.
I haven't understand what is the meaning of the value showed in the biom file for each report added.
Is it the number of reads assigned to a taxonomy_id or a taxonomic level itself?

################################################################################

@misazaa

I tried to convert a 'non-indented' file with k-biom script. Is it the same that you get?

Traceback (most recent call last):
File "/usr/local/bin/kraken-biom", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/kraken_biom.py", line 373, in main
min_rank=args.min)
File "/usr/local/lib/python2.7/dist-packages/kraken_biom.py", line 161, in process_samples
min_rank=min_rank)
File "/usr/local/lib/python2.7/dist-packages/kraken_biom.py", line 105, in parse_kraken_report
erank = entry['rank'].strip()
AttributeError: 'NoneType' object has no attribute 'strip'

MaryoHg.

@smdabdoub
Copy link
Owner

Hi MaryoHg,

The counts recorded in the biom table are counts assigned to a particular taxonomy ID (column 3 in the report file), with one exception. When assigning reads for the lowest taxonomic level (species by default) it uses the number of reads assigned to that taxonomic level and those below (column 2 in the report file).

Shareef

@MaryoHg
Copy link
MaryoHg commented Sep 14, 2018

Thank you, @smdabdoub.

Have you ever crossed with Bracken?
This software is useful to estimate the relative abundance based on Kraken outputs.
It would be great if your script worked on Bracken-outputs too.

Just saying.

With regards,

MaryoHg.

@louiejtaylor
Copy link

Testimonial--it works great with kraken2 output :D

@mdtorohernando
Copy link
mdtorohernando commented Aug 23, 2019

For me, it works with Kraken2 output, but I cannot retrieve taxonomic information (only TaxID). Does somebody know how to solve it?

@casperp
Copy link
Contributor
casperp commented Aug 23, 2019

How do you mean you can not retrieve taxonomic information ? The program produces an biom file. In the "metadata" from every TaxID should be info about the taxonomy like a name per taxonomic level.

You can check if this information is correct by importing the biom table in python and checking :

from biom import load_table
biom_table = load_table("table.biom")
biom_table.metadata_to_dataframe(axis='observation')  

It would also be useful if you can provide a kreport form kraken2. I only have access to krakenuniq reports and no access to a cluster for kraken2 at the moment.

@mdtorohernando
Copy link

I mean I obtain the biom file ( I convert to csv to visualize) and I only observe the TaxID column and each sample column, but no more.

@casperp
Copy link
Contributor
casperp commented Aug 26, 2019

Okay, you can look at the manual for biom convertion. When you use bash biom convert -i otu_table.biom -o otu_table.txt --to-tsv --header-key taxonomy you get an extra column with the full linage.

k__Bacteria; p__Proteobacteria; c__Alphaproteobacteria; o__Rhizobiales; f__Bradyrhizobiaceae; g__Bradyrhizobium; s__diazoefficiens

I hope this is helpfull. Otherwise if you can wait a few weeks, I'm working on a program for visualizing and testing of biom tables. Maybe this provides the information you need in the visualizations.

@mdtorohernando
Copy link

Thank you!! I completely forgot the --header-key option! Thanks!

@kyoreth
Copy link
kyoreth commented Aug 10, 2020

I'm having trouble with read numbers in regards to bracken reports, they seem to be different compared to the original report? For example, checking taxa 817 in the report states 292478 taxa read counts, whereas in the converted biom file imported via phyloseq into R, the taxa 817 reads 827894 taxa read counts... Any ideas what could be going wrong?

@smdabdoub
Copy link
Owner

@kyoreth Do you have an example file I could take a look at? I haven't actually tested kraken-biom with Bracken output. Others have said it works, but it would be very helpful if you could share an example so I could make any changes to the program if needed.

@kyoreth
Copy link
kyoreth commented Aug 17, 2020

@smdabdoub Sorry about my earlier comment, and thanks for the reply! After some more internal testing kraken-biom is working fine with Bracken reports.

@Midnighter
Copy link

Hi @casperp, where are you developing your visualization tool? Do you have a repo to look at?

@SooChing
Copy link

Hi,

I have two questions:

@louiejtaylor @MaryoHg

  1. May I know how to solve the below error? I firstly combined all my kraken2 reports (from all samples) using 'combine_kreports.py', then run the output using 'kraken-biom all_kraken2.kreport2 -o all_kraken2.biom --fmt json' but failed.

Traceback (most recent call last):
File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/bin/kraken-biom", line 10, in
sys.exit(main())
File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/lib/python3.7/site-packages/kraken_biom.py", line 373, in main
min_rank=args.min)
File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/lib/python3.7/site-packages/kraken_biom.py", line 161, in process_samples
min_rank=min_rank)
File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/lib/python3.7/site-packages/kraken_biom.py", line 105, in parse_kraken_report
erank = entry['rank'].strip()
AttributeError: 'NoneType' object has no attribute 'strip'

@kyoreth
2. May I know how to combine bracken reports from all samples before you running the kraken-biom? I have bracken reports but I don't know how to combine it.

Thanks.

Regards,
Soo Ching

@UmaJan
Copy link
UmaJan commented Jul 17, 2023

Hi,

I have two questions:

@louiejtaylor @MaryoHg

  1. May I know how to solve the below error? I firstly combined all my kraken2 reports (from all samples) using 'combine_kreports.py', then run the output using 'kraken-biom all_kraken2.kreport2 -o all_kraken2.biom --fmt json' but failed.

Traceback (most recent call last): File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/bin/kraken-biom", line 10, in sys.exit(main()) File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/lib/python3.7/site-packages/kraken_biom.py", line 373, in main min_rank=args.min) File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/lib/python3.7/site-packages/kraken_biom.py", line 161, in process_samples min_rank=min_rank) File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/lib/python3.7/site-packages/kraken_biom.py", line 105, in parse_kraken_report erank = entry['rank'].strip() AttributeError: 'NoneType' object has no attribute 'strip'

@kyoreth 2. May I know how to combine bracken reports from all samples before you running the kraken-biom? I have bracken reports but I don't know how to combine it.

Thanks.

Regards, Soo Ching

have you figured out how to do this as of yet?

@MaryoHg
Copy link
MaryoHg commented Jul 17, 2023

@SooChing @UmaJan

I didn't merge the kraken2 outputs (I changed the k2 outputs for the Bracken's one; those with re-estimated values) before using kraken-biom, as this script can take many reports at the same time as arguments and spit a single biom file with many samples as reports use as inputs:

My command, AFIR (Remember):

$ kraken-biom --kraken_reports_fp dir_reports/ --otu_fp file --max D --min S --output_fp mytable.biom

dir_reports: contains all the reports from bracken (or kraken2) I want to merge into a single biom file for later use.
--output-fp: is the biom output file
--otu_fp: optional, Create a file containing just the (NCBI) OTU IDs for use with a service such as phyloT

Sorry for the late reply @SooChing. I hope you're doing just fine and made through that error.

Mar.

@Midnighter
Copy link

It might be of interest to folks here, we recently published TAXPASTA, a tool that can convert many different profiles into various standardized tabular formats. Among them the BIOM format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0