samtools sort somefile.bam > newfile
Igv Not Recognizing Samtools Sorted And Indexed Files.
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
• 9,371 views
•
link
3 answers
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
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.
samtools sort