public static ReadDirection of(final SAMRecord sam) { return sam.getReadNegativeStrandFlag() ? ReadDirection.NEGATIVE : ReadDirection.POSITIVE; } }
@Override public double getStrandBias() { return local.getReadNegativeStrandFlag() ? 1 : 0; } @Override
public boolean filterOut(SAMRecord read) { // check the length return read.getReadNegativeStrandFlag() != filterForward; }
@Override public boolean getReadNegativeStrandFlag() { return ! isStrandless() && super.getReadNegativeStrandFlag(); }
@Override public boolean getReadNegativeStrandFlag() { if (!initializedFlags.contains(LazyFlag.READ_NEGATIVE_STRAND)) { setReadNegativeStrandFlag(getReadNegativeStrandFlagImpl()); } return super.getReadNegativeStrandFlag(); }
@Override public boolean getReadNegativeStrandFlag() { if (!initializedFlags.contains(LazyFlag.READ_NEGATIVE_STRAND)) { setReadNegativeStrandFlag(getReadNegativeStrandFlagImpl()); } return super.getReadNegativeStrandFlag(); }
private void countRecord(final SAMRecord rec) { final boolean isNegativeStrand = rec.getReadNegativeStrandFlag(); final boolean isReadTwo = rec.getReadPairedFlag() && rec.getSecondOfPairFlag(); if (isReadTwo) { if (isNegativeStrand) this.R2_NEG++; else this.R2_POS++; } else { if (isNegativeStrand) this.R1_NEG++; else this.R1_POS++; } }
private void countRecord(final SAMRecord rec) { final boolean isNegativeStrand = rec.getReadNegativeStrandFlag(); final boolean isReadTwo = rec.getReadPairedFlag() && rec.getSecondOfPairFlag(); if (isReadTwo) { if (isNegativeStrand) this.R2_NEG++; else this.R2_POS++; } else { if (isNegativeStrand) this.R1_NEG++; else this.R1_POS++; } }
/** * Get the one-based cycle number of the base, taking the direction of the read into account */ private static int stratifyCycle(final RecordAndOffset recordAndOffset) { final SAMRecord rec = recordAndOffset.getRecord(); final int offset = recordAndOffset.getOffset(); // Get either the offset into the array or the distance from the end depending on whether the read is // on the negative strand. int retval = rec.getReadNegativeStrandFlag() ? (rec.getReadLength() - offset - 1) : offset; // add 1 to move to a one-based system retval += 1; return retval; }
/** * Get the one-based cycle number of the base, taking the direction of the read into account */ private static int stratifyCycle(final RecordAndOffset recordAndOffset) { final SAMRecord rec = recordAndOffset.getRecord(); final int offset = recordAndOffset.getOffset(); // Get either the offset into the array or the distance from the end depending on whether the read is // on the negative strand. int retval = rec.getReadNegativeStrandFlag() ? (rec.getReadLength() - offset - 1) : offset; // add 1 to move to a one-based system retval += 1; return retval; }
private static void padCigar(SAMRecord record, int pre, int post) { List<CigarElement> cigar = Lists.newArrayList(record.getCigar().getCigarElements()); if (record.getReadNegativeStrandFlag()) { cigar.add(0, new CigarElement(post, CigarOperator.SOFT_CLIP)); cigar.add(new CigarElement(pre, CigarOperator.SOFT_CLIP)); } else { cigar.add(0, new CigarElement(pre, CigarOperator.SOFT_CLIP)); cigar.add(new CigarElement(post, CigarOperator.SOFT_CLIP)); } cigar = CigarUtil.clean(cigar, false); record.setCigar(new Cigar(cigar)); } private static void convertToSupplementaryAlignmentRecord(SAMRecord primary, SAMRecord supplementary) {
@Override public double getStrandBias() { double bias = 1; if (AssemblyAttributes.isAssembly(getSAMRecord())) { bias = new AssemblyAttributes(record).getStrandBias(); } if (record.getReadNegativeStrandFlag()) { bias = 1 - bias; } return bias; } public int constituentReads() {
public boolean filterOut(SAMRecord read) { return (! read.getReadPairedFlag() ) || read.getMateUnmappedFlag() || read.getDuplicateReadFlag() || read.getReadFailsVendorQualityCheckFlag() || (read.getMateNegativeStrandFlag() == read.getReadNegativeStrandFlag()); } }
private int getPairedOrientation(final SAMRecord record) { if (record.getReadPairedFlag() && !record.getReadUnmappedFlag() && !record.getMateUnmappedFlag()) { return getPairedOrientationByte(record.getReadNegativeStrandFlag(), record.getMateNegativeStrandFlag()); } else { return getFragmentOrientation(record); } }
private int getPairedOrientation(final SAMRecord record) { if (record.getReadPairedFlag() && !record.getReadUnmappedFlag() && !record.getMateUnmappedFlag()) { return getPairedOrientationByte(record.getReadNegativeStrandFlag(), record.getMateNegativeStrandFlag()); } else { return getFragmentOrientation(record); } }
public ChimericAlignment(SAMRecord r) { this.rname = r.getReferenceName(); this.pos = r.getAlignmentStart(); this.isNegativeStrand = r.getReadNegativeStrandFlag(); this.cigar = r.getCigar(); this.mapq = r.getMappingQuality(); this.nm = r.getIntegerAttribute(SAMTag.NM.name()); } public ChimericAlignment(String str) {
/** * Populates the set of transient attributes on SAMRecords if they are not already there. */ private void populateTransientAttributes(final SAMRecord... recs) { for (final SAMRecord rec : recs) { if (rec.getTransientAttribute(Attr.LibraryId) != null) continue; rec.setTransientAttribute(Attr.LibraryId, getLibraryId(rec)); rec.setTransientAttribute(Attr.ReadCoordinate, rec.getReadNegativeStrandFlag() ? rec.getUnclippedEnd() : rec.getUnclippedStart()); rec.setTransientAttribute(Attr.MateCoordinate, getMateCoordinate(rec)); } }
/** * Populates the set of transient attributes on SAMRecords if they are not already there. */ private void populateTransientAttributes(final SAMRecord... recs) { for (final SAMRecord rec : recs) { if (rec.getTransientAttribute(Attr.LibraryId) != null) continue; rec.setTransientAttribute(Attr.LibraryId, getLibraryId(rec)); rec.setTransientAttribute(Attr.ReadCoordinate, rec.getReadNegativeStrandFlag() ? rec.getUnclippedEnd() : rec.getUnclippedStart()); rec.setTransientAttribute(Attr.MateCoordinate, getMateCoordinate(rec)); } }
public MateKey getMateKey(SAMRecord read) { // If mate is mapped, use read flag. // If mate is not mapped, use opposite of this read's RC flag boolean isMateRevOrientation = read.getMateUnmappedFlag() ? !read.getReadNegativeStrandFlag() : read.getMateNegativeStrandFlag(); int matePos = read.getMateUnmappedFlag() ? -1 : read.getMateAlignmentStart(); int mateNum = read.getFirstOfPairFlag() ? 2 : 1; return new MateKey(read.getReadName(), matePos, read.getMateUnmappedFlag(), isMateRevOrientation, mateNum, read.getAlignmentStart()); }
public static boolean isDovetailing(SAMRecord record, PairOrientation expectedOrientation, int margin) { if (record.getReadUnmappedFlag()) return false; if (!record.getReadPairedFlag()) return false; if (record.getMateUnmappedFlag()) return false; Cigar cigar2 = null; String mc = record.getStringAttribute(SAMTag.MC.name()); if (mc != null) { cigar2 = TextCigarCodec.decode(mc); } return isDovetailing(record.getReferenceIndex(), record.getAlignmentStart(), record.getReadNegativeStrandFlag(), record.getCigar(), record.getMateReferenceIndex(), record.getMateAlignmentStart(), record.getMateNegativeStrandFlag(), cigar2, expectedOrientation, margin); }