X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fstructures%2Fmodels%2FAAStructureBindingModel.java;h=3602056673d41ead4f7a3ed9490a54c7460a826f;hb=17fe82c9d7f9da1b17f3091e4b3992a35e3e411e;hp=12be239e85811c86f3ac277af618d5d04a301986;hpb=c66902a9536b10a5477b58aaf7c2d75772890a5d;p=jalview.git diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index 12be239..3602056 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -1,17 +1,19 @@ package jalview.structures.models; +import java.util.ArrayList; +import java.util.List; + import jalview.api.StructureSelectionManagerProvider; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import jalview.structure.AtomSpec; import jalview.structure.StructureListener; import jalview.structure.StructureSelectionManager; +import jalview.util.Comparison; import jalview.util.MessageManager; -import java.awt.event.ComponentEvent; -import java.util.ArrayList; -import java.util.List; - /** + * * A base class to hold common function for protein structure model binding. * Initial version created by refactoring JMol and Chimera binding models, but * other structure viewers could in principle be accommodated in future. @@ -45,6 +47,8 @@ public abstract class AAStructureBindingModel extends protected boolean colourBySequence = true; + private boolean nucleotide; + /** * Constructor * @@ -73,6 +77,7 @@ public abstract class AAStructureBindingModel extends { this.ssm = ssm; this.sequence = sequenceIs; + this.nucleotide = Comparison.isNucleotide(sequenceIs); this.chains = chains; this.pdbEntry = pdbentry; this.protocol = protocol; @@ -342,4 +347,43 @@ public abstract class AAStructureBindingModel extends addSequenceAndChain(pe, seq, null); } + /** + * add the given sequences to the mapping scope for the given pdb file handle + * + * @param pdbFile + * - pdbFile identifier + * @param seq + * - set of sequences it can be mapped to + */ + public void addSequenceForStructFile(String pdbFile, SequenceI[] seq) + { + for (int pe = 0; pe < getPdbCount(); pe++) + { + if (getPdbEntry(pe).getFile().equals(pdbFile)) + { + addSequence(pe, seq); + } + } + } + + @Override + public void highlightAtoms(List atoms) + { + if (atoms != null) + { + for (AtomSpec atom : atoms) + { + highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(), + atom.getChain(), atom.getPdbFile()); + } + } + } + + protected abstract void highlightAtom(int atomIndex, int pdbResNum, + String chain, String pdbFile); + + protected boolean isNucleotide() + { + return this.nucleotide; + } } \ No newline at end of file