Igv Not Recognizing Samtools Sorted And Indexed Files.
3
0
Entering edit mode
11.7 years ago
joaslucas ▴ 90

Hi Everyone, I have a Bacterial RNA-seq data, I aligned it against the bacterial genome (BWA) and I got the following SAM file bellow ( I also have it as a BAM file).

@SQ    SN:gi|448814763|ref|NC_000962.3|    LN:4411532
H-161:169:c10paacxx:2:1101:1165:1975    0    gi|448814763|ref|NC_000962.3|    1471730    37    50M    *    0    0    TTTTGTTGTTATTTTTGGCCATGCTCTTGATGCCCCGTTTCCGGGGGCGT    ?@@FDADDDFFBHFEEDHFDHAGBHC@EGFDEHGG;:?BB900?D@####    XT:A:U    NM:i:2    X0:i:1    X1:i:0    XM:i:2    XO:i:0    XG:i:0    MD:Z:39G0T9
H-161:169:c10paacxx:2:1101:1733:1923    0    gi|448814763|ref|NC_000962.3|    1471725    37    50M    *    0    0    NACATTTTTGTTGTTATTTTTGGCCATGCTCTTGATGCCCCGNTGTCGGG    #4=DDFFFHHHHHJJIJJJJJIIJJJJJJJJJJIJJJJJJIJ#0?BFHGG    XT:A:U    NM:i:2    X0:i:1    X1:i:0    XM:i:2    XO:i:0    XG:i:0    MD:Z:0C41T7
H-161:169:c10paacxx:2:1101:4221:1950    0    gi|448814763|ref|NC_000962.3|    1473571    37    50M    *    0    0    CTGGATAGTGGTTGCGAGCATCAATGGATACGCTGCCGG

I would like to open it on IGV, but run into a problem. It says that the index file that I generated from samtools is not recognized. When I use the sorted file (from samtools too) and the IGV tries to generate an index file, it now says that th sorted file input (from samtools) has to be sorted by start position

org.broad.igv.sam.reader.UnsortedFileException: File must be sorted by start position. Sort test failed at: H-161:169:c10paacxx:2:1101:7106:1965 0 gi|448814763|ref|NC_000962.3| 1471717 37 50M * 0 0 GGTGGTTTCACATTTTTGTTGTTATTTTTGGCCATGCTCTTGATGCCCCG CCBFFDFFHHHHHJJJJJJJJJJIJJJJJIJJJJJJJJJJJIJJIJJJJI XT:A:U NM:i:0 X0:i:1 X1:i:0 XM:i:0 XO:i:0 XG:i:0 MD:Z:50

Hoe do I get they sorted by the start position?

Thanks

igv bwa samtools • 8.0k views
ADD COMMENT
2
Entering edit mode

How do I get they sorted by the start position?

samtools sort

ADD REPLY
4
Entering edit mode
11.7 years ago

As the error says your file is not sorted by position. Sort it, then index it and all will be fine.

samtools sort somefile.bam newfile
samtools index newfile.bam
ADD COMMENT
0
Entering edit mode

samtools sort somefile.bam > newfile

ADD REPLY
0
Entering edit mode
11.7 years ago

You should really be sorting your bam file samtools sort and then indexing that file samtools index. The default sort order is coordinate, which sort by contig name and then read start position.

ADD COMMENT
0
Entering edit mode
11.7 years ago
wjidea ▴ 50

Try the sort and index the sam file.

ADD COMMENT

Login before adding your answer.

Traffic: 1882 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6