BinPro / CONCOCT

Clustering cONtigs with COverage and ComposiTion
Other
119 stars 48 forks source link

extract_fasta_bins.py generates KeyError: 'tmp_1.concoct_part_0' #312

Open jflucier opened 2 years ago

jflucier commented 2 years ago

Hi,

When I run the basic usage example, I get error at the extract_fasta_bins.py script step. Previous steps all run without error.

The command

singularity exec --writable-tmpfs -e \
> -B $SLURM_TMPDIR/${__sample}:/out \
> /project/def-ilafores/common/ILL_pipelines/metawrap_custom/concoct.1.1.0.sif \
> extract_fasta_bins.py /out/assembly/${__sample}.contigs.reformat.fasta /out/binning/concoct_output/clustering_gt1000.csv --output_path /out/binning/concoct_output/fasta_bins

return this error:

Traceback (most recent call last):
  File "/usr/local/bin/extract_fasta_bins.py", line 4, in <module>
    __import__('pkg_resources').run_script('concoct==1.1.0', 'extract_fasta_bins.py')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1463, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.8/dist-packages/concoct-1.1.0-py3.8-linux-x86_64.egg/EGG-INFO/scripts/extract_fasta_bins.py", line 44, in <module>
    main(args)
  File "/usr/local/lib/python3.8/dist-packages/concoct-1.1.0-py3.8-linux-x86_64.egg/EGG-INFO/scripts/extract_fasta_bins.py", line 32, in main
    seqs = [all_seqs[contig_id] for contig_id in contig_ids] 
  File "/usr/local/lib/python3.8/dist-packages/concoct-1.1.0-py3.8-linux-x86_64.egg/EGG-INFO/scripts/extract_fasta_bins.py", line 32, in <listcomp>
    seqs = [all_seqs[contig_id] for contig_id in contig_ids] 
KeyError: 'tmp_1.concoct_part_0'

Here is what the input filles look like:

|15:07:39|jflucier@ip29:[temp]> grep -e '>' W-3-POLJUN-G/assembly/${__sample}.contigs.reformat.fasta | head
>tmp_1
>tmp_2
>tmp_3
>tmp_4
>tmp_5
>tmp_6
>tmp_7
>tmp_8
>tmp_9
>tmp_10

and

|15:09:21|jflucier@ip29:[temp]> head -n 5 W-3-POLJUN-G/binning/concoct_output/clustering_gt1000.csv
contig_id,cluster_id
tmp_1.concoct_part_0,10
tmp_1.concoct_part_1,10
tmp_1.concoct_part_2,10
tmp_1.concoct_part_3,10

Here are the previous concoct command I ran befroe getting this error:

echo "concoct: runnin cut_up_fasta.py"
singularity exec --writable-tmpfs -e \
-B $SLURM_TMPDIR/${__sample}/assembly:/out \
/project/def-ilafores/common/ILL_pipelines/metawrap_custom/concoct.1.1.0.sif \
cut_up_fasta.py /out/${__sample}.contigs.reformat.fasta -c 10000 -o 0 --merge_last -b /out/${__sample}.contigs_10K.bed > $SLURM_TMPDIR/${__sample}/assembly/${__sample}.contigs_10K.fa

echo "concoct: runnin concoct_coverage_table.py"
singularity exec --writable-tmpfs -e \
-B $SLURM_TMPDIR/${__sample}/assembly:/out \
/project/def-ilafores/common/ILL_pipelines/metawrap_custom/concoct.1.1.0.sif \
concoct_coverage_table.py /out/${__sample}.contigs_10K.bed /out/${__sample}.contigs.sorted.bam > $SLURM_TMPDIR/${__sample}/assembly/${__sample}.coverage_table.tsv

echo "concoct: runnin concoct"
mkdir $SLURM_TMPDIR/${__sample}/binning/concoct_output/
singularity exec --writable-tmpfs -e \
-B $SLURM_TMPDIR/${__sample}:/out \
/project/def-ilafores/common/ILL_pipelines/metawrap_custom/concoct.1.1.0.sif \
concoct --threads ${SLURM_NBR_THREADS} --composition_file /out/assembly/${__sample}.contigs_10K.fa --coverage_file /out/assembly/${__sample}.coverage_table.tsv -b /out/binning/concoct_output/

echo "concoct: runnin extract_fasta_bins.py"
singularity exec --writable-tmpfs -e \
-B $SLURM_TMPDIR/${__sample}:/out \
/project/def-ilafores/common/ILL_pipelines/metawrap_custom/concoct.1.1.0.sif \
extract_fasta_bins.py /out/assembly/${__sample}.contigs.reformat.fasta /out/binning/concoct_output/clustering_gt1000.csv --output_path /out/binning/concoct_output/fasta_bins

Any idea on what could cause this error?

than you very much in advance for your help JF

saras224 commented 1 year ago

Hey! @jflucier I am also getting the same sort of error. Did you resolve it?