/** Both fires off selection event and displays annot */ private void selectAnnot(AnnotatedFeatureI annot) { displayAnnot(getTransOrOneLevelAnn(annot)); translationViewer.repaint(); BaseFocusEvent evt = new BaseFocusEvent(this, annot.getStart(), annot); getController().handleBaseFocusEvent(evt); getSelectionManager().select(annot, this); // sends off selection }
private BaseFineEditor( AnnotatedFeatureI editMe, GuiCurationState curationState, SeqFeatureI geneHolder, Set<SeqFeatureI> selectedResults) { super((editMe.isForwardStrand() ? "Forward" : "Reverse") + " Strand Exon Editor"); this.curationState = curationState; curationState.getController().addListener(this); curationState.getController().addListener(new BaseEditorDataListener()); szap = curationState.getSZAP(); transformer = szap.getScaleView().getTransform(); int seqStart = curationState.getCurationSet().getLow(); int seqEnd = curationState.getCurationSet().getHigh(); CurationSet s = curationState.getCurationSet(); // FeatureSetI annFeatSet=((DrawableFeatureSet)view.getDrawableSet()).getFeatureSet(); // REFACTOR BaseEditorPanel - (what allows for selection and modification of the annotations?) // create BaseViewPanel -> have BaseEditorPanel extend it // take the header outside of the editorPanel (is it really inside right now?) // create a new panel using BaseViewPanel /* * The viewable components of the new BaseFineEditor (should this be renamed?): * * 1) The Genomic Strand * 2) The Annotations (will these always be a copy of the genomic strand?) * q1) Can annotations also be nucliotides? - A: Yes. Create a separate view for those. * q2) Does it make sense to view both the forward and reverse strand at once? * q3) How do we know what to load - A: highlight the region we want to look at? * q4) Will we expect users to be able to view many annotations at once? * q4) How will the user know which annotation they are looking at? - A: Display the name when hovering over? * 3) The Results * q1) See above questions. * 4) Result Score information * 5) An overview - Right now this is at the transcript (gene model?) level * q1) What should be contained in this view? * * */ // I think that right now every base in the ede is a copy of the genomic, will that always be // the case? // is there ever sequence associated with an annotation. editorPanel = new BaseEditorPanel( curationState, this, !editMe.isForwardStrand(), seqStart, seqEnd, geneHolder); addResults(selectedResults); initGui(editMe); // cant do til after editorPanel made // cant do this til after initGui (editorPanel needs to know size) editorPanel.displayAnnot(editMe); attachListeners(); showEditRegion(); displayAnnot(getTransOrOneLevelAnn(editMe)); translationViewer.repaint(); setVisible(true); // Might just be linux, but bofe gets iconified on close if (getState() == Frame.ICONIFIED) setState(Frame.NORMAL); }
private BaseFineEditor( AnnotatedFeatureI editMe, GuiCurationState curationState, SeqFeatureI geneHolder) { super((editMe.isForwardStrand() ? "Forward" : "Reverse") + " Strand Exon Editor"); this.curationState = curationState; curationState.getController().addListener(this); curationState.getController().addListener(new BaseEditorDataListener()); szap = curationState.getSZAP(); transformer = szap.getScaleView().getTransform(); int seqStart = curationState.getCurationSet().getLow(); int seqEnd = curationState.getCurationSet().getHigh(); // FeatureSetI annFeatSet=((DrawableFeatureSet)view.getDrawableSet()).getFeatureSet(); editorPanel = new BaseEditorPanel( curationState, this, !editMe.isForwardStrand(), seqStart, seqEnd, geneHolder); initGui(editMe); // cant do til after editorPanel made // cant do this til after initGui (editorPanel needs to know size) editorPanel.displayAnnot(editMe); attachListeners(); showEditRegion(); displayAnnot(getTransOrOneLevelAnn(editMe)); translationViewer.repaint(); setVisible(true); // Might just be linux, but bofe gets iconified on close if (getState() == Frame.ICONIFIED) setState(Frame.NORMAL); }
/** * Handle the selection event (feature was selected in another window--select it here) This is * also where selections from BaseFineEditor come in which are really internal selections. Only * handle external selection if followSelection is checked */ public boolean handleFeatureSelectionEvent(FeatureSelectionEvent evt) { if (!canHandleSelection(evt, this)) return false; // now we do something, canHanSel filters for GenAnnIs AnnotatedFeatureI gai = (AnnotatedFeatureI) evt.getFeatures().getFeature(0); displayAnnot(getTransOrOneLevelAnn(gai)); translationViewer.repaint(); return true; }
/** * Display AnnotatedFeatureI feature. Exon, Transcript, and Gene are all GenericAnnotationI. No * selection event is fired. (selectAnnot fires and displays) */ private void displayAnnot(AnnotatedFeatureI annot) { currentAnnot = annot; if (currentAnnot == null) { transcriptComboBox.removeAllItems(); transcriptComboBox.addItem("<no feature selected>"); lengthLabel.setText("Translation length: <no feature selected>"); upstream_button.setLabel(""); downstream_button.setLabel(""); translationViewer.setTranscript(null, editorPanel.getSelectedTier()); // ?? return; } // else { setupTranscriptComboBox(currentAnnot); SeqFeatureI topAnnot = currentAnnot; if (topAnnot.isTranscript()) topAnnot = currentAnnot.getRefFeature(); if (topAnnot.isProteinCodingGene()) { String translation = currentAnnot.translate(); if (translation == null) { lengthLabel.setText("Translation length: <no start selected>"); } else { lengthLabel.setText("Translation length: " + currentAnnot.translate().length()); } } else { lengthLabel.setText(topAnnot.getFeatureType() + " annotation"); } FeatureSetI holder = (FeatureSetI) topAnnot.getRefFeature(); neighbor_up = null; neighbor_down = null; if (holder != null) { int index = holder.getFeatureIndex(topAnnot); // get next neighbor up that has whole sequence for (int i = index - 1; i >= 0 && neighbor_up == null; i--) { FeatureSetI gene_sib = (FeatureSetI) holder.getFeatureAt(i); if (gene_sib.getFeatureAt(0) instanceof Transcript) { Transcript trans = (Transcript) gene_sib.getFeatureAt(0); if (trans.haveWholeSequence()) // szap.getCurationSet())) neighbor_up = trans; } } // get next neighbor down that has whole sequence for (int i = index + 1; i < holder.size() && neighbor_down == null; i++) { FeatureSetI gene_sib = (FeatureSetI) holder.getFeatureAt(i); if (gene_sib.getFeatureAt(0) instanceof Transcript) { Transcript trans = (Transcript) gene_sib.getFeatureAt(0); if (trans.haveWholeSequence()) // szap.getCurationSet())) neighbor_down = trans; } } } upstream_button.setLabel( neighbor_up == null ? "" : "Go to next 5' annotation (" + neighbor_up.getParent().getName() + ")"); upstream_button.setVisible(neighbor_up != null); downstream_button.setLabel( neighbor_down == null ? "" : "Go to next 3' annotation (" + neighbor_down.getParent().getName() + ")"); downstream_button.setVisible(neighbor_down != null); // } // todo - translationViewer take in 1 level annot if (currentAnnot.isTranscript()) translationViewer.setTranscript((Transcript) currentAnnot, editorPanel.getSelectedTier()); }
private void initGui(AnnotatedFeatureI annot) { translationViewer = new TranslationViewer(editorPanel); translationViewer.setBackground(Color.black); transcriptComboBox = new JComboBox(); lengthLabel = new JLabel("Translation length: <no feature selected>"); lengthLabel.setForeground(Color.black); findButton = new JButton("Find sequence..."); clearFindsButton = new JButton("Clear search hits"); // Disable until we actually get search results clearFindsButton.setEnabled(false); goToButton = new JButton("GoTo..."); showIntronBox = new JCheckBox("Show introns in translation viewer", true); showIntronBox.setBackground(Color.white); followSelectionCheckBox = new JCheckBox("Follow external selection", false); followSelectionCheckBox.setBackground(Color.white); upstream_button = new JButton(); downstream_button = new JButton(); colorSwatch = new JPanel(); setSize(824, 500); JScrollPane pane = new JScrollPane(editorPanel); pane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // RAY: SET SCROLL POLICY HERE! WAS // HORIZONTAL_SCROLLBAR_NEVER // pane.setColumnHeaderView(new BaseFineEditorRowHeader(editorPanel)); // RAY: setRowHeader need // to create column header pane.setColumnHeaderView(new BaseFineEditorHorizontalColHeader(editorPanel)); viewport = pane.getViewport(); colorSwatch.setPreferredSize(new Dimension(10, 10)); getContentPane().setBackground(Color.white); getContentPane().setLayout(new BorderLayout()); getContentPane().add(colorSwatch, "North"); getContentPane().add(pane, "Center"); Box transcriptListBox = new Box(BoxLayout.X_AXIS); JLabel tranLabel; // 1 LEVEL ANNOT if (annot.isAnnotTop()) tranLabel = new JLabel("Annotation: "); else // 3-level tranLabel = new JLabel("Transcript: "); tranLabel.setForeground(Color.black); transcriptListBox.add(Box.createHorizontalStrut(5)); transcriptListBox.add(tranLabel); transcriptListBox.setBackground(Color.white); transcriptComboBox.setMaximumSize(new Dimension(300, 30)); transcriptListBox.add(transcriptComboBox); transcriptListBox.add(Box.createHorizontalGlue()); transcriptListBox.add(Box.createHorizontalStrut(5)); transcriptListBox.add(lengthLabel); transcriptListBox.add(Box.createHorizontalGlue()); Box checkboxesTop = new Box(BoxLayout.X_AXIS); checkboxesTop.setBackground(Color.white); checkboxesTop.add(Box.createHorizontalStrut(5)); checkboxesTop.add(findButton); checkboxesTop.add(Box.createHorizontalStrut(10)); checkboxesTop.add(clearFindsButton); checkboxesTop.add(Box.createHorizontalStrut(15)); checkboxesTop.add(goToButton); checkboxesTop.add(Box.createHorizontalGlue()); Box checkboxesBottom = new Box(BoxLayout.X_AXIS); checkboxesBottom.add(showIntronBox); checkboxesBottom.add(Box.createHorizontalGlue()); checkboxesBottom.add(Box.createHorizontalStrut(10)); checkboxesBottom.add(followSelectionCheckBox); Box checkboxes = new Box(BoxLayout.Y_AXIS); checkboxes.add(checkboxesTop); checkboxes.add(checkboxesBottom); Box labelPanel = new Box(BoxLayout.Y_AXIS); labelPanel.setBackground(Color.white); labelPanel.add(transcriptListBox); labelPanel.add(Box.createVerticalStrut(5)); labelPanel.add(checkboxes); Box navPanel = new Box(BoxLayout.Y_AXIS); navPanel.setBackground(Color.white); navPanel.add(upstream_button); navPanel.add(Box.createVerticalStrut(10)); navPanel.add(downstream_button); navPanel.add(Box.createVerticalGlue()); Box textBoxes = new Box(BoxLayout.X_AXIS); textBoxes.setBackground(Color.white); textBoxes.add(labelPanel); textBoxes.add(navPanel); Box detailPanel = new Box(BoxLayout.Y_AXIS); detailPanel.setBackground(Color.white); detailPanel.add(translationViewer); detailPanel.add(textBoxes); getContentPane().add(detailPanel, "South"); validateTree(); scrollListener = new FineEditorScrollListener(); viewport.addChangeListener(scrollListener); transcriptComboBox.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_U && (e.getModifiers() & KeyEvent.CTRL_MASK) != 0) { CurationManager.getActiveCurationState().getTransactionManager().undo(this); } } }); }