metagentools / GraphBin2

☯️🧬 Refined and Overlapped Binning of Metagenomic Contigs Using Assembly Graphs
https://graphbin2.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
33 stars 3 forks source link

key error #10

Closed asaldivar93 closed 2 years ago

asaldivar93 commented 2 years ago

Hi, I'm getting a keyerror running graphbin

2022-11-04 17:17:06,343 - INFO - Welcome to GraphBin2: Refined and Overlapped Binning of Metagenomic Contigs using Assembly Graphs. 2022-11-04 17:17:06,343 - INFO - This version of GraphBin2 makes use of the assembly graph produced by SPAdes which is based on the de Bruijn graph approach. 2022-11-04 17:17:06,343 - INFO - Input arguments: 2022-11-04 17:17:06,343 - INFO - Contigs file: ALC/metaspades/scaffolds.paths 2022-11-04 17:17:06,343 - INFO - Assembly graph file: ALC/metaspades/assembly_graph_with_scaffolds.gfa 2022-11-04 17:17:06,343 - INFO - Contig paths file: ALC/metaspades/scaffolds.paths 2022-11-04 17:17:06,343 - INFO - Existing binning output file: veba_output/binning/prokaryotic/ALC/intermediate/6__binning_concoct/scaffolds_to_bins.csv 2022-11-04 17:17:06,343 - INFO - Final binning output file: /ALC/intermediate/6__binning_concoct/graphbin/ 2022-11-04 17:17:06,343 - INFO - Depth: 5 2022-11-04 17:17:06,343 - INFO - Threshold: 1.5 2022-11-04 17:17:06,343 - INFO - Number of threads: 8 2022-11-04 17:17:06,343 - INFO - GraphBin2 started 2022-11-04 17:17:07,724 - INFO - Total number of contigs available: 117119 2022-11-04 17:17:08,506 - INFO - Total number of edges in the assembly graph: 19957 2022-11-04 17:17:08,530 - INFO - Number of bins available in binning result: 57 2022-11-04 17:17:44,743 - INFO - Number of binned contigs: 51724 2022-11-04 17:17:44,743 - INFO - Total number of unbinned contigs: 65395 2022-11-04 17:17:44,824 - INFO - Number of isolated contigs: 112823 2022-11-04 17:17:44,824 - INFO - Removing labels of unsupported vertices 0%| | 0/51724 [00:00<?, ?it/s]Traceback (most recent call last): File "GraphBin2/src/graphbin2_SPAdes.py", line 409, in BFS_labelled_nodes = list(runBFS(my_node)) File "GraphBin2/src/graphbin2_SPAdes.py", line 367, in runBFS labelled_nodes.add((node, active_node, contig_bin, depth[active_node], abs(coverages[contigs_map[node]]-coverages[contigs_map[active_node]]))) KeyError: 1

I used scaffold files as obtained by metaspades with the assembly_graph_with_scaffolds.gfa file. Do you have any suggestion on how to solve this?

Thank you

Vini2 commented 2 years ago

Hello @asaldivar93,

Thank you for your interest in GraphBin2.

From the log I see that you are using scaffolds.paths as the contigs file.

2022-11-04 17:17:06,343 - INFO - Contigs file: ALC/metaspades/scaffolds.paths

You have to use the scaffolds.fasta file for the --contigs argument and scaffolds.paths for the --paths argument.

If the error still exists after fixing this let me know.

Thank you!

asaldivar93 commented 2 years ago

Thank you for your time. Indeed, this was the mistake.