KrakenTools icon indicating copy to clipboard operation
KrakenTools copied to clipboard

Combine Bracken files

Open SooChing opened this issue 4 years ago • 6 comments

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'

SooChing avatar Nov 19 '20 21:11 SooChing

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)

jenniferlu717 avatar Nov 20 '20 22:11 jenniferlu717

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

SooChing avatar Nov 20 '20 22:11 SooChing

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)

jenniferlu717 avatar Nov 21 '20 21:11 jenniferlu717

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 avatar Nov 22 '20 13:11 SooChing

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'

pbuendia avatar Feb 05 '22 05:02 pbuendia

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.

skose82 avatar Jul 11 '24 20:07 skose82