MGXlab / CAT_pack

CAT/BAT/RAT: tools for taxonomic classification of contigs and metagenome-assembled genomes (MAGs) and for taxonomic profiling of metagenomes
MIT License
187 stars 30 forks source link

Error in RAT make_tax_table #130

Open jbh2313 opened 4 weeks ago

jbh2313 commented 4 weeks ago

Hello,

I'm getting the same error as was reported in issue https://github.com/MGXlab/CAT_pack/issues/116. I'm using a clone of CAT_pack that should be up to date. The error happens in the same spot as the original issue, during the prompt: "Writing output tables". If I specify -mc for the mode, the error happens without producing any new output files. However, if I specify -mcr, RAT will go through the full diamond classification and only get to the error when it tries writing output tables. I tried supplying it with the unmapped2classification file and rerunning the command, but it still produced the same error.

For background context, this is during a run where I've already successfully run CAT and BAT on a co-assembly that was produced from several independent sample reads. Would I be correct in assuming that RAT is designed to handle co-assembly as long as only a single pair of reads is annotated at a time? I already performed read mapping and supplied a sorted bam file to RAT. The mapping was done with a different mapper (Minimap2), but that shouldn't matter once it's in bam format, right?

jbh2313 commented 4 weeks ago

I also tried running RAT with just -m as the mode, and it produced a different error:

[2024-08-22 11:07:00] samtools found: samtools 1.20.
[2024-08-22 11:07:00] Bin folder supplied. Processing bin folder.
[2024-08-22 11:07:01] bin2classification file supplied. Processing bin classifications.
[2024-08-22 11:07:01] Loading file /cat_pack_db/tax/nodes.dmp.
[2024-08-22 11:11:33] Writing output tables.
Traceback (most recent call last):
  File "/path/to/CAT_pack/CAT_pack/CAT_pack", line 101, in <module>
    main()
  File "/path/to/CAT_pack/CAT_pack/CAT_pack", line 85, in main
    reads.run()
  File "/path/to/CAT_pack/CAT_pack/CAT_pack/reads.py", line 512, in run
    make_tax_table(c2c,
                   ^^^
UnboundLocalError: cannot access local variable 'c2c' where it is not associated with a value

This happens whether I pass c2c as a parameter or not. I'm using a version of the nr database that was downloaded and prepared with CAT_pack within the last week, though I don't think that matters since it successfully finished CAT and BAT already.