Skip to content
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

Combine Bracken files #27

Open
SooChing opened this issue Nov 19, 2020 · 7 comments
Open

Combine Bracken files #27

SooChing opened this issue Nov 19, 2020 · 7 comments

Comments

@SooChing
Copy link

SooChing commented Nov 19, 2020

Hi,

Good day.

I would like to check if I can run 'combine_kreports.py' on my Bracken reports? I have around 650 Bracken reports. It shows below errors when I tried to run it using the following command.

combine_kreports.py -r *.bracken -o bracken_phylum_all.report

Could you please advise?

Thanks.

Regards,
Soo Ching

STEP 1: READING REPORTS
1/4 samples processedTraceback (most recent call last):
File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/bin/combine_kreports.py", line 311, in
main()
File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/bin/combine_kreports.py", line 203, in main
report_vals = process_kraken_report(line)
File "/nethome/lees51/.conda/envs/shotgun_ana3_py3.7.0/bin/combine_kreports.py", line 120, in process_kraken_report
level_reads = int(split_str[2])
ValueError: invalid literal for int() with base 10: 'P'

@jenniferlu717
Copy link
Owner

It should work on the Bracken kraken-style report output.

What are the first couple of lines for one of the report files? You should not be running that script on the Bracken default output (-o option). You should be running that script on Bracken's k-report output (-w option)

@SooChing
Copy link
Author

Hi Jennifer,

Thanks for your prompt reply.

This makes sense to me. I have only generated the Bracken default output, so now I have to run the Bracken analysis again using -w. Do you know if I can re-run the Bracken analysis only with -w but without -o?

My previous script:
bracken -d $kbDB -i $outputDir/$BN'_Kraken2_output_custom'/$BN'_Kraken2_class.kreport2' -o $outputDir/$BN'_Bracken2_output_custom'/$BN'_bracken_class_S.bracken' -r 150 -l S -t 10

The output first few line:
name taxonomy_id taxonomy_lvl kraken_assigned_reads added_reads new_est_reads fraction_total_reads
Streptococcus salivarius 1304 S 625020 294835 919855 0.08424
Streptococcus sp. FDAARGOS_192 1839799 S 29539 32846 62385 0.00571
Streptococcus sp. LPB0220 2610896 S 23085 3950 27035 0.00248
Streptococcus sp. HSISM1 1316408 S 19932 3275 23207 0.00213
Streptococcus sp. HSISS3 1316412 S 11166 7782 18948 0.00174
Streptococcus sp. HSISS2 1316411 S 6626 4866 11492 0.00105
Streptococcus sp. A12 1759399 S 4540 591 5131 0.00047
Streptococcus sp. HSISS1 1316410 S 3328 63350 66678 0.00611
Streptococcus sp. I-P16 1156433 S 2044 2042 4086 0.00037
Streptococcus sp. oral taxon 061 712623 S 1804 88 1892 0.00017
Streptococcus sp. I-G2 1156431 S 1737 1705 3442 0.00032
Streptococcus sp. oral taxon 431 712633 S 1196 70 1266 0.00012

Thank you!

Regards,
Soo Ching

@jenniferlu717
Copy link
Owner

By default, Bracken does produce the kraken-style report output. Can you check the folder where you had the original Kraken reports? I think Bracken by default, puts the new Kraken-style reports in the same folder (with extension _bracken.kreport)

@SooChing
Copy link
Author

Hi Jennifer,

My script has only generated one file (.bracken). I can't find any other file in the folder. Is my script below correct? Or I missed out some important parameter?

My bracken version is 2.6.0 (build: py37h9a982cc_2).

My previous script:
bracken -d $kbDB -i $outputDir/$BN'_Kraken2_output_custom'/$BN'_Kraken2_class.kreport2' -o $outputDir/$BN'_Bracken2_output_custom'/$BN'_bracken_class_S.bracken' -r 150 -l S -t 10

Thanks for your help.

Regards,
Soo Ching

@SooChing SooChing changed the title Combine Braken files Combine Bracken files Nov 22, 2020
@pbuendia
Copy link

pbuendia commented Feb 5, 2022

Hi @SooChing, @jenniferlu717 ,

Did you figure it out? It would have been great to hear how you solved it as I have the same error and I do not see any -w option in Bracken.

python combine_kreports.py -r kr/???.txt.S.bracken -o bracken_
all.S.report

STEP 1: READING REPORTS
1/120 samples processedTraceback (most recent call last):
File "combine_kreports.py", line 311, in
main()
File "combine_kreports.py", line 203, in main
report_vals = process_kraken_report(line)
File "combine_kreports.py", line 120, in process_kraken_report
level_reads = int(split_str[2])
ValueError: invalid literal for int() with base 10: 'S'

@skose82
Copy link

skose82 commented Jul 11, 2024

It should work on the Bracken kraken-style report output.

What are the first couple of lines for one of the report files? You should not be running that script on the Bracken default output (-o option). You should be running that script on Bracken's k-report output (-w option)

Hi Jennifer,

Thank you for clarifying this. Can you please provide an example with the -w option in use? I am trying to use it but the -o option is still being requested.

@Admasb
Copy link

Admasb commented Nov 18, 2024

By default, Bracken does produce the kraken-style report output. Can you check the folder where you had the original Kraken reports? I think Bracken by default, puts the new Kraken-style reports in the same folder (with extension _bracken.kreport)

After running bracken, I have found the kraken-style reports created in the input directory (where I have the original kraken data) and a new bracken output in my output directory. The kraken-style reports have "bracken_species" label in their file name.

Now, I'm planning to assemble the bracken outputs of my reads from the same treatment (tube). Hence, I want to ask which of those two bracken outputs are good for assembly purpose? Do you think to do the assembly at the kraken stage will be more informative than assembling the bracken outputs ?

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

5 participants