chung-lab / SCAFE

Single Cell Analysis of Five'Ends
MIT License
45 stars 11 forks source link

Error in scafe.tool.sc.bam_to_ctss "Use of uninitialized value in division" #20

Closed jaimemrb closed 2 years ago

jaimemrb commented 2 years ago

Hi,

I've successfully run the demo data and all the software appears to e working. When I ran one of my own samples, however, sc.solo errored out with the following:

Use of uninitialized value in division (/) at /storage/goodell/home/jmreyes/scafe/SCAFE/scripts/scafe.tool.sc.bam_to_ctss line 620. Illegal division by zero at /storage/goodell/home/jmreyes/scafe/SCAFE/scripts/scafe.tool.sc.bam_to_ctss line 620. Died at /storage/goodell/home/jmreyes/scafe/SCAFE/scripts/scafe.workflow.sc.solo line 595.

Is there a way to check what may be causing the issue? The bam file was aligned using 'cellranger count' with the SC5P-PE chemistry to mm10.

Thank you, Jaime

chung-lab commented 2 years ago

Hi Jaime thanks for using SCAFE. This error is likely caused by bam file format issues. The script scafe.tool.sc.bam_to_ctss randomly samples a small fraction of reads to determine the presence and location of template switching oligo at the 5'end of the read. The error "Illegal division by zero" suggest no reads were sampled, likely due to some specific formats of bam attributes, e.g. location of CB:Z and UB:Z tags. If you can send me the first 1000 lines of your bam file I might be able to figure out the problem.

jaimemrb commented 2 years ago

Thank you, I imagine it's upstream of SCAFE in the cellranger steps. The first 1000 lines are attached. -Jaime mLSK_WT_1000.txt

chung-lab commented 2 years ago

Checking your sam file, seems it contains only read 2: samflag is either 145 or 129. That causes the error as no read 1 was found. Not sure this is just the starting 1000 reads are all read 2 or the whole bam is. Please check. If you force SC5P-PE in cellranger count it should contain both read 1 and read 2. Please make sure the bam was indeed from cellranger count using SC5P-PE.

jaimemrb commented 2 years ago

Cellranger count was run with SC5P-PE but after inspecting the starting fastqs, they were run with bcl2fastq for --use-bases-mask=Y26,I8,Y98 which are the parameters for SC5P-R2. We sequenced PE150. Do you recommend running the demultiplexing from the bcl or attempting the dummy read method suggested on the SCAFE page?

chung-lab commented 2 years ago

As far as I understand you only have 26nt read 1. You'll have to have at least 26+35nt to confidently identify TSS. The junction between the TSO and the cDNA was used to identify the TSS. The dummy method was for datasets with read 1 only and to fake the read 2. So, you need to rerun bcl2fastq and get the read 1 as long as you could (150nt I assume)

ainsku commented 12 months ago

Hi,

@chung-lab I'm getting this same error and tried all the things suggested before, i.e. checked that my pair-end reads are long enough and did the alignment with the --chemistry SC5P-PE. When looking at my sam-flag, it's either 99, 147, 83, or 163 so as I understand it should be correctly aligned as well. When I try to run SCAFE I get the error Illegal division by zero at /SCAFE/scripts/scafe.tool.sc.bam_to_ctss line 1406.

Subset from the bam file I use subset_sam.txt

Thank you, Aino