jenniferlu717 / Bracken

Bracken (Bayesian Reestimation of Abundance with KrakEN) is a highly accurate statistical method that computes the abundance of species in DNA sequences from a metagenomics sample.
http://ccb.jhu.edu/software/bracken/index.shtml
GNU General Public License v3.0
283 stars 50 forks source link

Bracken attribut error, int object has no attribute 'level_num' #150

Open kdbchau opened 3 years ago

kdbchau commented 3 years ago

I am trying to run bracken with my kraken2 report text files (using the --report command in kraken2 version 2.1.1). The data is paired so there are 8 columns instead of 6 and I suspect this might be causing an issue (since almost all tutorials I find using bracken have worked with kraken2 report files that did not apply the --paired flag).

I get the following error:

[chauk@gra-login2 krakendb_results_minimizer]$ bracken -d /data1/datasets/kraken2_dbs/krakendb/ -i sample9_NS11.report.txt -l S -o sample9_NS11.species.txt  >> Checking for Valid Options...  >> Running Bracken       >> python src/est_abundance.py -i sample9_NS11.report.txt -o sample9_NS11.species.txt -k /data1/datasets/kraken2_dbs/krakendb/database100mers.kmer_distrib -l S -t 0 PROGRAM START TIME: 05-06-2021 17:03:31 Traceback (most recent call last):   File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx2/Compiler/gcc9/bracken/2.6.0/bin/src/est_abundance.py", line 488, in     main()   File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx2/Compiler/gcc9/bracken/2.6.0/bin/src/est_abundance.py", line 238, in main     if level_num != (prev_node.level_num + 1): AttributeError: 'int' object has no attribute 'level_num'

Thanks!

zhq90 commented 2 years ago

Have the same error!

>> Checking for Valid Options...
 >> Running Bracken 
      >> python src/est_abundance.py -i /data/home/zhq/workstation/meta-metagenomics/xiao/cleandata/uhgg_v2_kraken2_results/SRR10983032.kraken2report -o F_level/SRR10983032_F.bracken -k /data/home/zhq/workstation/reference/kraken2database/kraken2_db_uhgg_v2/database150mers.kmer_distrib -l F -t 0
PROGRAM START TIME: 01-18-2022 01:22:45
>> Checking report file: /data/home/zhq/workstation/meta-metagenomics/xiao/cleandata/uhgg_v2_kraken2_results/SRR10983032.kraken2report
Traceback (most recent call last):
  File "/data/home/zhq/program/Bracken/src/est_abundance.py", line 529, in <module>
    main()
  File "/data/home/zhq/program/Bracken/src/est_abundance.py", line 266, in main
    if level_num != (prev_node.level_num + 1):
AttributeError: 'int' object has no attribute 'level_num'
jindongmin commented 2 years ago

Hi @jenniferlu717, I got this error when I ran bracken on a public available sample (ERR4097264).

The command I used:

bracken -d /mnt/home/djin/ceph/databases/uhgg -i ERR4097264_report_uhgg_k2.txt -o ERR4097264_output_uhgg_bracken.txt -w ERR4097264_report_uhgg_bracken.txt -r 100 -l S

Error message:

>> Checking for Valid Options...
 >> Running Bracken 
      >> python src/est_abundance.py -i ERR4097264_report_uhgg_k2.txt -o ERR4097264_output_uhgg_bracken.txt -k /mnt/home/djin/ceph/databases/uhgg/database100mers.kmer_distrib -l S -t 10
>> Checking report file: ERR4097264_report_uhgg_k2.txt
PROGRAM START TIME: 03-23-2022 00:24:50
Traceback (most recent call last):
  File "/mnt/home/djin/miniconda3/envs/salmon/bin/src/est_abundance.py", line 529, in <module>
    main()
  File "/mnt/home/djin/miniconda3/envs/salmon/bin/src/est_abundance.py", line 266, in main
    if level_num != (prev_node.level_num + 1):
AttributeError: 'int' object has no attribute 'level_num'

I tested on both uhgg and wol reference databases, it worked fine for wol database, but gave the above mentioned error for uhgg. The uhgg database I used was accessed from here: http://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-gut/v2.0/kraken2_db_uhgg_v2/

I attached the input report file in case it's helpful to determine what's wrong. Thanks!

ERR4097264_report_uhgg_k2.txt

jenniferlu717 commented 2 years ago

@kdbchau @zhq90 can you please respond with the first few lines of your report files?

Also, what database are you using?

s-meaden commented 7 months ago

Hi @jenniferlu717, I'm getting the same error. Any updates on this?

I'm using the pre-built Kraken2 database (Standard RefSeq from Ben Langmead, https://benlangmead.github.io/aws-indexes/k2).

Here's the first few lines of my Kraken2 report:

48.16 2408 2408 0 0 U 0 unclassified 51.84 2592 1 92750 52165 R 1 root 51.82 2591 7 92591 52165 R1 131567 cellular organisms 46.22 2311 0 85368 47792 D 2157 Archaea 46.12 2306 0 85309 47679 D1 1783275 TACK group 46.12 2306 0 85304 47679 P 28889 Thermoproteota 46.12 2306 0 85304 47679 C 183924 Thermoprotei 45.82 2291 0 85183 47644 O 2266 Thermoproteales 45.82 2291 0 85183 47644 F 2267 Thermoproteaceae 45.78 2289 6 85066 47574 G 2276 Pyrobaculum 35.90 1795 0 60913 33609 S 121277 Pyrobaculum arsenaticum 35.90 1795 1795 60913 33609 S1 340102 Pyrobaculum arsenaticum DSM 13514

Thanks!

` >> Checking for Valid Options...

Running Bracken python src/est_abundance.py -i kraken_reports/test_kraken_report.txt -o test_bracken.txt -k /users/kvw508/scratch/databases/kraken2/database150mers.kmer_distrib -l S -t 0 PROGRAM START TIME: 01-18-2024 12:33:38 Traceback (most recent call last): File "/opt/apps/eb/software/Bracken/2.6.0-GCCcore-9.3.0/src/est_abundance.py", line 488, in main() File "/opt/apps/eb/software/Bracken/2.6.0-GCCcore-9.3.0/src/est_abundance.py", line 238, in main if level_num != (prev_node.level_num + 1): AttributeError: 'int' object has no attribute 'level_num'`

LeandroRitter commented 2 months ago

@jenniferlu717 I am having the same error when trying to run Bracken on Kraken2 output from minikraken database from here https://benlangmead.github.io/aws-indexes/k2, the error message is below:

>> Checking for Valid Options...
 >> Running Bracken 
      >> python src/est_abundance.py -i /home/nikolay/metagenomics_training/kraken.output_G65860 -o bracken_output.txt -k /proj/snic2022-6-144/nobackup/NIKOLAY/minikraken2_v2_8GB_201904_UPDATE/database100mers.kmer_distrib -l S -t 100
PROGRAM START TIME: 06-26-2024 06:13:40
>> Checking report file: /home/nikolay/metagenomics_training/kraken.output_G65860
Traceback (most recent call last):
  File "/domus/h1/nikolay/metagenomics_training/Bracken/src/est_abundance.py", line 556, in <module>
    main()
  File "/domus/h1/nikolay/metagenomics_training/Bracken/src/est_abundance.py", line 291, in main
    while level_num != (prev_node.level_num + 1):
                        ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'level_num'