public class SamAlignmentMerger extends AbstractAlignmentMerger
AbstractAlignmentMerger.UnmappingReadStrategy
MAX_RECORDS_IN_RAM, referenceFasta
Constructor and Description |
---|
SamAlignmentMerger(java.io.File unmappedBamFile,
java.io.File targetBamFile,
java.io.File referenceFasta,
htsjdk.samtools.SAMProgramRecord programRecord,
boolean clipAdapters,
boolean bisulfiteSequence,
boolean alignedReadsOnly,
java.util.List<java.io.File> alignedSamFile,
int maxGaps,
java.util.List<java.lang.String> attributesToRetain,
java.util.List<java.lang.String> attributesToRemove,
java.lang.Integer read1BasesTrimmed,
java.lang.Integer read2BasesTrimmed,
java.util.List<java.io.File> read1AlignedSamFile,
java.util.List<java.io.File> read2AlignedSamFile,
java.util.List<htsjdk.samtools.SamPairUtil.PairOrientation> expectedOrientations,
htsjdk.samtools.SAMFileHeader.SortOrder sortOrder,
PrimaryAlignmentSelectionStrategy primaryAlignmentSelectionStrategy,
boolean addMateCigar,
boolean unmapContaminantReads,
int minUnclippedBases)
Constructor with a default value for unmappingReadStrategy
|
SamAlignmentMerger(java.io.File unmappedBamFile,
java.io.File targetBamFile,
java.io.File referenceFasta,
htsjdk.samtools.SAMProgramRecord programRecord,
boolean clipAdapters,
boolean bisulfiteSequence,
boolean alignedReadsOnly,
java.util.List<java.io.File> alignedSamFile,
int maxGaps,
java.util.List<java.lang.String> attributesToRetain,
java.util.List<java.lang.String> attributesToRemove,
java.lang.Integer read1BasesTrimmed,
java.lang.Integer read2BasesTrimmed,
java.util.List<java.io.File> read1AlignedSamFile,
java.util.List<java.io.File> read2AlignedSamFile,
java.util.List<htsjdk.samtools.SamPairUtil.PairOrientation> expectedOrientations,
htsjdk.samtools.SAMFileHeader.SortOrder sortOrder,
PrimaryAlignmentSelectionStrategy primaryAlignmentSelectionStrategy,
boolean addMateCigar,
boolean unmapContaminantReads,
int minUnclippedBases,
AbstractAlignmentMerger.UnmappingReadStrategy unmappingReadStrategy,
java.util.List<java.lang.String> requiredMatchingDictionaryTags)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected htsjdk.samtools.SAMSequenceDictionary |
getDictionaryForMergedBam() |
boolean |
getForceSort() |
protected htsjdk.samtools.util.CloseableIterator<htsjdk.samtools.SAMRecord> |
getQuerynameSortedAlignedRecords()
Reads the aligned SAM records into a SortingCollection and returns an iterator over that collection
|
protected boolean |
ignoreAlignment(htsjdk.samtools.SAMRecord sam)
For now, we ignore only those alignments that have more than
maxGaps insertions
or deletions. |
protected boolean |
isContaminant(picard.sam.HitsForInsert hits)
Criteria for contaminant reads:
1.
|
void |
mergeAlignment(java.io.File referenceFasta)
Merges the alignment from the map file with the non-aligned records from the source BAM file.
|
clipForOverlappingReads, close, createNewCigarsIfMapsOffEndOfReference, encodeMappingInformation, fixNmMdAndUq, fixUq, getAttributesToReverse, getAttributesToReverseComplement, getHeader, getProgramRecord, isClipOverlappingReads, isKeepAlignerProperPairFlags, isReservedTag, resetRefSeqFileWalker, setAddPGTagToReads, setAttributesToReverse, setAttributesToReverseComplement, setClipOverlappingReads, setHardClipOverlappingReads, setIncludeSecondaryAlignments, setKeepAlignerProperPairFlags, setMaxRecordsInRam, setProgramRecord, setValuesFromAlignment, updateCigarForTrimmedOrClippedBases
public SamAlignmentMerger(java.io.File unmappedBamFile, java.io.File targetBamFile, java.io.File referenceFasta, htsjdk.samtools.SAMProgramRecord programRecord, boolean clipAdapters, boolean bisulfiteSequence, boolean alignedReadsOnly, java.util.List<java.io.File> alignedSamFile, int maxGaps, java.util.List<java.lang.String> attributesToRetain, java.util.List<java.lang.String> attributesToRemove, java.lang.Integer read1BasesTrimmed, java.lang.Integer read2BasesTrimmed, java.util.List<java.io.File> read1AlignedSamFile, java.util.List<java.io.File> read2AlignedSamFile, java.util.List<htsjdk.samtools.SamPairUtil.PairOrientation> expectedOrientations, htsjdk.samtools.SAMFileHeader.SortOrder sortOrder, PrimaryAlignmentSelectionStrategy primaryAlignmentSelectionStrategy, boolean addMateCigar, boolean unmapContaminantReads, int minUnclippedBases)
public SamAlignmentMerger(java.io.File unmappedBamFile, java.io.File targetBamFile, java.io.File referenceFasta, htsjdk.samtools.SAMProgramRecord programRecord, boolean clipAdapters, boolean bisulfiteSequence, boolean alignedReadsOnly, java.util.List<java.io.File> alignedSamFile, int maxGaps, java.util.List<java.lang.String> attributesToRetain, java.util.List<java.lang.String> attributesToRemove, java.lang.Integer read1BasesTrimmed, java.lang.Integer read2BasesTrimmed, java.util.List<java.io.File> read1AlignedSamFile, java.util.List<java.io.File> read2AlignedSamFile, java.util.List<htsjdk.samtools.SamPairUtil.PairOrientation> expectedOrientations, htsjdk.samtools.SAMFileHeader.SortOrder sortOrder, PrimaryAlignmentSelectionStrategy primaryAlignmentSelectionStrategy, boolean addMateCigar, boolean unmapContaminantReads, int minUnclippedBases, AbstractAlignmentMerger.UnmappingReadStrategy unmappingReadStrategy, java.util.List<java.lang.String> requiredMatchingDictionaryTags)
unmappedBamFile
- The BAM file that was used as the input to the aligner, which will
include info on all the reads that did not map. Required.targetBamFile
- The file to which to write the merged SAM records. Required.referenceFasta
- The reference sequence for the map files. Required.programRecord
- Program record for taget file SAMRecords created.clipAdapters
- Whether adapters marked in unmapped BAM file should be marked as
soft clipped in the merged bam. Required.bisulfiteSequence
- Whether the reads are bisulfite sequence (used when calculating the
NM and UQ tags). Required.alignedReadsOnly
- Whether to output only those reads that have alignment dataalignedSamFile
- The SAM file(s) with alignment information. Optional. If this is
not provided, then read1AlignedSamFile and read2AlignedSamFile must be.maxGaps
- The maximum number of insertions or deletions permitted in an
alignment. Alignments with more than this many gaps will be ignored.
-1 means to allow any number of gaps.attributesToRetain
- attributes from the alignment record that should be
retained when merging, overridden by attributesToRemove if they share
common tags.attributesToRemove
- attributes from the alignment record that should be
removed when merging. This overrides attributesToRetain if they share
common tags.read1BasesTrimmed
- The number of bases trimmed from start of read 1 prior to alignment. Optional.read2BasesTrimmed
- The number of bases trimmed from start of read 2 prior to alignment. Optional.read1AlignedSamFile
- The alignment records for read1. Used when the two ends of a read are
aligned separately. This is optional, but must be specified if
alignedSamFile is not.read2AlignedSamFile
- The alignment records for read1. Used when the two ends of a read are
aligned separately. This is optional, but must be specified if
alignedSamFile is not.expectedOrientations
- A List of SamPairUtil.PairOrientations that are expected for
aligned pairs. Used to determine the properPair flag.sortOrder
- The order in which the merged records should be output. If null,
output will be coordinate-sortedprimaryAlignmentSelectionStrategy
- How to handle multiple alignments for a fragment or read pair,
in which none are primary, or more than one is marked primaryaddMateCigar
- True if we are to add or maintain the mate CIGAR (MC) tag, false if we are to remove or not include.unmapContaminantReads
- If true, identify reads having the signature of cross-species contamination (i.e. mostly clipped bases),
and mark them as unmapped.minUnclippedBases
- If unmapContaminantReads is set, require this many unclipped bases or else the read will be marked as contaminant.unmappingReadStrategy
- An enum describing how to deal with reads whose mapping information are being removed (currently this happens due to cross-species
contamination). Ignored unless unmapContaminantReads is true.requiredMatchingDictionaryTags
- A list of SAMSequenceRecord tags that must be equal (if present) in the aligned bam and the reference dictionary.
Program will issue a warning about other tags, if present in both files and are different.public void mergeAlignment(java.io.File referenceFasta)
mergeAlignment
in class AbstractAlignmentMerger
protected htsjdk.samtools.SAMSequenceDictionary getDictionaryForMergedBam()
getDictionaryForMergedBam
in class AbstractAlignmentMerger
protected htsjdk.samtools.util.CloseableIterator<htsjdk.samtools.SAMRecord> getQuerynameSortedAlignedRecords()
getQuerynameSortedAlignedRecords
in class AbstractAlignmentMerger
protected boolean ignoreAlignment(htsjdk.samtools.SAMRecord sam)
maxGaps
insertions
or deletions.ignoreAlignment
in class AbstractAlignmentMerger
protected boolean isContaminant(picard.sam.HitsForInsert hits)
isContaminant
in class AbstractAlignmentMerger
public boolean getForceSort()