samtools/samtools — pull request #11 by peterjc (2012-06-19 16:29:30+00:00)
Title: Depad2

Hi Heng,

This is a replacement/update for https://github.com/samtools/samtools/pull/6

I've worked on the handling of superfluous CIGAR P operators in 'samtools depad', and found and fixed a buffer overflow when CIGAR D operators are used.

I also realized you were right originally not to accept CIGAR P operators in the input padded reference BAM file (much like it does not make sense to use CIGAR I in this case either), and restored that check.

The command line API has been extended to support SAM or BAM for input or output, and you can (and should) provide a padded reference FASTA file.

Provided a padded reference FASTA file is provided, the reference lengths in the header (including the @SQ lines in the SAM header) are updated. If not, a warning is given. My preferred way to deal with this is to use any embedded references, which requires enhancements to the BAI file (see mailing list). Otherwise a pre-scan of the file could be made to find the embedded references.

Peter