/** Given a coordinate on the genome (same chromosome) give the corresponding coordinate in the transcript. */ public int getTranscriptCoordinate(final int genomeCoordinate) { int exonOffset = 0; for (final Exon e : exons) { if (genomeCoordinate >= e.start && genomeCoordinate <=e.end) { return (genomeCoordinate - e.start + 1) + exonOffset; } else { exonOffset += CoordMath.getLength(e.start, e.end); } } return -1; }
/** Given a coordinate on the genome (same chromosome) give the corresponding coordinate in the transcript. */ public int getTranscriptCoordinate(final int genomeCoordinate) { int exonOffset = 0; for (final Exon e : exons) { if (genomeCoordinate >= e.start && genomeCoordinate <=e.end) { return (genomeCoordinate - e.start + 1) + exonOffset; } else { exonOffset += CoordMath.getLength(e.start, e.end); } } return -1; }
/** * Determines the amount of overlap between two coordinate ranges. Assumes that the two ranges * actually do overlap and therefore may produce strange results when they do not! */ public static int getOverlap(final int start, final int end, final int start2, final int end2) { return getLength(Math.max(start, start2), Math.min(end, end2)); }
/** * Determines the amount of overlap between two coordinate ranges. Assumes that the two ranges * actually do overlap and therefore may produce strange results when they do not! */ public static int getOverlap(final int start, final int end, final int start2, final int end2) { return getLength(Math.max(start, start2), Math.min(end, end2)); }
/** * Determines the amount of overlap between two coordinate ranges. Assumes that the two ranges * actually do overlap and therefore may produce strange results when they do not! */ public static int getOverlap(final int start, final int end, final int start2, final int end2) { return getLength(Math.max(start, start2), Math.min(end, end2)); }
public Exon addExon(final int start, final int end) { for (int i=0; i<this.exons.length; ++i) { if (exons[i] == null) { exons[i] = new Exon(start, end); this.length += CoordMath.getLength(start, end); return exons[i]; } } throw new IllegalStateException("Attempting to add more exons that exist for transcript."); }
public Exon addExon(final int start, final int end) { for (int i=0; i<this.exons.length; ++i) { if (exons[i] == null) { exons[i] = new Exon(start, end); this.length += CoordMath.getLength(start, end); return exons[i]; } } throw new IllegalStateException("Attempting to add more exons that exist for transcript."); }
/** * @return number of bases of reference covered by this interval */ default int getLengthOnReference() { return CoordMath.getLength(getStart(), getEnd()); }
/** * @return number of bases of reference covered by this interval */ default int getLengthOnReference() { return CoordMath.getLength(getStart(), getEnd()); }
public void considerBest(final SAMRecord firstEnd, final SAMRecord secondEnd) { final int thisPairMapq = SAMUtils.combineMapqs(firstEnd.getMappingQuality(), secondEnd.getMappingQuality()); final int thisDistance = CoordMath.getLength(Math.min(firstEnd.getAlignmentStart(), secondEnd.getAlignmentStart()), Math.max(firstEnd.getAlignmentEnd(), secondEnd.getAlignmentEnd())); if (thisDistance > bestDistance || (thisDistance == bestDistance && thisPairMapq > bestPairMapq)) { bestDistance = thisDistance; bestPairMapq = thisPairMapq; bestAlignmentPairs.clear(); bestAlignmentPairs.add(new AbstractMap.SimpleEntry<SAMRecord, SAMRecord>(firstEnd, secondEnd)); } else if (thisDistance == bestDistance && thisPairMapq == bestPairMapq) { bestAlignmentPairs.add(new AbstractMap.SimpleEntry<SAMRecord, SAMRecord>(firstEnd, secondEnd)); } }
public void considerBest(final SAMRecord firstEnd, final SAMRecord secondEnd) { final int thisPairMapq = SAMUtils.combineMapqs(firstEnd.getMappingQuality(), secondEnd.getMappingQuality()); final int thisDistance = CoordMath.getLength(Math.min(firstEnd.getAlignmentStart(), secondEnd.getAlignmentStart()), Math.max(firstEnd.getAlignmentEnd(), secondEnd.getAlignmentEnd())); if (thisDistance > bestDistance || (thisDistance == bestDistance && thisPairMapq > bestPairMapq)) { bestDistance = thisDistance; bestPairMapq = thisPairMapq; bestAlignmentPairs.clear(); bestAlignmentPairs.add(new AbstractMap.SimpleEntry<SAMRecord, SAMRecord>(firstEnd, secondEnd)); } else if (thisDistance == bestDistance && thisPairMapq == bestPairMapq) { bestAlignmentPairs.add(new AbstractMap.SimpleEntry<SAMRecord, SAMRecord>(firstEnd, secondEnd)); } }
final int clippedBases = (int)CoordMath.getLength(clipFrom, Cigar.getReadLength(oldCigar)); List<CigarElement> newCigar = new LinkedList<CigarElement>(); int pos = 1;
final int clippedBases = (int)CoordMath.getLength(clipFrom, Cigar.getReadLength(oldCigar)); List<CigarElement> newCigar = new LinkedList<CigarElement>(); int pos = 1;
final int clippedBases = (int)CoordMath.getLength(clipFrom, Cigar.getReadLength(oldCigar)); List<CigarElement> newCigar = new LinkedList<CigarElement>(); int pos = 1;
end1.setFirstOfPairFlag(end1IsFirstOfPair); end1.setSecondOfPairFlag(!end1IsFirstOfPair); end1.setInferredInsertSize((int) CoordMath.getLength(start1, CoordMath.getEnd(start2, this.readLength))); end1.setAttribute(SAMTag.RG.name(), READ_GROUP_ID); if (programRecord != null) {