Question: Want to create a new Index file for BAM using SAMTOOLS. Do I need to sort the default BAM file from Dante Labs First?
0
gravatar for Umesh
5 weeks ago by
Umesh0
Umesh0 wrote:

In hopes of getting more tools to play with my BAM file, I took the plunge to install Ubuntu on my W-10. I also installed all of the tools mentioned in a handy guide provided by RandyH (https://docs.google.com/document/d/1Yg4oRDCIQr5RoTZqECPYFDZxoxN-hggXKxy9BVDQpnY/edit#). My process was not exactly the same as he had mentioned, and I tweaked it by googling the steps(eg by using chocolatey to install lxrunoffline), but I think the end result is the same. I did install samtools using conda (using a post from him on this forum), but had to face an issue which was ultimately solved by downgrading openssl to version 1.0

I was reading more about samtools for the purpose of creating an index file for my BAM file, since IGV and Tablet BAM browsers say that Index File is older than BAM file.

However the page at http://quinlanlab.org/tutorials/samtools/samtools.html mentions about sorting the BAM file first before generating an Index. When I check the order using the command on the page, I get an output, but I am not sure what I need to be looking at to check whether the order is correct, or a re-sorting is needed.

Could someone please take a look at the output and tell whether I need to re-sort the file before attempting to re-index or not? Since I am from a medical background, and have very less experience of using command prompt, please forgive any basic mistakes I may be making. I have uploaded the screenshots.

https://img.techpowerup.org/200707/3.jpg

https://img.techpowerup.org/200707/4.jpg

https://img.techpowerup.org/200707/5.jpg

ADD COMMENTlink modified 5 weeks ago by Devon Ryan96k • written 5 weeks ago by Umesh0
1

From the 1st screenshot, I suspect you're using the wrong fasta reference .

enter image description here

Furthermore, the command samtools view -H your.bam | head should show you if the sort-order is coordinate

ADD REPLYlink written 5 weeks ago by Pierre Lindenbaum129k

enter image description hereI've uploaded the result which i get after the command, but i am unsure what numbers represent the coordinates?

Also, the log file of the error which I get in Tablet is here: https://img.techpowerup.org/200707/tablet.jpg

I use a hg-19 fasta file that I downloaded from broadinstitute.org https://img.techpowerup.org/200707/hg-19-fasta.jpg which works fine in IGV. The folder also contains the hg-19 fasta.fai and hg-19fasta.gz.gzi files. Even the BAM opens fine in IGV. However even WGSExtract gives the same notification as Tablet, i.e. Index file is older than BAM File. https://img.techpowerup.org/200707/wgs-extract.jpg

I had upgraded my Sample from 4x to 30x coverage, so maybe Dante forgot to update my bam.bai file.

Thats why I was trying to create a new Index file using samtools.

ADD REPLYlink modified 5 weeks ago • written 5 weeks ago by Umesh0
3
gravatar for Devon Ryan
5 weeks ago by
Devon Ryan96k
Freiburg, Germany
Devon Ryan96k wrote:

The last screen shot in your post suggests that the files are sorted. Please note that the BAM files appear to use chromosome names like 1 and 2, but in Tablet you're trying to use chr1 and chr2, which will likely cause some issues.

ADD COMMENTlink written 5 weeks ago by Devon Ryan96k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1500 users visited in the last hour