// Track coordinates
double trackRectangleX = trackRectangle.getX();
double trackRectangleMaxX = trackRectangle.getMaxX();
SpliceJunctionFeature selectedFeature =
(SpliceJunctionFeature) ((FeatureTrack) track).getSelectedFeature();
// Start of Roche-Tessella modification
if (track.getAutoScale()) {
Frequency f = new Frequency();
List<Integer> scores = new ArrayList<Integer>();
for (IGVFeature feature : featureList) {
SpliceJunctionFeature junctionFeature = (SpliceJunctionFeature) feature;
f.addValue(junctionFeature.getScore());
scores.add((int) junctionFeature.getScore());
}
Collections.sort(scores);
Collections.reverse(scores);
for (int s: scores) {
if (f.getCumPct(s) < 0.99) {
maxDepth = s;
break;
}
}
}
// End of Roche-Tessella modification
for (IGVFeature feature : featureList) {
SpliceJunctionFeature junctionFeature = (SpliceJunctionFeature) feature;
//if same junction as selected feature, highlight
boolean shouldHighlight = false;
if (selectedFeature != null && selectedFeature.isSameJunction(junctionFeature)) {
setHighlightFeature(junctionFeature);
shouldHighlight = true;
}
// Get the pStart and pEnd of the entire feature. at extreme zoom levels the
// virtual pixel value can be too large for an int, so the computation is
// done in double precision and cast to an int only when its confirmed its
// within the field of view.
int flankingStart = junctionFeature.getStart();
int flankingEnd = junctionFeature.getEnd();
int junctionStart = junctionFeature.getJunctionStart();
int junctionEnd = junctionFeature.getJunctionEnd();
double virtualPixelStart = Math.round((flankingStart - origin) / locScale);
double virtualPixelEnd = Math.round((flankingEnd - origin) / locScale);
double virtualPixelJunctionStart = Math.round((junctionStart - origin) / locScale);
double virtualPixelJunctionEnd = Math.round((junctionEnd - origin) / locScale);
// If the any part of the feature fits in the
// Track rectangle draw it
if ((virtualPixelEnd >= trackRectangleX) && (virtualPixelStart <= trackRectangleMaxX)) {
//
int displayPixelEnd = (int) Math.min(trackRectangleMaxX, virtualPixelEnd);
int displayPixelStart = (int) Math.max(trackRectangleX, virtualPixelStart);
float depth = junctionFeature.getJunctionDepth();
Color color = feature.getColor();
drawFeature((int) virtualPixelStart, (int) virtualPixelEnd,
(int) virtualPixelJunctionStart, (int) virtualPixelJunctionEnd, depth,
trackRectangle, context, feature.getStrand(), junctionFeature, shouldHighlight, color,