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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description VariantContextComparator(SAMSequenceDictionary dictionary)
VariantContextComparator(Collection<VCFContigHeaderLine> headerLines)
Creates a VariantContextComparator from the given VCF contig header lines.VariantContextComparator(List<String> contigs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(VariantContext firstVariantContext, VariantContext secondVariantContext)
static List<String>
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 Detail
-
VariantContextComparator
public VariantContextComparator(Collection<VCFContigHeaderLine> headerLines)
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
public VariantContextComparator(SAMSequenceDictionary dictionary)
-
-
Method Detail
-
getSequenceNameList
public static List<String> getSequenceNameList(SAMSequenceDictionary dictionary)
-
compare
public int compare(VariantContext firstVariantContext, VariantContext secondVariantContext)
- Specified by:
compare
in interfaceComparator<VariantContext>
-
isCompatible
public boolean isCompatible(Collection<VCFContigHeaderLine> headerLines)
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.
-
-