uk.ac.sanger.npg.picard
Class BamMerger

java.lang.Object
  extended by net.sf.picard.cmdline.CommandLineProgram
      extended by uk.ac.sanger.npg.picard.PicardCommandLine
          extended by uk.ac.sanger.npg.picard.BamMerger

public class BamMerger
extends PicardCommandLine

A command-line tool to merge BAM/SAM alignment info in a bam with the data in an unmapped BAM file, producing a third BAM file that has alignment data and all the additional data from the unmapped BAM. All the fields in each read will be added if not already in alignment. The failed quality check flag in unmapped reads, and paired, first and second read flags will be added to alignment. Two bam files must be in the same order but unmapped bam may have more records than the aligned bam. There is an option to add these extra reads into final bam. Only SQ records and alignment PG in the aligned bam file will be added to the output by default. Default alignment PG ID is bwa, you need specify this PG ID from command line if not. There is an option you can merge all other PGs in aligned bam file into the output. All header information in the unmapped bam header will be kept, except SQ records.


Field Summary
 java.io.File ALIGNED_BAM
           
 java.lang.String ALIGNMENT_PROGRAM_ID
           
 java.io.File INPUT
           
 java.lang.Boolean KEEP_ALL_PG
           
 java.lang.Boolean KEEP_EXTRA_UNMAPPED_READS
           
 java.io.File OUTPUT
           
 java.lang.Boolean REPLACE_ALIGNED_BASE_QUALITY
           
 java.lang.String USAGE
           
 
Fields inherited from class uk.ac.sanger.npg.picard.PicardCommandLine
version
 
Fields inherited from class net.sf.picard.cmdline.CommandLineProgram
COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, MAX_RECORDS_IN_RAM, QUIET, TMP_DIR, VALIDATION_STRINGENCY, VERBOSITY
 
Constructor Summary
BamMerger()
           
 
Method Summary
protected  int doWork()
           
static void main(java.lang.String[] args)
          example: ALIGNED=testdata/bam/6210_8_aligned.sam I=testdata/bam/6210_8.sam OUTPUT=testdata/6210_8_merged.bam TMP_DIR=testdata VALIDATION_STRINGENCY=SILENT
 void mergeRecords(net.sf.samtools.SAMRecord alignment, net.sf.samtools.SAMRecord record)
           
 
Methods inherited from class uk.ac.sanger.npg.picard.PicardCommandLine
addProgramRecordToHead, getThisProgramRecord, makeUniqueProgramId
 
Methods inherited from class net.sf.picard.cmdline.CommandLineProgram
customCommandLineValidation, getCommandLine, getCommandLineParser, getDefaultHeaders, getMetricsFile, getProgramVersion, getStandardUsagePreamble, instanceMain, instanceMainWithExit, parseArgs, setDefaultHeaders
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USAGE

@Usage(programVersion="1.00")
public final java.lang.String USAGE

ALIGNED_BAM

@Option(shortName="ALIGNED",
        doc="The input SAM or BAM file with alignment.")
public java.io.File ALIGNED_BAM

ALIGNMENT_PROGRAM_ID

@Option(shortName="PG",
        doc="The alignment program ID in the header of the SAM or BAM file with alignment.")
public java.lang.String ALIGNMENT_PROGRAM_ID

KEEP_ALL_PG

@Option(shortName="KEEP_PG",
        doc="keep all other PGs in aligned bam into output")
public java.lang.Boolean KEEP_ALL_PG

INPUT

@Option(shortName="I",
        doc="The input unmapped SAM or BAM file to merge.")
public java.io.File INPUT

OUTPUT

@Option(shortName="O",
        doc="The output file after merging.")
public java.io.File OUTPUT

KEEP_EXTRA_UNMAPPED_READS

@Option(shortName="KEEP",
        doc="KEEP extra unmapped reads in unmapped bam file to the final output if true.")
public java.lang.Boolean KEEP_EXTRA_UNMAPPED_READS

REPLACE_ALIGNED_BASE_QUALITY

@Option(shortName="REPLACE_QUAL",
        doc="Replace base qualities in aligned bam wtih the ones in unaligned bam if true.")
public java.lang.Boolean REPLACE_ALIGNED_BASE_QUALITY
Constructor Detail

BamMerger

public BamMerger()
Method Detail

doWork

protected int doWork()
Specified by:
doWork in class net.sf.picard.cmdline.CommandLineProgram

mergeRecords

public void mergeRecords(net.sf.samtools.SAMRecord alignment,
                         net.sf.samtools.SAMRecord record)
Parameters:
alignment -
record -

main

public static void main(java.lang.String[] args)
example: ALIGNED=testdata/bam/6210_8_aligned.sam I=testdata/bam/6210_8.sam OUTPUT=testdata/6210_8_merged.bam TMP_DIR=testdata VALIDATION_STRINGENCY=SILENT

Parameters:
args -