10XGenomics / scHLAcount

Count HLA alleles in single-cell RNA-seq data
MIT License
58 stars 12 forks source link

Error fetching locus 6 from BAM file #23

Closed potterae closed 3 months ago

potterae commented 1 year ago

Hi, I tried to run scHLA count using the -d option, specifying the location of the BAM, directory with the IMGT database, and cell barcode file but I got the following error when I tried to run. Do you have any idea what may be causing or how I could correct? This is CellRanger output for the BAM and the barcode file (CellRanger 5). I checked the header of the BAM and it appears to be correct (chr6). Thank you!

sc_hla_count_linux --bam=/home/andrew/cellranger-5.0.1/TBX1R/outs/possorted_genome_bam.bam --cell-barcodes=/home/andrew/cellranger-5.0.1/TBX1R/outs/filtered_feature_bc_matrix/barcodes.tsv --hladb-dir=/home/andrew/scHLA 15:03:20 [INFO] Created output directory at hla-typer-results 15:03:20 [INFO] Created temp directory at pseudoaligner_tmp 15:03:20 [INFO] Building index from fasta 15:03:20 [INFO] Found 6497 "Confirmed" + "Full" + "gDNA" + non-Null alleles in allele status file 15:03:20 [INFO] Starting reading the Fasta file 15:03:20 [INFO] Read 5881 Alleles, deduped into 4291 full-length 3-digit alleles Sharding sequences... Got 478993 sequence chunks Assembling 130 shards...

Done separate de Bruijn graph construction Starting merging disjoint graphs Merger of graphs complete Indexing de Bruijn graph Total 70570 kmers to process in dbg Making mphf of kmers Assigning offsets to kmers 15:03:20 [INFO] Finished building index! 15:03:20 [INFO] Writing index to disk 15:03:20 [INFO] Finished writing index! 15:03:20 [INFO] Reading database index from disk 15:03:20 [INFO] Finished reading index! 15:03:20 [INFO] Mapping reads from BAM to database Failed with error: Error fetching locus 6 from BAM file. Are you using a valid contig name? Check for '6' vs 'chr6'. Additional details :Fetch

Error fetching locus 6 from BAM file. Are you using a valid contig name? Check for '6' vs 'chr6'.

olivermccallion commented 1 year ago

Did you find a solution to this? I'm having the same error running on CellRanger 7.0.1 output.

potterae commented 1 year ago

Did you find a solution to this? I'm having the same error running on CellRanger 7.0.1 output.

Hi Oliver, no not yet! I took a break to work on other stuff. Please let me know if you figure it out.

Andrew

olivermccallion commented 1 year ago

OK, so I got it to work by removing 'chr' from the BAM file with samtools and picard (export, edit and save the new headers and then use picard to replace the headers with the new headers):

samtools view -H {input} | sed -e 's!chr!!' > {new_headers}
picard ReplaceSamHeader I={input BAM} HEADER={new headers} O={output destination}

then index the bam file with the new headers

samtools index {new bam} {new indexed bam}

I also had to remove 'GRCh38,' from the barcodes file outputted by CellRanger 7.0.1 (otherwise it ran without error but outputted a zero-matrix).

Good luck!

ShadyYounis commented 5 months ago

use -r chr6:28510120-33480577

cdarby commented 3 months ago

Yes, your BAM file should have "6" instead of "chr6" as the chromosome name.