cortes-ciriano-lab / SComatic

A tool for detecting somatic variants in single cell data
Other
145 stars 20 forks source link

invalid contig `1` #20

Closed ramashka328 closed 11 months ago

ramashka328 commented 11 months ago

Hello,

thank you for your amazing work! I am trying to run SComatic scripts using singularity container with all requirements installed. The SplitBamCellTypes.py worked just fine and created separate BAM files for each cell type. However, when I try to run the BaseCellCounter.py script I get the following output:


Traceback (most recent call last):
  File "/data/projects/scrna_seq_active/SComatic/scripts/BaseCellCounter/BaseCellCounter.py", line 410, in <module>
    main()
  File "/data/projects/scrna_seq_active/SComatic/scripts/BaseCellCounter/BaseCellCounter.py", line 402, in main
    collect_result(run_interval(row, BAM, FASTA, MIN_COV, MIN_CC, MIN_AF, MIN_AC,tmp_dir, MIN_BQ, MIN_MQ))
  File "/data/projects/scrna_seq_active/SComatic/scripts/BaseCellCounter/BaseCellCounter.py", line 187, in run_interval
    i = bam.pileup(CHROM, START, END, min_base_quality = BQ, min_mapping_quality = MQ, ignore_overlaps = False)
  File "pysam/libcalignmentfile.pyx", line 1326, in pysam.libcalignmentfile.AlignmentFile.pileup
  File "pysam/libchtslib.pyx", line 685, in pysam.libchtslib.HTSFile.parse_region
ValueError: invalid contig `1`

I am running the following script:

singularity exec --bind /data:/data SComatic.sif \
        python3.7 /data/${scomatic_dir}/BaseCellCounter/BaseCellCounter.py \
            --ref /data/${REF} \
            --bam /data/${out_dir1}/AC3_2.Cell_0.bam \
            --chrom all \
            --out_folder /data/${out_dir2} \
            --tmp_dir /data/${out_dir2}/../tmp \
            --id ${sample} \
            --min_dp 5 \
            --min_bq 30 \
            --nprocs 1

What do you think could be the problem?

ramashka328 commented 11 months ago

When I try to add regional BED file from bed_files_of_interest (UCSC.k100_umap.without.repeatmasker.bed), I get a different error:

Traceback (most recent call last):
  File "/data/projects/scrna_seq_active/SComatic/scripts/BaseCellCounter/BaseCellCounter.py", line 410, in <module>
    main()
  File "/data/projects/scrna_seq_active/SComatic/scripts/BaseCellCounter/BaseCellCounter.py", line 385, in main
    BED = MakeWindows(CONTIG, FASTA, bed, bed_out, BIN)
  File "/data/projects/scrna_seq_active/SComatic/scripts/BaseCellCounter/BaseCellCounter.py", line 108, in MakeWindows
    inFasta.close()
UnboundLocalError: local variable 'inFasta' referenced before assignment
ramashka328 commented 11 months ago

Python packages installed:

about-time 3.1.1 Jinja2 3.1.2 MarkupSafe 2.1.3 numpy 1.21.6 numpy-groupies 0.9.14 pandas 1.3.5 pip 23.2.1 pybedtools 0.8.1 pysam 0.16.0.1 python-dateutil 2.8.2 pytz 2023.3 rpy2 2.9.4 scipy 1.7.3 setuptools 47.1.0 six 1.16.0

Renty9 commented 11 months ago

Maybe you can replace the reference sequence with a special version for 10X.

Francesc-Muyas commented 11 months ago

Dear user, Thanks for bringing this up. It should be fixed now. Do a git pull of the tool and try again. Let me know if the error still persists.

Cheers, Fran