Package htsjdk.samtools
Class SamFileHeaderMerger
java.lang.Object
htsjdk.samtools.SamFileHeaderMerger
Merges SAMFileHeaders that have the same sequences into a single merged header
object while providing read group translation for cases where read groups
clash across input headers.
-
Constructor Summary
ConstructorsConstructorDescriptionSamFileHeaderMerger
(SAMFileHeader.SortOrder sortOrder, Collection<SAMFileHeader> headers, boolean mergeDictionaries) Create SAMFileHeader with additional information..SamFileHeaderMerger
(Collection<SamReader> readers, SAMFileHeader.SortOrder sortOrder) Deprecated.SamFileHeaderMerger
(Collection<SamReader> readers, SAMFileHeader.SortOrder sortOrder, boolean mergeDictionaries) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionReturns the collection of readers that this header merger is working with.Returns the merged header that should be written to any output merged file.getMergedSequenceIndex
(SAMFileHeader header, Integer oldReferenceSequenceIndex) Another mechanism for getting the new sequence index, for situations in which the reader is not available.getMergedSequenceIndex
(SamReader reader, Integer oldReferenceSequenceIndex) Deprecated.replaced bygetMergedSequenceIndex(SAMFileHeader, Integer)
getProgramGroupId
(SAMFileHeader header, String originalProgramGroupId) getProgramGroupId
(SamReader reader, String originalProgramGroupId) Deprecated.replaced bygetProgramGroupId(SAMFileHeader, String)
Deprecated.replaced bygetHeaders()
getReadGroupId
(SAMFileHeader header, String originalReadGroupId) Returns the read group id that should be used for the input read and RG id.getReadGroupId
(SamReader reader, String originalReadGroupId) Deprecated.replaced bygetReadGroupId(SAMFileHeader, String)
boolean
boolean
Returns true if there are program group duplicates within the merged headers.boolean
Returns true if there are read group duplicates within the merged headers.static String
positiveFourDigitBase36Str
(int leftOver) Convert an integer to base36, protected solely for testing
-
Constructor Details
-
SamFileHeaderMerger
@Deprecated public SamFileHeaderMerger(Collection<SamReader> readers, SAMFileHeader.SortOrder sortOrder) Deprecated.Create SAMFileHeader with additional information. Required that sequence dictionaries agree.- Parameters:
readers
- sam file readers to combinesortOrder
- sort order new header should have
-
SamFileHeaderMerger
@Deprecated public SamFileHeaderMerger(Collection<SamReader> readers, SAMFileHeader.SortOrder sortOrder, boolean mergeDictionaries) Deprecated.Create SAMFileHeader with additional information.- Parameters:
readers
- sam file readers to combinesortOrder
- sort order new header should havemergeDictionaries
- If true, merge sequence dictionaries in new header. If false, require that all input sequence dictionaries be identical.
-
SamFileHeaderMerger
public SamFileHeaderMerger(SAMFileHeader.SortOrder sortOrder, Collection<SAMFileHeader> headers, boolean mergeDictionaries) Create SAMFileHeader with additional information.. This is the preferred constructor.- Parameters:
sortOrder
- sort order new header should haveheaders
- sam file headers to combinemergeDictionaries
- If true, merge sequence dictionaries in new header. If false, require that all input sequence dictionaries be identical.
-
-
Method Details
-
positiveFourDigitBase36Str
Convert an integer to base36, protected solely for testing- Parameters:
leftOver
- Both the initial value and the running quotient- Returns:
- A four digit string composed of base 36 symbols
-
getReadGroupId
Deprecated.replaced bygetReadGroupId(SAMFileHeader, String)
Returns the read group id that should be used for the input read and RG id. -
getReadGroupId
Returns the read group id that should be used for the input read and RG id. -
getProgramGroupId
Deprecated.replaced bygetProgramGroupId(SAMFileHeader, String)
- Parameters:
reader
- one of the input filesoriginalProgramGroupId
- a program group ID from the above input file- Returns:
- new ID from the merged list of program groups in the output file
-
getProgramGroupId
- Parameters:
header
- one of the input headersoriginalProgramGroupId
- a program group ID from the above input file- Returns:
- new ID from the merged list of program groups in the output file
-
hasReadGroupCollisions
public boolean hasReadGroupCollisions()Returns true if there are read group duplicates within the merged headers. -
hasProgramGroupCollisions
public boolean hasProgramGroupCollisions()Returns true if there are program group duplicates within the merged headers. -
hasMergedSequenceDictionary
public boolean hasMergedSequenceDictionary()- Returns:
- if we've merged the sequence dictionaries, return true
-
getMergedHeader
Returns the merged header that should be written to any output merged file. -
getReaders
Deprecated.replaced bygetHeaders()
Returns the collection of readers that this header merger is working with. May return null. -
getHeaders
Returns the collection of readers that this header merger is working with. -
getMergedSequenceIndex
@Deprecated public Integer getMergedSequenceIndex(SamReader reader, Integer oldReferenceSequenceIndex) Deprecated.replaced bygetMergedSequenceIndex(SAMFileHeader, Integer)
returns the new mapping for a specified reader, given it's old sequence index- Parameters:
reader
- the readeroldReferenceSequenceIndex
- the old sequence (also called reference) index- Returns:
- the new index value
-
getMergedSequenceIndex
Another mechanism for getting the new sequence index, for situations in which the reader is not available. Note that if the SAMRecord has already had its header replaced with the merged header, this won't work.- Parameters:
header
- The original header for the input record in question.oldReferenceSequenceIndex
- The original sequence index.- Returns:
- the new index value that is compatible with the merged sequence index.
-
SamFileHeaderMerger(SAMFileHeader.SortOrder, Collection, boolean)