Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • dnusol
    Senior Member
    • Jul 2009
    • 136

    merging bam files with different headers

    Hi,

    Is it possible to merge bam files from the same sample but different reference sequence and thus different headers, so that I work with one single alignment file instead of two?.

    I tried

    Code:
    java -Xmx4g -jar ~/picard-tools-1.61/MergeSamFiles.jar  INPUT=Sample1_exon1.bam INPUT=Sample1_exon2.bam OUTPUT=Sample1_merged.bam ASSUME_SORTED=true USE_THREADING=true VALIDATION_STRINGENCY=LENIENT
    but I got the following error:

    Exception in thread "main" net.sf.samtools.util.SequenceUtil$SequenceListsDifferException: Sequences at index 0 don't match

    Cheers,

    Dave

    p.s.: I must say that the MERGE_SEQUENCE_DICTIONARIES flag seems to be related to this task but I am not sure what it actually means
    Last edited by dnusol; 02-06-2012, 08:14 AM.
  • Richard Finney
    Senior Member
    • Feb 2009
    • 701

    #2
    Even it if were possible, it wouldn't be a good idea.

    Check samtools merge documentation at http://samtools.sourceforge.net/samtools.shtml

    merge samtools merge [-nur1f] [-h inh.sam] [-R reg] <out.bam> <in1.bam> <in2.bam> [...]

    Merge multiple sorted alignments. The header reference lists of all the input BAM files, and the @SQ headers of inh.sam, if any, must all refer to the same set of reference sequences. The header reference list and (unless overridden by -h) ‘@’ headers of in1.bam will be copied to out.bam, and the headers of other files will be ignored.

    Comment

    • dnusol
      Senior Member
      • Jul 2009
      • 136

      #3
      Thanks Richard,

      I was afraid of that. I see it as doing two steps of alignment against two different reference files instead of doing one single alignment against a file with two fasta entries. I guess the issue here is that you loose the ability of finding reads if multiple alignment is taking place. Unless this is done in a late step. But why a bad idea? to me it seems just a technical issue (samtools will only take into account headers of first in.bam file)

      Comment

      Latest Articles

      Collapse

      • SEQadmin2
        Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
        by SEQadmin2



        Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
        ...
        07-09-2026, 11:10 AM
      • SEQadmin2
        Cancer Drug Resistance: The Lingering Barrier to Rising Survival
        by SEQadmin2



        Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

        There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
        07-08-2026, 05:17 AM
      • GATTACAT
        Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
        by GATTACAT
        Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
        07-01-2026, 11:43 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, Yesterday, 10:26 AM
      0 responses
      11 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-09-2026, 10:04 AM
      0 responses
      25 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-08-2026, 10:08 AM
      0 responses
      16 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-07-2026, 11:05 AM
      0 responses
      33 views
      0 reactions
      Last Post SEQadmin2  
      Working...