Package htsjdk.variant.variantcontext
Class VariantContextComparator
java.lang.Object
htsjdk.variant.variantcontext.VariantContextComparator
- All Implemented Interfaces:
Serializable
,Comparator<VariantContext>
public class VariantContextComparator
extends Object
implements Comparator<VariantContext>, Serializable
A Comparator that orders VariantContexts by the ordering of the contigs/chromosomes in the List
provided at construction time, then by start position with each contig/chromosome.
- See Also:
-
Constructor Summary
ConstructorDescriptionVariantContextComparator
(SAMSequenceDictionary dictionary) VariantContextComparator
(Collection<VCFContigHeaderLine> headerLines) Creates a VariantContextComparator from the given VCF contig header lines.VariantContextComparator
(List<String> contigs) -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(VariantContext firstVariantContext, VariantContext secondVariantContext) getSequenceNameList
(SAMSequenceDictionary dictionary) boolean
isCompatible
(Collection<VCFContigHeaderLine> headerLines) Returns true if the given header lines are from a file sorted according to this VariantContextComparator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
VariantContextComparator
-
VariantContextComparator
Creates a VariantContextComparator from the given VCF contig header lines. The header lines' index values are used to order the contigs. Throws IllegalArgumentException if there are dupe -
VariantContextComparator
-
-
Method Details
-
getSequenceNameList
-
compare
- Specified by:
compare
in interfaceComparator<VariantContext>
-
isCompatible
Returns true if the given header lines are from a file sorted according to this VariantContextComparator. For sorting to work properly, the contig in each header line must have the same index.
-