This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error loading BAM on IGV

I get an error while uploading BAM file. I used bowtie to map small-RNA reads against one mRNA fasta file. I sorted and indexed the bam file but I get the error in uploading it on IGV:

Error loading BAM file: htsjdk.samtools.SAMException: Sequence name 'X64322.2:1-409,510-527,628-676,777-1929' doesn't match regex: '[0-9A-Za-z!#$%&+./:;?@^_|~-][0-9A-Za-z!#$%&*+./:;=?@^_|~-]*'

Could someone help me please?

This is my fast file (ref) head: ```

X64322.2:1-409,510-527,628-676,777-1929 Chironomus tentans partial BR1 gene for balbiani ring protein 1 precursor AGTTTTGGGAATTCATTTCCAGACTTCTCCCAAGTAAAATAAAAGAAGTGTGAAGTAAGTGAAAACAAAC ```

and here is my BAM file header:

samtools view file.bam | head
NB501365:508:HJF2HBGXF:2:13202:14744:16156  16  X64322.2:1-409,510-527,628-676,777-1929 16  255 61M *   0   0   TTTCCAGACTTCTCCCAAGTAAAATAAAAGAAGTGTGAAGTAAGTGAAAAAAAACCAAGTG   IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII   XA:i:1  MD:Z:50C10  NM:i:1  XM:i:2
NB501365:508:HJF2HBGXF:3:13401:10152:8366   16  X64322.2:1-409,510-527,628-676,777-1929 16  255 61M *   0   0   TTTCCAGACTTCTCCCAAGTAAAATAAAAGAAGTGTGAAGTAAGTGAAAAAAAACCAAGTG   IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
software error igv bam

1 answer

A reference chromosome cannot be named "X64322.2:1-409,510-527,628-676,777-1929" . see the SAM Spec: https://samtools.github.io/hts-specs/SAMv1.pdf

Reference sequence names may contain any printable ASCII characters in the range[!-~]apart frombackslashes, commas, quotation marks, and brackets—i.e., apart from ‘\ , "‘’ () [] {} <>’—and may notstart with ‘*’ or ‘=’

why ? because you could not query a specific a region 100-200 of such file:

eg. samtools view your.bam X64322.2:1-409,510-527,628-676,777-1929:100-200

you should rename your reference.

Thank you @Pierre Yes as you mentioned the error was due to the commas. I deleted them and did indexing and alignment again, it worked fine.

Log in to answer this question.