Skip to content

Commit

Permalink
Remove unused "arc paired view" option
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Aug 15, 2016
1 parent 0da0fb7 commit 07c09ee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 126 deletions.
2 changes: 1 addition & 1 deletion src/org/broad/igv/sam/AlignmentPacker.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private void pack(List<Alignment> alList, AlignmentTrack.RenderOptions renderOpt

Map<String, PairedAlignment> pairs = null;

boolean isPairedAlignments = renderOptions.isViewPairs() || renderOptions.isPairedArcView();
boolean isPairedAlignments = renderOptions.isViewPairs();
String colorByTag = renderOptions.getColorByTag();
String linkByTag = renderOptions.getLinkByTag();
boolean isLinkedReads = renderOptions.isLinkedReads() && linkByTag != null;
Expand Down
59 changes: 5 additions & 54 deletions src/org/broad/igv/sam/AlignmentRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -490,22 +490,11 @@ private void drawPairedAlignment(
Font font,
AlignmentCounts alignmentCounts) {

//Only plot outliers
if (renderOptions.isPairedArcView() && getOutlierStatus(pair, renderOptions) == 0) {
return;
}

double locScale = context.getScale();

Color alignmentColor1;
Color alignmentColor1 = getAlignmentColor(pair.firstAlignment, renderOptions);
Color alignmentColor2 = null;
if (renderOptions.isPairedArcView()) {
renderOptions.setColorOption(ColorOption.INSERT_SIZE);
alignmentColor1 = getAlignmentColor(pair, renderOptions);
alignmentColor2 = alignmentColor1;
} else {
alignmentColor1 = getAlignmentColor(pair.firstAlignment, renderOptions);
}


Graphics2D g = context.getGraphic2DForColor(alignmentColor1);
g.setFont(font);
Expand Down Expand Up @@ -539,34 +528,10 @@ private void drawPairedAlignment(
int h = (int) Math.max(1, rowRect.getHeight() - (leaveMargin ? 2 : 0));
int y = (int) (rowRect.getY());

startX = Math.max(rowRect.x, startX);
endX = Math.min(rowRect.x + rowRect.width, endX);
gLine.drawLine(startX, y + h / 2, endX, y + h / 2);

if (renderOptions.isPairedArcView()) {
int relation = compareToBounds(pair, renderOptions);
if (relation <= -1 || relation >= +1) {
return;
}
GeneralPath path = new GeneralPath(GeneralPath.WIND_NON_ZERO, 4);
int curveHeight = (int) Math.log(endX - startX) * h;

double botY = y + h / 2;
double topY = y + h / 2 - curveHeight;
double midX = (endX + startX) / 2;

path.moveTo(startX, botY);
path.quadTo(midX, topY, endX, botY);
path.quadTo(midX, topY - 2, startX, botY);
path.closePath();
arcsByStart.add(path);
arcsByEnd.add(path);
curveMap.put(path, pair);
gLine.setColor(alignmentColor2);

gLine.draw(path);
} else {
startX = Math.max(rowRect.x, startX);
endX = Math.min(rowRect.x + rowRect.width, endX);
gLine.drawLine(startX, y + h / 2, endX, y + h / 2);
}

}

Expand Down Expand Up @@ -811,20 +776,6 @@ private void drawAlignment(
}
}
}

//Draw straight line up for viewing arc pairs, if mate on a different chromosome
if (renderOptions.isPairedArcView()) {
try {
Graphics2D gLine = context.getGraphic2DForColor(alignmentColor);
if (!alignment.getChr().equalsIgnoreCase(alignment.getMate().getChr())) {
gLine.drawLine(lastBlockPxEnd, y + h / 2, lastBlockPxEnd, (int) trackRect.getMinY());
}

} catch (NullPointerException e) {
//Don't have the info, don't plot anything
}
}

}

/**
Expand Down
75 changes: 5 additions & 70 deletions src/org/broad/igv/sam/AlignmentTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,8 @@ private void renderAlignments(RenderContext context, Rectangle inputRect) {
Rectangle visibleRect = context.getVisibleRect();
final boolean leaveMargin = getDisplayMode() == DisplayMode.EXPANDED;

if (renderOptions.isPairedArcView()) {
maximumHeight = (int) inputRect.getHeight();
AlignmentRenderer.getInstance().clearCurveMaps();
} else {

maximumHeight = Integer.MAX_VALUE;
}

// Divide rectangle into equal height levels
double y = inputRect.getY();
Expand Down Expand Up @@ -445,10 +441,7 @@ private void renderAlignments(RenderContext context, Rectangle inputRect) {
if ((visibleRect != null && y > visibleRect.getMaxY())) {
return;
}
if (renderOptions.isPairedArcView()) {
y = Math.min(getY() + getHeight(), visibleRect.getMaxY());
y -= h;
}


if (y + h > visibleRect.getY()) {
Rectangle rowRectangle = new Rectangle(inputRect.x, (int) y, inputRect.width, (int) h);
Expand Down Expand Up @@ -800,20 +793,6 @@ public String getValueStringAt(String chr, double position, int y, ReferenceFram
}
return null;
}
} else if (renderOptions.isPairedArcView()) {
Alignment feature = null;
//All alignments stacked at the bottom
double xloc = (position - frame.getOrigin()) / frame.getScale();
SortedSet<Shape> arcs = AlignmentRenderer.getInstance().curveOverlap(xloc);
int halfLength = 2;
int sideLength = 2 * halfLength;
for (Shape curve : arcs) {
if (curve.intersects(xloc - halfLength, y - halfLength, sideLength, sideLength)) {
feature = AlignmentRenderer.getInstance().getAlignmentForCurve(curve);
break;
}
}
return feature == null ? null : feature.getValueString(position, getWindowFunction());
} else {
Alignment feature = getAlignmentAt(position, y, frame);
return feature == null ? null : feature.getValueString(position, getWindowFunction());
Expand Down Expand Up @@ -1043,25 +1022,6 @@ void restore(RenderOptions renderOptions) {
}
}

public boolean isPairedArcView() {
return this.renderOptions.isPairedArcView();
}

public void setPairedArcView(boolean option) {
if (option == this.isPairedArcView()) {
return;
}

//TODO This is dumb and bad UI design
//Should use a combo box or something
if (option) {
setViewAsPairs(false);
}

renderOptions.setPairedArcView(option);
dataManager.packAlignments(renderOptions);
refresh();
}

public boolean isRemoved() {
return removed;
Expand Down Expand Up @@ -1103,8 +1063,8 @@ public static class RenderOptions implements Cloneable {
private ColorOption colorOption;
@XmlAttribute
GroupOption groupByOption = null;
BisulfiteContext bisulfiteContext;
//ContinuousColorScale insertSizeColorScale;
@XmlAttribute
private boolean viewPairs = false;
private boolean pairedArcView = false;
public boolean flagZeroQualityAlignments = true;
Expand All @@ -1123,6 +1083,8 @@ public static class RenderOptions implements Cloneable {
private boolean flagLargeIndels;
private int largeInsertionsThreshold;

BisulfiteContext bisulfiteContext;

private Range groupByBaseAtPos = null;

RenderOptions() {
Expand Down Expand Up @@ -1189,14 +1151,6 @@ public void setShowMismatches(boolean showMismatches) {
if (showMismatches) this.showAllBases = false;
}

public boolean isPairedArcView() {
return pairedArcView;
}

public void setPairedArcView(boolean pairedArcView) {
this.pairedArcView = pairedArcView;
}

public int getMinInsertSize() {
return minInsertSize;
}
Expand Down Expand Up @@ -1364,11 +1318,6 @@ class PopupMenu extends IGVPopupMenu {
addSeparator();
addViewAsPairsMenuItem();

boolean viewPairArcsPresent = Boolean.parseBoolean(System.getProperty("pairedArcViewPresent", "false"));
if (viewPairArcsPresent) {
addViewPairedArcsMenuItem();
}

addGoToMate(e);
showMateRegion(e);
addInsertSizeMenuItem();
Expand Down Expand Up @@ -1817,20 +1766,6 @@ public void actionPerformed(ActionEvent aEvt) {
add(item);
}

public void addViewPairedArcsMenuItem() {
final JMenuItem item = new JCheckBoxMenuItem("View paired arcs");
item.setSelected(isPairedArcView());
item.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent aEvt) {
boolean isPairedArcView = item.isSelected();
setPairedArcView(isPairedArcView);
}
});
item.setEnabled(dataManager.isPairedEnd());
add(item);
}

public void addViewAsPairsMenuItem() {
final JMenuItem item = new JCheckBoxMenuItem("View as pairs");
item.setSelected(renderOptions.isViewPairs());
Expand Down
2 changes: 1 addition & 1 deletion src/org/broad/igv/sam/SAMAlignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@ private String getValueStringImpl(double position, boolean truncate) {
}
}
buf.append("<br>");
buf.append("----------------------<br>");

// First check insertions. Position is zero based, block coords 1 based
if (this.insertions != null) {
Expand Down Expand Up @@ -666,6 +665,7 @@ private String getValueStringImpl(double position, boolean truncate) {

Object suppAlignment = this.getAttribute("SA");
if (suppAlignment != null) {
buf.append("----------------------<br>");
buf.append(getSupplAlignmentString(suppAlignment.toString()));
buf.append("<br>");
}
Expand Down

0 comments on commit 07c09ee

Please sign in to comment.