public class ReadPileup extends java.lang.Object implements java.lang.Iterable<PileupElement>
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<PileupElement> |
baseQualTieBreaker |
static java.util.Comparator<PileupElement> |
mapQualTieBreaker |
static double |
SAMTOOLS_OVERLAP_LOW_CONFIDENCE
Constant used by samtools to downgrade a quality for overlapping reads that disagrees in their base.
|
Constructor and Description |
---|
ReadPileup(htsjdk.samtools.util.Locatable loc)
Create a new pileup without any aligned reads
|
ReadPileup(htsjdk.samtools.util.Locatable loc,
java.util.List<GATKRead> reads,
int offset)
Create a new pileup with the given reads.
|
ReadPileup(htsjdk.samtools.util.Locatable loc,
java.util.List<GATKRead> reads,
java.util.List<java.lang.Integer> offsets)
Create a new pileup with the given reads.
|
ReadPileup(htsjdk.samtools.util.Locatable loc,
java.util.List<PileupElement> pileup)
Create a new pileup at loc, using the reads and their corresponding
offsets.
|
ReadPileup(htsjdk.samtools.util.Locatable loc,
java.util.Map<java.lang.String,ReadPileup> stratifiedPileup)
Create a new pileup at loc, using an stratified pileup
Note: the current implementation of ReadPileup does not efficiently retrieve the stratified pileup
|
Modifier and Type | Method and Description |
---|---|
void |
fixOverlaps()
Fixes the quality of all the elements that come from an overlapping pair in the same way as
samtools does
function in
samtools . |
int[] |
getBaseCounts()
Get counts of A, C, G, T in order, which returns a int[4] vector with counts according
to BaseUtils.simpleBaseToBaseIndex for each base.
|
byte[] |
getBaseQuals()
Returns an array of the quals in this pileup.
|
byte[] |
getBases()
Returns an array of the bases in this pileup.
|
htsjdk.samtools.util.Locatable |
getLocation() |
int[] |
getMappingQuals()
Get an array of the mapping qualities.
|
int |
getNumberOfElements(java.util.function.Predicate<PileupElement> peFilter)
Returns the number of elements that satisfy the predicate.
|
java.util.List<java.lang.Integer> |
getOffsets()
Returns a list of the offsets in this pileup.
|
ReadPileup |
getOverlappingFragmentFilteredPileup(boolean discardDiscordant,
java.util.Comparator<PileupElement> tieBreaker,
htsjdk.samtools.SAMFileHeader header)
Returns a new ReadPileup where only one read from an overlapping read
pair is retained.
|
ReadPileup |
getOverlappingFragmentFilteredPileup(htsjdk.samtools.SAMFileHeader header)
Returns a new ReadPileup where only one read from an overlapping read
pair is retained.
|
ReadPileup |
getPileupForLane(java.lang.String laneID)
Make a new pileup from elements whose reads have read groups that agree with the given lane ID.
|
ReadPileup |
getPileupForSample(java.lang.String sample,
htsjdk.samtools.SAMFileHeader header)
Make a new pileup from elements whose reads belong to the given sample.
|
java.lang.String |
getPileupString(char ref)
Format, assuming a single-sample, in a samtools-like string.
|
java.util.Set<java.lang.String> |
getReadGroupIDs()
Gets a set of the read groups represented in this pileup.
|
java.util.List<GATKRead> |
getReads()
Returns a list of the reads in this pileup.
|
java.util.Set<java.lang.String> |
getSamples(htsjdk.samtools.SAMFileHeader header)
Gets a set of the samples represented in this pileup.
|
boolean |
isEmpty() |
java.util.Iterator<PileupElement> |
iterator()
The best way to access PileupElements where you only care about the bases and quals in the pileup.
|
static java.util.List<PileupElement> |
locToReadsPileup(java.util.List<GATKRead> reads,
htsjdk.samtools.util.Locatable loc)
Helper routine for converting reads and a single offset to a PileupElement list.
|
ReadPileup |
makeFilteredPileup(java.util.function.Predicate<PileupElement> filter)
Make a new pileup consisting of elements of this pileup that satisfy the predicate.
|
int |
size()
The number of elements in this pileup.
|
java.util.Iterator<PileupElement> |
sortedIterator()
Iterator over sorted by read start PileupElements.
|
java.util.Map<java.lang.String,ReadPileup> |
splitBySample(htsjdk.samtools.SAMFileHeader header,
java.lang.String unknownSampleName)
Splits the ReadPileup by sample
|
java.lang.String |
toString() |
public static final double SAMTOOLS_OVERLAP_LOW_CONFIDENCE
public static final java.util.Comparator<PileupElement> baseQualTieBreaker
public static final java.util.Comparator<PileupElement> mapQualTieBreaker
public ReadPileup(htsjdk.samtools.util.Locatable loc, java.util.List<PileupElement> pileup)
public ReadPileup(htsjdk.samtools.util.Locatable loc, java.util.Map<java.lang.String,ReadPileup> stratifiedPileup)
public ReadPileup(htsjdk.samtools.util.Locatable loc)
public ReadPileup(htsjdk.samtools.util.Locatable loc, java.util.List<GATKRead> reads, int offset)
public ReadPileup(htsjdk.samtools.util.Locatable loc, java.util.List<GATKRead> reads, java.util.List<java.lang.Integer> offsets)
public static java.util.List<PileupElement> locToReadsPileup(java.util.List<GATKRead> reads, htsjdk.samtools.util.Locatable loc)
public ReadPileup makeFilteredPileup(java.util.function.Predicate<PileupElement> filter)
public ReadPileup getPileupForLane(java.lang.String laneID)
null
, the read will be included.
Returns empty pileup if no suitable elements are found.
NOTE: the new pileup will not be independent of the old one (no deep copy of the underlying data is performed).public ReadPileup getPileupForSample(java.lang.String sample, htsjdk.samtools.SAMFileHeader header)
null
NOTE: the new pileup will not be independent of the old one (no deep copy of the underlying data is performed).public java.util.Set<java.lang.String> getReadGroupIDs()
public java.util.Set<java.lang.String> getSamples(htsjdk.samtools.SAMFileHeader header)
public java.util.Map<java.lang.String,ReadPileup> splitBySample(htsjdk.samtools.SAMFileHeader header, java.lang.String unknownSampleName)
header
- the header to retrieve the samples fromunknownSampleName
- the sample name if there is no read group/sample name; null
if lack of RG is not expectedUserException.ReadMissingReadGroup
- if unknownSampleName is null
and there are reads without RG/sample namepublic java.util.Iterator<PileupElement> iterator()
for (PileupElement p : this) { doSomething(p); }
Provides efficient iteration of the data.
iterator
in interface java.lang.Iterable<PileupElement>
public java.util.Iterator<PileupElement> sortedIterator()
public int size()
public boolean isEmpty()
public htsjdk.samtools.util.Locatable getLocation()
public int[] getBaseCounts()
public void fixOverlaps()
function in
samtools
.
Setting the quality of one of the bases to 0 effectively removes the redundant base for calling. In addition, if the bases overlap we have increased confidence if they agree (or reduced if they don't). Thus, the algorithm proceeds as following:
1. If the bases are the same, the quality of the first element is the sum of both qualities and the quality of the second is reduced to 0. 2. If the bases are different, the base with the highest quality is reduced with a factor of 0.8, and the quality of the lowest is reduced to 0.
Note: Resulting qualities higher than QualityUtils.MAX_SAM_QUAL_SCORE
are capped.
public ReadPileup getOverlappingFragmentFilteredPileup(htsjdk.samtools.SAMFileHeader header)
public ReadPileup getOverlappingFragmentFilteredPileup(boolean discardDiscordant, java.util.Comparator<PileupElement> tieBreaker, htsjdk.samtools.SAMFileHeader header)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getPileupString(char ref)
ref
- the reference basepublic java.util.List<GATKRead> getReads()
public int getNumberOfElements(java.util.function.Predicate<PileupElement> peFilter)
public java.util.List<java.lang.Integer> getOffsets()
public byte[] getBases()
public byte[] getBaseQuals()
public int[] getMappingQuals()