Package htsjdk.samtools
Class SAMRecordQueryHashComparator
- java.lang.Object
-
- htsjdk.samtools.SAMRecordQueryNameComparator
-
- htsjdk.samtools.SAMRecordQueryHashComparator
-
- All Implemented Interfaces:
SAMRecordComparator
,Serializable
,Comparator<SAMRecord>
public class SAMRecordQueryHashComparator extends SAMRecordQueryNameComparator implements Serializable
SAMRecord comparator that provides an ordering based on a hash of the queryname. Has the useful property that reads with the same name will be grouped together, but that reads appear in an otherwise random order. Useful for when the read names in a BAM are correlated to something else (e.g. position, read group), making a straight queryname sort undesirable.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SAMRecordQueryHashComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(SAMRecord lhs, SAMRecord rhs)
Compares two records based on an integer hash of their read name's.int
fileOrderCompare(SAMRecord lhs, SAMRecord rhs)
Compares two records based on an integer hash of their read names.-
Methods inherited from class htsjdk.samtools.SAMRecordQueryNameComparator
compareReadNames
-
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
-
-
-
-
Method Detail
-
compare
public int compare(SAMRecord lhs, SAMRecord rhs)
Compares two records based on an integer hash of their read name's. If the hash values are equal, falls back to the behaviour of SAMRecordQueryNameComparator to break the tie.- Specified by:
compare
in interfaceComparator<SAMRecord>
- Overrides:
compare
in classSAMRecordQueryNameComparator
-
fileOrderCompare
public int fileOrderCompare(SAMRecord lhs, SAMRecord rhs)
Compares two records based on an integer hash of their read names. If the hash values are equal, falls back to the behaviour of SAMRecordQueryNameComparator to break the tie.- Specified by:
fileOrderCompare
in interfaceSAMRecordComparator
- Overrides:
fileOrderCompare
in classSAMRecordQueryNameComparator
- Returns:
- negative if samRecord1 < samRecord2, 0 if equal, else positive
-
-