metagentools / MetaCoAG

🚦🧬 Binning Metagenomic Contigs via Composition, Coverage and Assembly Graphs
https://metacoag.readthedocs.io/en/stable/
GNU General Public License v3.0
59 stars 5 forks source link

UnboundLocalError: local variable 'my_matching' referenced before assignment #45

Open franciscozorrilla opened 4 months ago

franciscozorrilla commented 4 months ago

Hello,

I have managed to run metacoag on 9/10 flye-based nanopore assemblies, but I get the following error on one of my samples: Is it maybe related to the low number of contigs with marker genes?

nohup sh -c 'ls assemblies/|while read sample;do mkdir -p metacoag/$sample && metacoag --assembler flye --graph assemblies/$sample/assembly_graph.gfa --contigs assemblies/$sample/assembly.fasta --paths assemblies/$sample/assembly_info.txt --abundance abundance/${sample}.tsv --output metacoag/$sample;done'
2024-05-16 14:18:45,426 - INFO - Welcome to MetaCoAG: Binning Metagenomic Contigs via Composition, Coverage and Assembly Graphs.
2024-05-16 14:18:45,426 - INFO - Input arguments: 
2024-05-16 14:18:45,426 - INFO - Assembler used: flye
2024-05-16 14:18:45,426 - INFO - Contigs file: assemblies/Wood2/assembly.fasta
2024-05-16 14:18:45,427 - INFO - Assembly graph file: assemblies/Wood2/assembly_graph.gfa
2024-05-16 14:18:45,427 - INFO - Contig paths file: assemblies/Wood2/assembly_info.txt
2024-05-16 14:18:45,427 - INFO - Abundance file: abundance/Wood2.tsv
2024-05-16 14:18:45,427 - INFO - Final binning output file: metacoag/Wood2
2024-05-16 14:18:45,427 - INFO - Marker gene file hmm: auxiliary/marker.hmm
2024-05-16 14:18:45,427 - INFO - Minimum length of contigs to consider: 1000
2024-05-16 14:18:45,427 - INFO - Depth to consider for label propagation: 10
2024-05-16 14:18:45,427 - INFO - p_intra: 0.1
2024-05-16 14:18:45,427 - INFO - p_inter: 0.01
2024-05-16 14:18:45,427 - INFO - Do not use --cut_tc: False
2024-05-16 14:18:45,427 - INFO - mg_threshold: 0.5
2024-05-16 14:18:45,427 - INFO - bin_mg_threshold: 0.33333
2024-05-16 14:18:45,427 - INFO - min_bin_size: 200000 base pairs
2024-05-16 14:18:45,428 - INFO - d_limit: 20
2024-05-16 14:18:45,428 - INFO - Number of threads: 8
2024-05-16 14:18:45,428 - INFO - MetaCoAG started
2024-05-16 14:18:45,533 - INFO - Total number of contigs available: 44
2024-05-16 14:18:45,545 - INFO - Total number of edges in the assembly graph: 5
2024-05-16 14:18:45,546 - INFO - Total isolated contigs in the assembly graph: 39
2024-05-16 14:18:45,547 - INFO - Obtaining lengths and coverage values of contigs
2024-05-16 14:18:45,555 - INFO - Total long contigs: 41
2024-05-16 14:18:45,555 - INFO - Total isolated long contigs in the assembly graph: 37
2024-05-16 14:18:45,556 - INFO - Obtaining tetranucleotide frequencies of contigs
2024-05-16 14:18:45,688 - INFO - Scanning for single-copy marker genes
2024-05-16 14:18:45,690 - INFO - Obtaining hmmout file
2024-05-16 14:18:45,690 - INFO - Using marker file: /home/hollfelder/miniconda3/envs/metagenomez/lib/python3.10/site-packages/metacoag/metacoag_utils/auxiliary/marker.hmm
2024-05-16 14:18:46,520 - INFO - Obtaining contigs with single-copy marker genes
2024-05-16 14:18:46,520 - INFO - Number of contigs containing single-copy marker genes: 1
2024-05-16 14:18:46,521 - INFO - Determining contig counts for each single-copy marker gene
2024-05-16 14:18:46,521 - INFO - Initialising bins
2024-05-16 14:18:46,521 - INFO - Matching and assigning contigs with single-copy marker genes to bins
Traceback (most recent call last):
  File "/home/hollfelder/miniconda3/envs/metagenomez/bin/metacoag", line 10, in <module>
    sys.exit(main())
  File "/home/hollfelder/miniconda3/envs/metagenomez/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/hollfelder/miniconda3/envs/metagenomez/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/hollfelder/miniconda3/envs/metagenomez/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/hollfelder/miniconda3/envs/metagenomez/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/hollfelder/miniconda3/envs/metagenomez/lib/python3.10/site-packages/metacoag/cli.py", line 736, in main
    ) = matching_utils.match_contigs(
  File "/home/hollfelder/miniconda3/envs/metagenomez/lib/python3.10/site-packages/metacoag/metacoag_utils/matching_utils.py", line 327, in match_contigs
    del my_matching
UnboundLocalError: local variable 'my_matching' referenced before assignment
^C
[2]+  Exit 1 

Thanks and best wishes, Francisco

Vini2 commented 4 months ago

Hi @franciscozorrilla,

Sorry for the delay. Didn't see this issue before.

I think there are not many long contigs with marker genes detected.

Can I know more details about this dataset? Is it a bacterial metagenome?

Thanks, Vijini