From c205c08f9a18d6354d6ec967c287949f182a4288 Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Thu, 9 Dec 2010 11:08:38 +0000
Subject: [PATCH] move all filters to VCFFilter class
git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@15214 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
.../artemis/components/variant/VCFFilter.java | 98 ++++++++++++++++++-
.../artemis/components/variant/VCFview.java | 88 +++--------------
2 files changed, 107 insertions(+), 79 deletions(-)
diff --git a/uk/ac/sanger/artemis/components/variant/VCFFilter.java b/uk/ac/sanger/artemis/components/variant/VCFFilter.java
index d5d7f6ad5..72e425edd 100644
--- a/uk/ac/sanger/artemis/components/variant/VCFFilter.java
+++ b/uk/ac/sanger/artemis/components/variant/VCFFilter.java
@@ -1,11 +1,13 @@
package uk.ac.sanger.artemis.components.variant;
+import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
+import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
@@ -24,19 +26,109 @@ public class VCFFilter extends JFrame
private static float MAX_CI95 = 10;
/**
- * Filter VCF records by different values in the record, QUAL, DP, MQ and AF1.
+ * Filter VCF records by the variant type and/or by different values in
+ * the record, QUAL, DP, MQ and AF1.
* @param vcfView
*/
public VCFFilter(final VCFview vcfView)
{
- super("Filter");
+ super("Variant Filter");
GridBagConstraints c = new GridBagConstraints();
JPanel panel = (JPanel)getContentPane();
panel.setLayout(new GridBagLayout());
- // min quality
+ // Filter by type
+ c.gridx = 0;
c.gridy = 0;
+ c.anchor = GridBagConstraints.WEST;
+ JLabel typeLabel = new JLabel("TYPE:");
+ typeLabel.setFont(typeLabel.getFont().deriveFont(Font.BOLD));
+ panel.add(typeLabel, c);
+
+ c.gridy = c.gridy + 1;
+ final JCheckBox showSyn = new JCheckBox("Synonymous", vcfView.showSynonymous);
+ panel.add(showSyn, c);
+ showSyn.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e)
+ {
+ vcfView.showSynonymous = showSyn.isSelected();
+ vcfView.repaint();
+ }
+ });
+
+ c.gridy = c.gridy + 1;
+ final JCheckBox showNonSyn = new JCheckBox("Non-synonymous", vcfView.showNonSynonymous);
+ panel.add(showNonSyn, c);
+ showNonSyn.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e)
+ {
+ vcfView.showNonSynonymous = showNonSyn.isSelected();
+ vcfView.repaint();
+ }
+ });
+
+ c.gridy = c.gridy + 1;
+ final JCheckBox showDeletionsMenu = new JCheckBox("Deletions", vcfView.showDeletions);
+ panel.add(showDeletionsMenu, c);
+ showDeletionsMenu.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e)
+ {
+ vcfView.showDeletions = showDeletionsMenu.isSelected();
+ vcfView.repaint();
+ }
+ });
+
+ c.gridy = c.gridy + 1;
+ final JCheckBox showInsertionsMenu = new JCheckBox("Insertions", vcfView.showInsertions);
+ panel.add(showInsertionsMenu, c);
+ showInsertionsMenu.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e)
+ {
+ vcfView.showInsertions = showInsertionsMenu.isSelected();
+ vcfView.repaint();
+ }
+ });
+
+ c.gridy = c.gridy + 1;
+ final JCheckBox showMultiAllelesMenu = new JCheckBox("Multiple alleles", vcfView.showMultiAlleles);
+ panel.add(showMultiAllelesMenu, c);
+ showMultiAllelesMenu.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e)
+ {
+ vcfView.showMultiAlleles = showMultiAllelesMenu.isSelected();
+ vcfView.repaint();
+ }
+ });
+
+ c.gridy = c.gridy + 1;
+ final JCheckBox showNonOverlappingsMenu = new JCheckBox("Varaints not overlapping CDS", vcfView.showNonOverlappings);
+ panel.add(showNonOverlappingsMenu, c);
+ showNonOverlappingsMenu.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e)
+ {
+ vcfView.showNonOverlappings = showNonOverlappingsMenu.isSelected();
+ vcfView.repaint();
+ }
+ });
+
+ if(vcfView.getEntryGroup() == null || vcfView.getEntryGroup().getAllFeaturesCount() == 0)
+ {
+ showSyn.setEnabled(false);
+ showNonSyn.setEnabled(false);
+ showNonOverlappingsMenu.setEnabled(false);
+ }
+
+ // Filter by property
+ c.gridy = c.gridy+1;
+ panel.add(new JLabel(" "), c);
+ c.gridy = c.gridy+1;
+ JLabel propLabel = new JLabel("PROPERTY:");
+ propLabel.setFont(propLabel.getFont().deriveFont(Font.BOLD));
+ panel.add(propLabel, c);
+
+ // min quality
+ c.gridy = c.gridy+1;
c.gridx = 0;
c.anchor = GridBagConstraints.WEST;
panel.add(new JLabel("Minimum quality score (QUAL):"), c);
diff --git a/uk/ac/sanger/artemis/components/variant/VCFview.java b/uk/ac/sanger/artemis/components/variant/VCFview.java
index 1b58cdc28..00f94267f 100644
--- a/uk/ac/sanger/artemis/components/variant/VCFview.java
+++ b/uk/ac/sanger/artemis/components/variant/VCFview.java
@@ -133,19 +133,18 @@ public class VCFview extends JPanel
private JPopupMenu popup;
private int LINE_HEIGHT = 15;
- private boolean showSynonymous = true;
- private boolean showNonSynonymous = true;
- private boolean showDeletions = true;
- private boolean showInsertions = true;
- private boolean showMultiAlleles = true;
+ protected boolean showSynonymous = true;
+ protected boolean showNonSynonymous = true;
+ protected boolean showDeletions = true;
+ protected boolean showInsertions = true;
+ protected boolean showMultiAlleles = true;
+ // show variants that do not overlap CDS
+ protected boolean showNonOverlappings = true;
private boolean markAsNewStop = false;
final JCheckBoxMenuItem markNewStops =
new JCheckBoxMenuItem("Mark new stops within CDS features", true);
- // show variants that do not overlap CDS
- private boolean showNonOverlappings = true;
-
Hashtable<String, Integer> offsetLengths = null;
private boolean concatSequences = false;
@@ -424,75 +423,7 @@ public class VCFview extends JPanel
popup.add(addVCFMenu);
popup.addSeparator();
- JMenu showMenu = new JMenu("Show");
- popup.add(showMenu);
-
- final JCheckBoxMenuItem showSyn = new JCheckBoxMenuItem(
- "Synonymous", showSynonymous);
- showSyn.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e)
- {
- showSynonymous = showSyn.isSelected();
- repaint();
- }
- });
- showMenu.add(showSyn);
-
- final JCheckBoxMenuItem showNonSyn = new JCheckBoxMenuItem(
- "Non-synonymous", showNonSynonymous);
- showNonSyn.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e)
- {
- showNonSynonymous = showNonSyn.isSelected();
- repaint();
- }
- });
- showMenu.add(showNonSyn);
-
- final JCheckBoxMenuItem showDeletionsMenu = new JCheckBoxMenuItem(
- "Deletions", showDeletions);
- showDeletionsMenu.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e)
- {
- showDeletions = showDeletionsMenu.isSelected();
- repaint();
- }
- });
- showMenu.add(showDeletionsMenu);
-
- final JCheckBoxMenuItem showInsertionsMenu = new JCheckBoxMenuItem(
- "Insertions", showInsertions);
- showInsertionsMenu.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e)
- {
- showInsertions = showInsertionsMenu.isSelected();
- repaint();
- }
- });
- showMenu.add(showInsertionsMenu);
-
- final JCheckBoxMenuItem showMultiAllelesMenu = new JCheckBoxMenuItem(
- "Multiple alleles", showMultiAlleles);
- showMultiAllelesMenu.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e)
- {
- showMultiAlleles = showMultiAllelesMenu.isSelected();
- repaint();
- }
- });
- showMenu.add(showMultiAllelesMenu);
-
- final JCheckBoxMenuItem showNonOverlappingsMenu = new JCheckBoxMenuItem(
- "Varaints not overlapping CDS", showNonOverlappings);
- showNonOverlappingsMenu.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e)
- {
- showNonOverlappings = showNonOverlappingsMenu.isSelected();
- repaint();
- }
- });
- showMenu.add(showNonOverlappingsMenu);
markNewStops.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
@@ -1439,6 +1370,11 @@ public class VCFview extends JPanel
return (float)vcfPanel.getWidth() / (float)nbasesInView;
}
+ protected EntryGroup getEntryGroup()
+ {
+ return entryGroup;
+ }
+
/**
* Popup menu listener
*/
--
GitLab