SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
TopHat generates accepted_hits.bam files for some of my samples, but for other shirley0818 RNA Sequencing 1 02-03-2014 05:55 AM
Can anyone explain BAM indexing algorithm to me? asiangg Bioinformatics 5 08-26-2013 09:28 AM
Problems with Bam files from Tophat bjchen Bioinformatics 0 04-11-2012 12:22 PM
Bam indexing problem? SeqVicious Bioinformatics 6 01-29-2012 09:12 AM
the tophat generate the bam file instead of sam files? dingkai0564 Bioinformatics 1 11-10-2010 07:33 PM

Reply
 
Thread Tools
Old 12-05-2014, 11:40 AM   #1
stormin
Member
 
Location: US

Join Date: Aug 2014
Posts: 23
Default indexing tophat bam files

Hi,

I am having trouble using samtools to index my tophat output for IGV viewing. The tophat output bam should be sorted (although I am having trouble too using samtools to sort the tophat output bam file).

This is how I call the tophat:
tophat2 -M --b2-very-sensitive --GTF ~/Documents/transcriptome_gtf/genes.gtf -p 7 --read-realign-edit-dist 0 --output-dir ./example ~/Documents/genome_UCSC/genome ~/Documents/Data/example.fastq

I then call samtools indexing using:
samtools index accepted_hits.bam

But I would get this error:
[bam_index_build2] fail to create the index file.

Doing samtools sorting with below command give me this error:
samtools sort ./accepted_hits.bam sort.prefix

[bam_sort_core] merging from 12 files...
open: No such file or directory
[bam_merge_core] fail to open file sort.prefix.0000.bam

At this point, I'm not sure what is going on. Please help!

Zach
stormin is offline   Reply With Quote
Old 12-05-2014, 04:03 PM   #2
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,049
Default

Can you sort using this command

Code:
$ samtools sort ./accepted_hits.bam accepted_hits_sorted
and they try indexing the sorted file.
GenoMax is offline   Reply With Quote
Old 12-05-2014, 04:14 PM   #3
stormin
Member
 
Location: US

Join Date: Aug 2014
Posts: 23
Default

Quote:
Originally Posted by GenoMax View Post
Can you sort using this command

Code:
$ samtools sort ./accepted_hits.bam accepted_hits_sorted
and they try indexing the sorted file.
Nope, I would get the same error message.
stormin is offline   Reply With Quote
Old 12-05-2014, 04:38 PM   #4
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,049
Default

Which version of samtools are you using?

Is sorting process making temporary files (with names containing 0001.bam etc) before you get that error?

Last edited by GenoMax; 12-05-2014 at 04:41 PM.
GenoMax is offline   Reply With Quote
Old 12-05-2014, 05:24 PM   #5
stormin
Member
 
Location: US

Join Date: Aug 2014
Posts: 23
Default

Quote:
Originally Posted by GenoMax View Post
Which version of samtools are you using?
Version number is 0.1.19-4428cd

Quote:
Originally Posted by GenoMax View Post
Is sorting process making temporary files (with names containing 0001.bam etc) before you get that error?
It looks like no temporary files are created. The command throws the error message after less than a minute of running (actually I'm not sure how long it typically takes). It looks like it stops after loading the file, since calling the same command with the unmapped bam file as argument is much faster in reaching the error message.
stormin is offline   Reply With Quote
Old 12-05-2014, 05:41 PM   #6
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,049
Default

Is this the version bundled with TopHat code (which is the one tested to work)?
GenoMax is offline   Reply With Quote
Old 12-05-2014, 06:52 PM   #7
stormin
Member
 
Location: US

Join Date: Aug 2014
Posts: 23
Default

Quote:
Originally Posted by GenoMax View Post
Is this the version bundled with TopHat code (which is the one tested to work)?
I think I installed samtools before tophat. Everything works actually with tophat and I am able to use the BAM files for HTSEQ and then DESEQ2.
stormin is offline   Reply With Quote
Old 12-05-2014, 07:41 PM   #8
blancha
Senior Member
 
Location: Montreal

Join Date: May 2013
Posts: 367
Default

Check how much free disk space you have.
blancha is offline   Reply With Quote
Old 12-05-2014, 09:27 PM   #9
stormin
Member
 
Location: US

Join Date: Aug 2014
Posts: 23
Default

Quote:
Originally Posted by blancha View Post
Check how much free disk space you have.
That shouldn't be a problem, there are more than 700gb left on the hard-drive.
stormin is offline   Reply With Quote
Old 12-05-2014, 09:46 PM   #10
blancha
Senior Member
 
Location: Montreal

Join Date: May 2013
Posts: 367
Default

Devon Ryan seems to describe the bug here.
https://www.biostars.org/p/93368/

I would just install samtools 1.1 which has many interesting new features anyway.
It should fix the issue.
blancha is offline   Reply With Quote
Old 12-06-2014, 03:07 AM   #11
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,049
Default

No harm in trying the latest samtools but TopHat page has this to say

Quote:
Removed SAMtools as an external dependency in order to avoid incompatibility issues with recent and future changes of SAMtools and its code library (an older, stable SAMtools version is now packaged with TopHat)
I also see a v.0.1.20 on samtools download page so if you want to stay with the old series give that a try.
GenoMax is offline   Reply With Quote
Old 12-06-2014, 03:55 AM   #12
blancha
Senior Member
 
Location: Montreal

Join Date: May 2013
Posts: 367
Default

Right, you should also get the latest version of TopHat that comes bundled with the appropriate version of samtools required by TopHat.

You'll then have the best of best worlds, the latest version of TopHat running with a tried and tested version of samtools, and the latest version of samtools with all the new bells and whistles.

I'm basing all these assumptions on Devon Ryan's post, but his explanations are quite convincing and his description of the bug corresponds to yours.

My advice:
1- Install the very latest version of samtools with all the new bells and whistles, and without the bug.
2- Install the latest version of TopHat2 which comes bundled with a tried and tested version of samtools, that has been tested for compatibility with TopHat2. (This version will be used internally by TopHat.)
blancha is offline   Reply With Quote
Old 12-06-2014, 04:05 AM   #13
blancha
Senior Member
 
Location: Montreal

Join Date: May 2013
Posts: 367
Default

Incidentally, you will still need to sort the BAM file before indexing it, as GenoMax pointed out.
blancha is offline   Reply With Quote
Old 12-08-2014, 12:38 PM   #14
stormin
Member
 
Location: US

Join Date: Aug 2014
Posts: 23
Default

Thanks for all the inputs, looks like updating fixed this bug!
stormin is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 01:45 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO