X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;h=d0a0f11e28a5cc9f93d5f54991a2c879ee08c816;hb=ee5718cb9339243dd47eeb410fe101217859c2ff;hp=f754eb9b8c5d2233be70bf7476f3e085c1d44977;hpb=c406d789d51e6ac1ff45e3568d37e9ed53025f03;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index f754eb9..d0a0f11 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -18,24 +18,6 @@ * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ -/* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ package jalview.gui; import jalview.analysis.AlignmentUtils; @@ -44,7 +26,7 @@ import jalview.analysis.NJTree; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.api.FeatureColourI; -import jalview.api.FeatureSettingsI; +import jalview.api.FeatureSettingsModelI; import jalview.api.FeaturesDisplayedI; import jalview.api.ViewStyleI; import jalview.bin.Cache; @@ -75,7 +57,6 @@ import java.awt.Rectangle; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; -import java.util.Map; import java.util.Vector; import javax.swing.JInternalFrame; @@ -420,10 +401,11 @@ public class AlignViewport extends AlignmentViewport implements * @param align * DOCUMENT ME! */ + @Override public void setAlignment(AlignmentI align) { replaceMappings(align); - this.alignment = align; + super.setAlignment(align); } /** @@ -508,17 +490,6 @@ public class AlignViewport extends AlignmentViewport implements /** * DOCUMENT ME! * - * @return DOCUMENT ME! - */ - @Override - public ColumnSelection getColumnSelection() - { - return colSel; - } - - /** - * DOCUMENT ME! - * * @param tree * DOCUMENT ME! */ @@ -664,39 +635,6 @@ public class AlignViewport extends AlignmentViewport implements } /** - * synthesize a column selection if none exists so it covers the given - * selection group. if wholewidth is false, no column selection is made if the - * selection group covers the whole alignment width. - * - * @param sg - * @param wholewidth - */ - public void expandColSelection(SequenceGroup sg, boolean wholewidth) - { - int sgs, sge; - if (sg != null - && (sgs = sg.getStartRes()) >= 0 - && sg.getStartRes() <= (sge = sg.getEndRes()) - && (colSel == null || colSel.getSelected() == null || colSel - .getSelected().size() == 0)) - { - if (!wholewidth && alignment.getWidth() == (1 + sge - sgs)) - { - // do nothing - return; - } - if (colSel == null) - { - colSel = new ColumnSelection(); - } - for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++) - { - colSel.addElement(cspos); - } - } - } - - /** * Returns the (Desktop) instance of the StructureSelectionManager */ @Override @@ -717,27 +655,44 @@ public class AlignViewport extends AlignmentViewport implements List seqvectors = new ArrayList(); for (PDBEntry pdb : pdbEntries) { - List seqs = new ArrayList(); + List choosenSeqs = new ArrayList(); for (SequenceI sq : alignment.getSequences()) { - Vector pdbs = sq.getDatasetSequence().getAllPDBEntries(); - if (pdbs == null) + Vector pdbRefEntries = sq.getDatasetSequence() + .getAllPDBEntries(); + if (pdbRefEntries == null) { continue; } - for (PDBEntry p1 : pdbs) + for (PDBEntry pdbRefEntry : pdbRefEntries) { - if (p1.getId().equals(pdb.getId())) + if (pdbRefEntry.getId().equals(pdb.getId())) { - if (!seqs.contains(sq)) + if (pdbRefEntry.getChainCode() != null + && pdb.getChainCode() != null) { - seqs.add(sq); - continue; + if (pdbRefEntry.getChainCode().equalsIgnoreCase( + pdb.getChainCode()) + && !choosenSeqs.contains(sq)) + { + choosenSeqs.add(sq); + continue; + } } + else + { + if (!choosenSeqs.contains(sq)) + { + choosenSeqs.add(sq); + continue; + } + } + } } } - seqvectors.add(seqs.toArray(new SequenceI[seqs.size()])); + seqvectors + .add(choosenSeqs.toArray(new SequenceI[choosenSeqs.size()])); } return seqvectors.toArray(new SequenceI[seqvectors.size()][]); } @@ -1137,7 +1092,8 @@ public class AlignViewport extends AlignmentViewport implements * * @param featureSettings */ - public void applyFeaturesStyle(FeatureSettingsI featureSettings) + @Override + public void applyFeaturesStyle(FeatureSettingsModelI featureSettings) { if (featureSettings == null) { @@ -1146,7 +1102,6 @@ public class AlignViewport extends AlignmentViewport implements FeatureRenderer fr = getAlignPanel().getSeqPanel().seqCanvas .getFeatureRenderer(); - Map featureColours = fr.getFeatureColours(); fr.findAllFeatures(true); List renderOrder = fr.getRenderOrder(); FeaturesDisplayedI displayed = fr.getFeaturesDisplayed();