From: amwaterhouse Date: Mon, 23 Apr 2007 11:50:12 +0000 (+0000) Subject: getColour added to structures X-Git-Tag: Release_2_3~190 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f72e829fdbcb33664d4fa687a8a5a6f66759d013;p=jalview.git getColour added to structures --- diff --git a/src/jalview/structure/StructureListener.java b/src/jalview/structure/StructureListener.java index 0d7819e..5436eae 100644 --- a/src/jalview/structure/StructureListener.java +++ b/src/jalview/structure/StructureListener.java @@ -27,4 +27,6 @@ public interface StructureListener public void highlightAtom(int atomIndex, int pdbResNum, String chain, String pdbId); public void updateColours(Object source); + + public java.awt.Color getColour(int atomIndex, int pdbResNum, String chain, String pdbId); } diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 0a3db6d..c0ab6f9 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -69,7 +69,7 @@ public class StructureSelectionManager There will be better ways of doing this in the future, for now we'll use the tried and tested MCview pdb mapping */ - public MCview.PDBfile setMapping(SequenceI[] sequence, + synchronized public MCview.PDBfile setMapping(SequenceI[] sequence, String pdbFile, String protocol) { @@ -283,6 +283,59 @@ public class StructureSelectionManager } } + public Annotation[] colourSequenceFromStructure(SequenceI seq, String pdbid) + { + Annotation [] annotations = new Annotation[seq.getLength()]; + + StructureListener sl; + int atomNo = 0; + for (int i = 0; i < listeners.size(); i++) + { + if (listeners.elementAt(i) instanceof StructureListener) + { + sl = (StructureListener) listeners.elementAt(i); + + for (int j = 0; j < mappings.length; j++) + { + + if (mappings[j].sequence == seq + && mappings[j].getPdbId().equals(pdbid) + && mappings[j].pdbfile.equals(sl.getPdbFile())) + { + System.out.println(pdbid+" "+mappings[j].getPdbId() + +" "+mappings[j].pdbfile); + + java.awt.Color col; + for(int index=0; index 0) + { + col = sl.getColour(atomNo, + mappings[j].getPDBResNum(index), + mappings[j].pdbchain, + mappings[j].pdbfile); + + // System.out.println(atomNo+" "+mappings[j].getPDBResNum(index) + // +" "+index+" "+col); + } + + annotations[index] = new Annotation("X",null,' ',0,col); + } + return annotations; + } + } + } + } + + return annotations; + } + + public void structureSelectionChanged() { StructureListener svl;