Class EventMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.TreeMap<Integer,htsjdk.variant.variantcontext.VariantContext>
org.broadinstitute.hellbender.utils.haplotype.EventMap
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<Integer,
,htsjdk.variant.variantcontext.VariantContext> NavigableMap<Integer,
,htsjdk.variant.variantcontext.VariantContext> SortedMap<Integer,
htsjdk.variant.variantcontext.VariantContext>
Extract simple VariantContext events from a single haplotype
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
static final htsjdk.variant.variantcontext.Allele
-
Constructor Summary
ConstructorDescriptionEventMap
(Collection<htsjdk.variant.variantcontext.VariantContext> stateForTesting) For testing.EventMap
(Haplotype haplotype, byte[] ref, htsjdk.samtools.util.Locatable refLoc, String sourceNameToAdd, int maxMnpDistance) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addVC
(htsjdk.variant.variantcontext.VariantContext vc) Add VariantContext vc to this map, merging events with the same start sites if necessaryvoid
addVC
(htsjdk.variant.variantcontext.VariantContext vc, boolean merge) Add VariantContext vc to this mapbuildEventMapsForHaplotypes
(List<Haplotype> haplotypes, byte[] ref, htsjdk.samtools.util.Locatable refLoc, boolean debug, int maxMnpDistance) Build event maps for each haplotype, returning the sorted set of all of the starting positions of all events across all haplotypesint
How many events do we have?List<htsjdk.variant.variantcontext.VariantContext>
getOverlappingEvents
(int loc) Returns any events in the map that overlap loc, including spanning deletions and events that start at loc.Get the starting positions of events in this event mapCollection<htsjdk.variant.variantcontext.VariantContext>
Get the variant contexts in order of start position in this event mapprotected htsjdk.variant.variantcontext.VariantContext
makeBlock
(htsjdk.variant.variantcontext.VariantContext vc1, htsjdk.variant.variantcontext.VariantContext vc2) Create a block substitution out of two variant contexts that start at the same position vc1 can be SNP, and vc2 can then be either a insertion or deletion.protected void
processCigarForInitialEvents
(int maxMnpDistance) toString()
Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, merge, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty
-
Field Details
-
MIN_NUMBER_OF_EVENTS_TO_COMBINE_INTO_BLOCK_SUBSTITUTION
protected static final int MIN_NUMBER_OF_EVENTS_TO_COMBINE_INTO_BLOCK_SUBSTITUTION- See Also:
-
SYMBOLIC_UNASSEMBLED_EVENT_ALLELE
public static final htsjdk.variant.variantcontext.Allele SYMBOLIC_UNASSEMBLED_EVENT_ALLELE
-
-
Constructor Details
-
EventMap
-
EventMap
For testing. Let's you set up a explicit configuration without having to process a haplotype and reference- Parameters:
stateForTesting
-
-
-
Method Details
-
processCigarForInitialEvents
protected void processCigarForInitialEvents(int maxMnpDistance) - Parameters:
maxMnpDistance
- Phased substitutions separated by this distance or less are merged into MNPs. More than two substitutions occurring in the same alignment block (ie the same M/X/EQ CIGAR element) are merged until a substitution is separated from the previous one by a greater distance. That is, if maxMnpDistance = 1, substitutions at 10,11,12,14,15,17 are partitioned into a MNP at 10-12, a MNP at 14-15, and a SNP at 17. May not be negative.
-
addVC
public void addVC(htsjdk.variant.variantcontext.VariantContext vc) Add VariantContext vc to this map, merging events with the same start sites if necessary- Parameters:
vc
- the variant context to add
-
addVC
public void addVC(htsjdk.variant.variantcontext.VariantContext vc, boolean merge) Add VariantContext vc to this map- Parameters:
vc
- the variant context to addmerge
- should we attempt to merge it with an already existing element, or should we throw an error in that case?
-
makeBlock
protected htsjdk.variant.variantcontext.VariantContext makeBlock(htsjdk.variant.variantcontext.VariantContext vc1, htsjdk.variant.variantcontext.VariantContext vc2) Create a block substitution out of two variant contexts that start at the same position vc1 can be SNP, and vc2 can then be either a insertion or deletion. If vc1 is an indel, then vc2 must be the opposite type (vc1 deletion => vc2 must be an insertion)- Parameters:
vc1
- the first variant context we want to mergevc2
- the second- Returns:
- a block substitution that represents the composite substitution implied by vc1 and vc2
-
getStartPositions
Get the starting positions of events in this event map- Returns:
-
getVariantContexts
Get the variant contexts in order of start position in this event map- Returns:
-
getNumberOfEvents
public int getNumberOfEvents()How many events do we have?- Returns:
-
toString
- Overrides:
toString
in classAbstractMap<Integer,
htsjdk.variant.variantcontext.VariantContext>
-
buildEventMapsForHaplotypes
public static TreeSet<Integer> buildEventMapsForHaplotypes(List<Haplotype> haplotypes, byte[] ref, htsjdk.samtools.util.Locatable refLoc, boolean debug, int maxMnpDistance) Build event maps for each haplotype, returning the sorted set of all of the starting positions of all events across all haplotypes- Parameters:
haplotypes
- a list of haplotypesref
- the reference basesrefLoc
- the span of the reference basesdebug
- if true, we'll emit debugging information during this operationmaxMnpDistance
- Phased substitutions separated by this distance or less are merged into MNPs. More than two substitutions occuring in the same alignment block (ie the same M/X/EQ CIGAR element) are merged until a substitution is separated from the previous one by a greater distance. That is, if maxMnpDistance = 1, substitutions at 10,11,12,14,15,17 are partitioned into a MNP at 10-12, a MNP at 14-15, and a SNP at 17. May not be negative.- Returns:
- a sorted set of start positions of all events among all haplotypes
-
getOverlappingEvents
Returns any events in the map that overlap loc, including spanning deletions and events that start at loc.
-