Hi Ben,

You are right that we should document this better. And, no, I don't mean CleanSam.

Various aligners do all sorts of strange things to the reads; e.g. not all the reads are written to the output, reads are hard-clipped, some attributes in the input don't make it to the output, etc. MergeBamAlignment takes as input 2 BAMs: an unmapped BAM that presumably satisfies Picard's validation requirements, and an aligned BAM. It takes only the alignment information from the aligned BAM, and everything else from the unmapped BAM, and produces an aligned BAM that satisfies strict Picard validation.

-Alec

On 7/31/14, 12:25 PM, Ben Bimber wrote:
Hi Alex,

Using MergeBamAlignment as a cleanup tool (what you seem to be suggesting) is not something I would have guessed or seen in the docs. Did you mean CleanSam or is merge doing something extra beyond CleanSam? Is it a workaround to let you work in BAM versus SAM?

-Ben


On Thu, Jul 31, 2014 at 9:15 AM, Alec Wysoker <[email protected] <mailto:[email protected]>> wrote:

    Hi Wolfgang,

    I will not argue that Picard's behavior in this regard is absolutely
    conforming to the spec.  If you troll through the list archive I
    believe
    you will find that this had been discussed before.  We have found this
    level of validation to be very useful.  If these alignments are coming
    from BWA, we recommend using MergeBamAlignment which will create a BAM
    that satisfies Picard's admittedly very strict validation.  Or,
    you can
    disable the validation.

    -Alec

    On 7/31/14, 11:40 AM, Wolfgang Maier wrote:
    > On 31.07.2014 17 <tel:31.07.2014%2017>:26, Alec Wysoker wrote:
    >> See the Picard FAQ:
    >>
    >>
    
http://sourceforge.net/p/picard/wiki/Main_Page/#q-why-am-i-getting-errors-from-picard-like-mapq-should-be-0-for-unmapped-read-or-cigar-should-have-zero-elements-for-unmapped-read
    >>
    >> -Alec
    >>
    > Well, that shows that it is known behavior of PicardTools, but
    still, is
    > it *correct* behavior given the format specifications ?
    >
    >> On 7/31/14, 4:36 AM, Wolfgang Maier wrote:
    >>> Hi,
    >>>
    >>> I've tried to run SamToFastq on a sam file with unaligned
    reads. Right
    >>> on the first line picardtools complains:
    >>>
    >>> Exception in thread "main"
    >>> htsjdk.samtools.SAMFormatException: Error parsing text SAM
    >>> file. MAPQ must be zero if RNAME is not specified; Line 4
    >>> Line:
>>> HWI-EA332_1_2_662_117/1 4 * 0 255 * * 0 0
    >>> CCACACTACACCCTAACACACCCTAATCTAACCCTGGCCAACCTGTCTCTC
    >>> BBBBCCCCBB@BCB?CBC@ABB?<>AB?CBCBB@BC>BB@BB7BCB<BCA? RG:Z:007
    >>>
    >>> After consulting the sam format specifications I think that this
    >>> behavior is incorrect.
    >>> The read has bit 4 set in the FLAG field and with that "no
    assumption
    >>> can be made about RNAME, POS, CIGAR, MAPQ", so picard
    shouldn't even
    >>> look at MAPQ here.
    >>> Even if it did, I don't know whether it should expect MAPQ to
    be zero in
    >>> the absence of RNAME as a MAPQ value of 255 "indicates that
    the mapping
    >>> quality is not available", which seems to be about as
    reasonable as
    >>> setting it to 0.
    >>>
    >>> Please correct me if I'm getting this wrong,
    >>> Wolfgang
    >>>
    >>>
    >>>
    
------------------------------------------------------------------------------
    >>> Infragistics Professional
    >>> Build stunning WinForms apps today!
    >>> Reboot your WinForms applications with our WinForms controls.
    >>> Build a bridge from your legacy apps to the future.
    >>>
    http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
    >>> _______________________________________________
    >>> Samtools-help mailing list
    >>> [email protected]
    <mailto:[email protected]>
    >>> https://lists.sourceforge.net/lists/listinfo/samtools-help
    >>
    >>
    
------------------------------------------------------------------------------
    >> Infragistics Professional
    >> Build stunning WinForms apps today!
    >> Reboot your WinForms applications with our WinForms controls.
    >> Build a bridge from your legacy apps to the future.
    >>
    http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
    >>
    >
    
------------------------------------------------------------------------------
    > Infragistics Professional
    > Build stunning WinForms apps today!
    > Reboot your WinForms applications with our WinForms controls.
    > Build a bridge from your legacy apps to the future.
    >
    http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
    > _______________________________________________
    > Samtools-help mailing list
    > [email protected]
    <mailto:[email protected]>
    > https://lists.sourceforge.net/lists/listinfo/samtools-help


    
------------------------------------------------------------------------------
    Infragistics Professional
    Build stunning WinForms apps today!
    Reboot your WinForms applications with our WinForms controls.
    Build a bridge from your legacy apps to the future.
    http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
    _______________________________________________
    Samtools-help mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/samtools-help



------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Samtools-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to