From f72e829fdbcb33664d4fa687a8a5a6f66759d013 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 23 Apr 2007 11:50:12 +0000 Subject: [PATCH] getColour added to structures --- src/jalview/structure/StructureListener.java | 2 + .../structure/StructureSelectionManager.java | 55 +++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) 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; -- 1.7.10.2