Skip to content
Snippets Groups Projects
Commit e0e4dd88 authored by tcarver's avatar tcarver
Browse files

speed up

parent a960f1cd
Branches
Tags
No related merge requests found
...@@ -136,6 +136,7 @@ public class VCFview extends JPanel ...@@ -136,6 +136,7 @@ public class VCFview extends JPanel
protected int seqLength; protected int seqLength;
private EntryGroup entryGroup; private EntryGroup entryGroup;
private String chr; private String chr;
private Point lastMousePoint;
private VCFRecord mouseVCF; private VCFRecord mouseVCF;
private int mouseOverIndex = -1; private int mouseOverIndex = -1;
...@@ -698,7 +699,8 @@ public class VCFview extends JPanel ...@@ -698,7 +699,8 @@ public class VCFview extends JPanel
public void mouseMoved(MouseEvent e) public void mouseMoved(MouseEvent e)
{ {
findVariantAtPoint(e.getPoint()); lastMousePoint = e.getPoint();
int thisHgt = HEIGHT; int thisHgt = HEIGHT;
if (thisHgt < 5) if (thisHgt < 5)
thisHgt = 15; thisHgt = 15;
...@@ -924,6 +926,10 @@ public class VCFview extends JPanel ...@@ -924,6 +926,10 @@ public class VCFview extends JPanel
public String getToolTipText() public String getToolTipText()
{ {
if(vcfReaders == null)
return null;
findVariantAtPoint(lastMousePoint);
if(mouseVCF == null) if(mouseVCF == null)
return null; return null;
...@@ -1204,14 +1210,15 @@ public class VCFview extends JPanel ...@@ -1204,14 +1210,15 @@ public class VCFview extends JPanel
protected boolean showVariant(VCFRecord record, FeatureVector features, int basePosition, AbstractVCFReader vcfReader) protected boolean showVariant(VCFRecord record, FeatureVector features, int basePosition, AbstractVCFReader vcfReader)
{ {
boolean vcf_v4 = vcfReader.isVcf_v4(); return VCFFilter.passFilter(record, vcfReader, features, basePosition);
if(!VCFFilter.passFilter(record, vcfReader, features, basePosition)) }
return false;
record.setMarkAsNewStop(false); private void setAsStop(VCFRecord record, FeatureVector features, int basePosition, AbstractVCFReader vcfReader)
if(markNewStops.isSelected() && {
!record.getAlt().isDeletion(vcf_v4) && if(!record.isMarkAsNewStop() &&
!record.getAlt().isInsertion(vcf_v4) && markNewStops.isSelected() &&
!record.getAlt().isDeletion(vcfReader.isVcf_v4()) &&
!record.getAlt().isInsertion(vcfReader.isVcf_v4()) &&
record.getAlt().length() == 1 && record.getAlt().length() == 1 &&
record.getRef().length() == 1) record.getRef().length() == 1)
{ {
...@@ -1219,8 +1226,6 @@ public class VCFview extends JPanel ...@@ -1219,8 +1226,6 @@ public class VCFview extends JPanel
if(isSyn == 2) if(isSyn == 2)
record.setMarkAsNewStop(true); record.setMarkAsNewStop(true);
} }
return true;
} }
protected static boolean isOverlappingFeature(FeatureVector features, int basePosition) protected static boolean isOverlappingFeature(FeatureVector features, int basePosition)
...@@ -1262,23 +1267,25 @@ public class VCFview extends JPanel ...@@ -1262,23 +1267,25 @@ public class VCFview extends JPanel
{ {
int basePosition = record.getPos() + getSequenceOffset(record.getChrom()); int basePosition = record.getPos() + getSequenceOffset(record.getChrom());
boolean show = showVariant(record, features, basePosition, vcfReader); boolean show = showVariant(record, features, basePosition, vcfReader);
// logger4j.info(String.format("%s\t%s", (show) ? "SHOW" : "HIDE", record)); // logger4j.info(String.format("%s\t%s", (show) ? "SHOW" : "HIDE", record));
if( !show ) if( !show )
return; return;
setAsStop(record, features, basePosition, vcfReader);
int pos[] = getScreenPosition(basePosition, pixPerBase, start, index); int pos[] = getScreenPosition(basePosition, pixPerBase, start, index);
if(colourScheme == QUAL_COLOUR_SCHEME) if(colourScheme == QUAL_COLOUR_SCHEME)
g.setColor(getQualityColour(record)); g.setColor(getQualityColour(record));
else if(record.getAlt().isDeletion(vcfReader.isVcf_v4()))
g.setColor(Color.gray);
else if(record.getAlt().isInsertion(vcfReader.isVcf_v4()))
g.setColor(Color.magenta);
else if(record.getAlt().isMultiAllele()) else if(record.getAlt().isMultiAllele())
{ {
g.setColor(Color.orange); g.setColor(Color.orange);
g.fillArc(pos[0]-3, pos[1]-LINE_HEIGHT-3, 6, 6, 0, 360); g.fillArc(pos[0]-3, pos[1]-LINE_HEIGHT-3, 6, 6, 0, 360);
} }
else if(record.getAlt().isDeletion(vcfReader.isVcf_v4()))
g.setColor(Color.gray);
else if(record.getAlt().isInsertion(vcfReader.isVcf_v4()))
g.setColor(Color.magenta);
else if(record.getAlt().length() == 1 && record.getRef().length() == 1) else if(record.getAlt().length() == 1 && record.getRef().length() == 1)
{ {
g.setColor(getColourForSNP(record, features, basePosition)); g.setColor(getColourForSNP(record, features, basePosition));
...@@ -1708,6 +1715,7 @@ public class VCFview extends JPanel ...@@ -1708,6 +1715,7 @@ public class VCFview extends JPanel
if(showDetails != null) if(showDetails != null)
popup.remove(showDetails); popup.remove(showDetails);
findVariantAtPoint(e.getPoint());
if( mouseVCF != null ) if( mouseVCF != null )
{ {
showDetails = new JMenuItem("Show details of : "+ showDetails = new JMenuItem("Show details of : "+
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment