![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Merging bam files | memento | Bioinformatics | 1 | 02-17-2012 04:39 PM |
merging bam files with different headers | dnusol | Bioinformatics | 2 | 02-07-2012 12:09 AM |
Problem importing BAM files in Artemis | pasta | Bioinformatics | 7 | 01-31-2012 06:26 AM |
merging many bam files-novice needs help please | shawpa | Bioinformatics | 2 | 01-06-2012 09:03 AM |
Merging multiple BAM files | unibegenomics | Bioinformatics | 1 | 08-25-2011 03:03 AM |
![]() |
|
Thread Tools |
![]() |
#1 |
Member
Location: Liverpool, UK Join Date: Feb 2011
Posts: 30
|
![]()
Hi everyone. We are having difficulty merging BAM files. Our pipeline so far is this:-
50bp single-end rna-seq reads - map to hg19 with Bowtie, writing unaligned reads to a new file and writing mapped reads to a SAM file. Then map unaligned Bowtie reads with TopHat and write to a BAM file. We now want to merge the two output files, but there is a problem with the way the reads are sorted. We have tried (1) samtools sort on both files, then samtools reheader and samtools merge, (2) sorting files as per command on cufflinks manual page (sort -k 3,3 -k 4,4n hits.sam > hits.sam.sorted) and then merging, (3) picard sort and merge commands, and yet none of these will actually merge the files. An example of the picard input / output is here: PHP Code:
Exception in thread "main" net.sf.samtools.util.SequenceUtil$SequenceListsDifferException: Sequences at index 1 dont match: 1/243199373/chr2 1/135534747/chr10 I think the problem lies somewhere with the way bowtie and tophat sort their output by default. Bowtie sorts numerically, chr1, chr2, chr3... etc whereas TopHat sorts chr1, chr10, chr11......chr19, chr2, chr20, chr21 etc. But we have sorted both files again using picard SortSam so we cannot understand why this discrepancy is not corrected. (Same happens with samtools sort). Can anyone help us please? Many thanks Helen |
![]() |
![]() |
![]() |
#2 |
Peter (Biopython etc)
Location: Dundee, Scotland, UK Join Date: Jul 2009
Posts: 1,543
|
![]()
Can you double check the embedded SAM text header (@SQ lines) and the BAM binary header (sequence names and lengths) are consistent? I suspect "samtools reheader" doesn't check this.
[Just a guess - there may well be other reasons why the merge fails] Last edited by maubp; 10-10-2011 at 02:51 AM. |
![]() |
![]() |
![]() |
#3 |
Member
Location: Liverpool, UK Join Date: Feb 2011
Posts: 30
|
![]()
Here are the headers:
Tophat output before Picard sorting: PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
![]() |
![]() |
![]() |
#4 |
Senior Member
Location: Sweden Join Date: Mar 2008
Posts: 324
|
![]()
Use Picard ReorderSam with the same ref.fa file for both bam files. SortSam / samtools sort just sorts the alignments in the same order as the SQ lines in the header.
Last edited by Chipper; 10-10-2011 at 12:57 PM. |
![]() |
![]() |
![]() |
#5 |
Senior Member
Location: Phoenix, AZ Join Date: Mar 2010
Posts: 279
|
![]()
Why not just align all reads with tophat? I'd guess the tophat alignment is not working well as all the exon restricted reads are lost in the bowtie alignment. Basically tophat is doing your pipeline as it does what you are doing and leverages the exon reads you are removing by doing bowtie first.
|
![]() |
![]() |
![]() |
#6 |
Member
Location: Liverpool, UK Join Date: Feb 2011
Posts: 30
|
![]()
Chipper - thank you. I will try your suggestion today.
Jon - We run Bowtie using best and strata settings, and trim the 3' end of the read, which as far as I am aware you cannot do using TopHat. We have spent considerable time optimising our mapping and find TopHat alone is not enough for our particular project. Last edited by hlwright; 10-11-2011 at 02:16 AM. |
![]() |
![]() |
![]() |
#7 |
Member
Location: Liverpool, UK Join Date: Feb 2011
Posts: 30
|
![]()
Thanks Chipper, your advice has solved the problem.
For anyone else who may be having the same problem, here is the solution:- Create a sequence dictionary for your reference.fa in the same folder:- PHP Code:
PHP Code:
PHP Code:
Once again thank you to everyone who took the time to read and reply to this post. Your help is very much appreciated ![]() |
![]() |
![]() |
![]() |
Tags |
merge, picard, samtools, sorting |
Thread Tools | |
|
|