Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amitm
    Member
    • Feb 2011
    • 52

    #1

    Regarding MergeBam tool of Picard

    hi all,
    A seemingly simple task of merging BAMs has flummoxed me. Picard MergeBamAlignment module has a mandatory option of UNAMAPPED_BAM file.

    I am using bwa aln and it doesn't return separately any unmapped file. I couldn't understand this parameter. Is this module supposed to be used only if one has unmapped BAMs too.

    Anyways, another Picard module: MergeSamFiles, says it can merge BAMs too and doesn't require unmapped BAMs.

    I spent so much time understanding the former; thought anyone else looking at these modules should be aware too.
  • MBekritsky
    Member
    • Nov 2009
    • 15

    #2
    From Picard MergeBamAlignment--
    UNMAPPED_BAM - Original SAM or BAM file of unmapped reads, which must be in queryname order.

    You must give MergeBamAlignment the original sequences you aligned using bwa aln in BAM or SAM format, sorted by read ID.

    I haven't used this command before, and it's not clear to me what purpose it serves. I'm sure these is a reason for it, I just haven't come across it yet.

    In any case, if you have multiple output BAMs that you'd like to merge post-alignment, perhaps the best choice is MergeSamFiles. If I were you, I'd add a read group to each file separately before merging them. You can do that using Picard's AddOrReplaceReadGroups.
    Last edited by MBekritsky; 08-25-2014, 08:40 AM. Reason: Clarification

    Comment

    • amitm
      Member
      • Feb 2011
      • 52

      #3
      hi MBekritsky,
      Its not clear as UNMAPPED_BAM is asking for a BAM file and not original sequence file which would be a fastq. The aligner which I know that writes out separate BAM for unmapped seq. is TopHat (Not sure of the recent versions though).

      Ya, I did passed the readgroup info at the bwa sampe stage. There were multiple lanes and wanted to combine the final BAMs.

      thanks

      Comment

      • MBekritsky
        Member
        • Nov 2009
        • 15

        #4
        Hi amitm,

        I regularly deal with unaligned reads in BAM format. It's a little odd, since BAM is meant to store alignment information, but it's not uncommon, since it allows you to store read pairs in the same file and compresses the data. You can get from FASTQ to BAM (or SAM) format using Picard's FastqToSam.

        The line regarding what UNMAPPED_BAM requires is a direct quote from the Picard website. It seems to be simply asking for the unmapped reads initially passed to BWA for alignment. I don't see the same ambiguity that you do, but I also haven't been spending as much time on it as you do, so I will defer to you.

        Lastly, if all you want to do is combine the final BAMs, why not use MergeSamFiles? That works very well and doesn't have the requirement for UNMAPPED_BAM as an input.

        Comment

        • dpryan
          Devon Ryan
          • Jul 2011
          • 3478

          #5
          Picard's MergeBamAlignment tool is poorly named and I doubt you're the first person to wonder about this. A better name would have been IncorporateUnmapped.

          Comment

          • MBekritsky
            Member
            • Nov 2009
            • 15

            #6
            So it's for use with alignment algorithms that don't report unmapped reads?

            Comment

            • dpryan
              Devon Ryan
              • Jul 2011
              • 3478

              #7
              There are a couple uses (that I know of at least). Firstly, it can be convenient to merge in unmapped reads and then just archive the resulting BAM file rather than archiving a BAM file having only mapped reads and a fastq file. Secondly, some downstream tools (particularly RNAseqQC) need to know the total number of initial reads you had in order to produce correct output.

              BTW, the description in the original email mentioning this tools is informative here:

              - MergeBamAlignment - Tool to take a Sam or Bam file of unmapped
              reads and merge it with a Sam or Bam file that contains alignment
              information for a subset of those reads, retaining all metadata from the
              unmapped file.
              So originally some of the developers were using BAM files to hold unmapped reads (this can be convenient) and then wanted to merge back in the unmapped reads. Yeah, it'd make sense to just have the aligner spit the unmapped reads out, but that's not always an option (really, who has the time to muck with every aligner's code).

              Comment

              Latest Articles

              Collapse

              • SEQadmin2
                Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                by SEQadmin2



                Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                ...
                10-14-2026, 09:55 AM
              • SEQadmin2
                New Genomics Technologies Take Aim at Long-Standing Limits
                by SEQadmin2


                Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                ...
                09-28-2026, 10:25 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, Yesterday, 10:52 AM
              0 responses
              9 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-14-2026, 05:39 AM
              0 responses
              19 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-13-2026, 09:56 AM
              0 responses
              16 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-09-2026, 11:14 AM
              0 responses
              27 views
              0 reactions
              Last Post SEQadmin2  
              Working...