DerrickWood / kraken2

The second version of the Kraken taxonomic sequence classification system
MIT License
718 stars 270 forks source link

KeyEerror when ran kraken2 #495

Open linss123 opened 3 years ago

linss123 commented 3 years ago

Hello This is a user of Kraken2. PlusPF database was downloaded in 'https://benlangmead.github.io/aws-indexes/k2' , and the taxonomy information were installed using kraken2-build --download-taxonomy . But I kept getting KeyError when Kraken2 ran throught metawrap.

metawrap kraken2 -o KRAKEN/LY -t 12 ASSEMBLY/LY/final_assembly.fasta

##################################################################################################################                         ######
#####                                          RUNNING KRAKEN ON ALL FILES                                                                  #####
##################################################################################################################                         ######

------------------------------------------------------------------------------------------------------------------                         ------
-----                        Now processing ASSEMBLY/LY/final_assembly.fasta with 12 threads                                                -----
------------------------------------------------------------------------------------------------------------------                         ------

kraken2 --use-names --db /home/zms/db/MY_KRAKEN_DATABASE --threads 12 --output KRAKEN/LY/final_assembly.krak2 ASSE                         MBLY/LY/final_assembly.fasta
Loading database information... done.
243541 sequences (528.61 Mbp) processed in 6.299s (2319.9 Kseq/m, 5035.31 Mbp/m).
  178788 sequences classified (73.41%)
  64753 sequences unclassified (26.59%)

########################################################################################################################
#####                                      RUNNING KRAKEN-TRANSLATE ON OUTPUT                                      #####
########################################################################################################################

------------------------------------------------------------------------------------------------------------------------
-----                                  Translating KRAKEN/LY/final_assembly.krak2                                  -----
------------------------------------------------------------------------------------------------------------------------

Translating kraken2 annotations from KRAKEN/LY/final_assembly.krak2, using metadata from the kraken2 database in /home/zms/db/MY_KRAKEN_DATABASE; saving to KRAKEN/LY/final_assembly.kraken2
Translating kraken2 annotations
Loading NCBI node names
Loading NCBI taxonomic ranks
Writing translated taxonomy names to KRAKEN/LY/final_assembly.kraken2
Traceback (most recent call last):
  File "/home/zms/miniconda3/envs/metawrap/bin/metawrap-scripts/kraken2_translate.py", line 120, in <module>
    main()
  File "/home/zms/miniconda3/envs/metawrap/bin/metawrap-scripts/kraken2_translate.py", line 114, in main
    translate_kraken2_annotations(annotation_file=kraken_file, kraken2_db=database_location, output=output_file)
  File "/home/zms/miniconda3/envs/metawrap/bin/metawrap-scripts/kraken2_translate.py", line 98, in translate_kraken2_annotations
    taxonomy = get_full_name(taxid, names_map, ranks_map)
  File "/home/zms/miniconda3/envs/metawrap/bin/metawrap-scripts/kraken2_translate.py", line 30, in get_full_name
    name = names_map[taxid]
KeyError: '1418105'

************************************************************************************************************************
*****                        Something went wrong with running kraken-translate... Exiting.                        *****
************************************************************************************************************************

May I know what is the problem and how to deal with it ? Thanks a lot !

kuangzhuoran commented 2 years ago

Hi ! I met the same error, Have u resolved that?? Thanks

linss123 commented 2 years ago

I have resolved that by not using kraken2  throught metawrap. Maybe there is something wrong with the workflow.

------------------ 原始邮件 ------------------ 发件人: "DerrickWood/kraken2" @.>; 发送时间: 2021年11月14日(星期天) 晚上6:08 @.>; @.**@.>; 主题: Re: [DerrickWood/kraken2] KeyEerror when ran kraken2 (#495)

Hi ! I met the same error, Have u resolved that?? Thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

kuangzhuoran commented 2 years ago

Hi ! Thanks a lot !!! It works perfectly

And I just found the relevant information -- https://blog.csdn.net/qq_23341021/article/details/120171438 I didn't look at this page carefully. It may be helpful. Overall, kraken2's goal has been achieved

linss123 commented 2 years ago

Yeah! I found there are many faults in the workflow. You would better use original software excepting binning and assembling。 good luck!

------------------ 原始邮件 ------------------ 发件人: "DerrickWood/kraken2" @.>; 发送时间: 2021年11月15日(星期一) 晚上9:44 @.>; @.**@.>; 主题: Re: [DerrickWood/kraken2] KeyEerror when ran kraken2 (#495)

Hi ! Thanks a lot !!! It works perfectly

And I just found the relevant information -- https://blog.csdn.net/qq_23341021/article/details/120171438 I didn't look at this page carefully. It may be helpful. Overall, kraken2's goal has been achieved

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.