From: amwaterhouse Date: Fri, 24 Feb 2006 11:47:03 +0000 (+0000) Subject: Cannot delete residues X-Git-Tag: Root_VamJalview_2_07b+~90 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8fdfb564d3061e849a26d5a388f333808f0c796a;p=jalview.git Cannot delete residues --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 35ac570..e500422 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -803,24 +803,50 @@ public class AlignFrame return; } - addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment, - HistoryItem.HIDE)); SequenceGroup sg = viewport.getSelectionGroup(); - boolean allSequences = false; - if (sg.sequences.size() == viewport.alignment.getHeight()) + + + + //Jalview no longer allows deletion of residues. + //Check here whether any residues are in selection area + if( sg.getEndRes()-sg.getStartRes() < viewport.alignment.getWidth()-1) { - allSequences = true; + for (int i = 0; i < sg.sequences.size(); i++) + { + SequenceI seq = sg.getSequenceAt(i); + int j = sg.getStartRes(); + do + { + if (!jalview.util.Comparison.isGap(seq.getCharAt(j))) + { + JOptionPane.showInternalMessageDialog( + Desktop.desktop, "Cannot delete residues from alignment!\n" + + "Try hiding columns instead.", + "Deletion of residues not permitted", + JOptionPane.WARNING_MESSAGE); + + return; + } + j++; + }while(j<=sg.getEndRes()); + } } + + addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment, + HistoryItem.HIDE)); + + for (int i = 0; i < sg.sequences.size(); i++) { SequenceI seq = sg.getSequenceAt(i); int index = viewport.getAlignment().findIndex(seq); + seq.deleteChars(sg.getStartRes(), sg.getEndRes() + 1); // If the cut affects all sequences, remove highlighted columns - if (allSequences) + if (sg.sequences.size() == viewport.alignment.getHeight()) { viewport.getColumnSelection().removeElements(sg.getStartRes(), sg.getEndRes() + 1); @@ -1194,8 +1220,8 @@ public class AlignFrame JInternalFrame frame = new JInternalFrame(); Finder finder = new Finder(viewport, alignPanel, frame); frame.setContentPane(finder); - Desktop.addInternalFrame(frame, "Find", 340, 110); frame.setLayer(JLayeredPane.PALETTE_LAYER); + Desktop.addInternalFrame(frame, "Find", 340, 110); } /** @@ -1329,7 +1355,7 @@ public class AlignFrame new SequenceFeatureFetcher(viewport. alignment, alignPanel); - viewport.showSequenceFeatures(true); + viewport.setShowSequenceFeatures(true); showSeqFeatures.setSelected(true); } } @@ -1347,8 +1373,12 @@ public class AlignFrame */ public void showSeqFeatures_actionPerformed(ActionEvent evt) { - viewport.showSequenceFeatures(showSeqFeatures.isSelected()); + viewport.setShowSequenceFeatures(showSeqFeatures.isSelected()); alignPanel.repaint(); + if (alignPanel.getOverviewPanel() != null) + { + alignPanel.getOverviewPanel().updateOverviewImage(); + } } /** @@ -2627,6 +2657,7 @@ public boolean parseGroupsFile(String file) } viewport.showSequenceFeatures = true; + showSeqFeatures.setSelected(true); alignPanel.repaint(); return true; }