@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof GATKSAMRecordHashWrapper)) { return false; } GATKSAMRecord other = ((GATKSAMRecordHashWrapper) o).samRec; return samRec.getReadName().equals(other.getReadName()) && samRec.getFlags() == other.getFlags(); }
public int hashCode() { // Use a murmur hash of the flags to distribute the values more uniformly over the full range of int return samRec.getReadName().hashCode() + (31 * murmurHasher.hashLong(samRec.getFlags()).asInt()); } }
/** * Creates a hard-clipped view on a existing read record. * @param read the underlying unclipped read. * @param start inclusive first position in {@code read} included in the clipped view. * @param end inclusive last position in {@code read} included in the clipped view. */ public ClippedGATKSAMRecord(final GATKSAMRecord read, int start, int end) { super(read.getHeader()); this.setReferenceIndex(read.getReferenceIndex()); this.setAlignmentStart(read.getAlignmentStart() + start); this.setMappingQuality(100); // setting read indexing bin below this.setFlags(read.getFlags()); this.setMateReferenceIndex(read.getMateReferenceIndex()); this.setMateAlignmentStart(read.getMateAlignmentStart()); this.setInferredInsertSize(read.getInferredInsertSize()); this.setReadBases(Arrays.copyOfRange(read.getReadBases(), start, end)); this.setBaseQualities(Arrays.copyOfRange(read.getBaseQualities(),start,end)); this.setReadName(read.getReadName()); insertionQuals = Arrays.copyOfRange(read.getBaseInsertionQualities(),start,end); deletionQuals = Arrays.copyOfRange(read.getBaseDeletionQualities(),start,end); // Set these to null in order to mark them as being candidates for lazy initialization. // If this is not done, they will have non-null defaults. super.setReadName(null); super.setCigarString(null); super.setReadBases(null); super.setBaseQualities(null); // Do this after the above because setCigarString will clear it. GATKBin.setReadIndexingBin(this, -1); }
emptyRead.setMappingQuality(0); emptyRead.setFlags(read.getFlags()); emptyRead.setMateReferenceIndex(read.getMateReferenceIndex()); emptyRead.setMateAlignmentStart(read.getMateAlignmentStart());