int pdbend = 0;\r
int seqstart = 0;\r
int seqend = 0;\r
- int [] mapping = null;\r
+ AlignSeq maxAlignseq = null;;\r
\r
for (int i = 0; i < pdb.chains.size(); i++)\r
{\r
pdbend = as.seq2end;\r
seqstart = as.seq1start + sequence.getStart()-1;\r
seqend = as.seq1end + sequence.getEnd()-1;\r
- mapping = as.getExactMapping();\r
+ maxAlignseq = as;\r
}\r
\r
mappingDetails.append("\nPDB start/end " + pdbstart + " " + pdbend);\r
mainchain.seqstart = seqstart;\r
mainchain.seqend = seqend;\r
mainchain.isVisible = true;\r
- mainchain.seqMapping = mapping;\r
+ mainchain.makeExactMapping(maxAlignseq, sequence);\r
+\r
// mainchain.sequence = sequence;\r
\r
this.pdb = pdb;\r
}\r
});\r
\r
- /*\r
- SequenceGroup sg = new SequenceGroup("PDB",\r
- null, true,true,false,\r
- sequence.findIndex(seqstart-1),\r
- sequence.findIndex(seqend-1));\r
- sg.addSequence(sequence, false);\r
- sg.setOutlineColour(Color.black);\r
- seqcanvas.getViewport().getAlignment().addGroup(sg);\r
- */\r
\r
findCentre();\r
findWidth();\r
ToolTipManager.sharedInstance().setDismissDelay(10000);\r
}\r
\r
+\r
Vector visiblebonds;\r
void setupBonds()\r
{\r
repaint();\r
}\r
\r
+ int findTrueIndex(int pos)\r
+ {\r
+ // returns the alignment position for a residue\r
+ int j = sequence.getStart();\r
+ int i = 0;\r
+\r
+ while ( (i < sequence.getLength()) && (j <= sequence.getEnd()) && (j <= pos+1))\r
+ {\r
+ if (!jalview.util.Comparison.isGap(sequence.getCharAt(i)))\r
+ {\r
+ j++;\r
+ }\r
+\r
+ i++;\r
+ }\r
+\r
+ if(i>1)\r
+ i--;\r
+\r
+ if ( (j == sequence.getEnd()) && (j < pos))\r
+ {\r
+ return sequence.getEnd() + 1;\r
+ }\r
+ else\r
+ {\r
+ return i;\r
+ }\r
+ }\r
+\r
// This method has been taken out of PDBChain to allow\r
// Applet and Application specific sequence renderers to be used\r
void colourBySequence(PDBChain chain)\r
if ( (tmp.at1.resNumber >= ( (chain.offset + chain.pdbstart) - 1)) &&\r
(tmp.at1.resNumber <= ( (chain.offset + chain.pdbend) - 1)))\r
{\r
-\r
- int pos = // chain.seqstart + Don't include seqstart here, start from 0\r
- (tmp.at1.resNumber - chain.pdbstart - chain.offset)+1;\r
-\r
- int index = chain.seqMapping[pos];\r
+ int index = findTrueIndex(tmp.at1.alignmentMapping);\r
+ //sequence.findIndex(tmp.at1.alignmentMapping);\r
if (index != -1)\r
{\r
- tmp.startCol = seqcanvas.getSequenceRenderer().findSequenceColour(\r
- Color.lightGray, sequence, index);\r
+ tmp.startCol = seqcanvas.getSequenceRenderer().\r
+ getResidueBoxColour( sequence, index);\r
\r
- tmp.startCol = seqcanvas.getFeatureRenderer().findFeatureColour(tmp.\r
- startCol, sequence, index);\r
+ tmp.startCol = seqcanvas.getFeatureRenderer().\r
+ findFeatureColour(tmp.startCol, sequence, index);\r
}\r
}\r
\r
if ( (tmp.at2.resNumber >= ( (chain.offset + chain.pdbstart) - 1)) &&\r
(tmp.at2.resNumber <= ( (chain.pdbend + chain.offset) - 1)))\r
{\r
- int pos = // chain.seqstart + Don't include seqstart here, start from 0\r
- (tmp.at2.resNumber - chain.pdbstart - chain.offset)+1;\r
\r
- int index = chain.seqMapping[pos];\r
+ int index = findTrueIndex(tmp.at2.alignmentMapping);\r
+ //sequence.findIndex( tmp.at2.alignmentMapping );\r
if (index != -1)\r
{\r
- tmp.endCol = seqcanvas.getSequenceRenderer().findSequenceColour(\r
- tmp.endCol, sequence, index);\r
- tmp.endCol = seqcanvas.getFeatureRenderer().findFeatureColour(tmp.\r
- endCol, sequence, index);\r
+ tmp.endCol = seqcanvas.getSequenceRenderer().\r
+ getResidueBoxColour( sequence, index);\r
+ tmp.endCol = seqcanvas.getFeatureRenderer().\r
+ findFeatureColour(tmp.endCol, sequence, index);\r
}\r
}\r
}\r
PDBChain chain = (PDBChain) pdb.chains.elementAt(foundchain);\r
if (chain == mainchain)\r
{\r
- int pos = // chain.seqstart + Don't include seqstart here, start from 0\r
- (fatom.resNumber - chain.pdbstart - chain.offset) +1 ;\r
-\r
- if (chain.seqMapping[pos] != -1)\r
+ if (fatom.alignmentMapping != -1)\r
{\r
if (highlightRes == null)\r
highlightRes = new Vector();\r
\r
- if (highlightRes.contains((chain.seqMapping[pos]) + ""))\r
- highlightRes.remove((chain.seqMapping[pos]) + "");\r
+ if (highlightRes.contains(fatom.alignmentMapping+"" + ""))\r
+ highlightRes.remove(fatom.alignmentMapping + "");\r
else\r
- highlightRes.add((chain.seqMapping[pos]) + "");\r
+ highlightRes.add(fatom.alignmentMapping + "");\r
}\r
}\r
}\r
chain = (PDBChain) pdb.chains.elementAt(foundchain);\r
if(chain == mainchain)\r
{\r
- int pos = // chain.seqstart + Don't include seqstart here, start from 0\r
- (fatom.resNumber - chain.pdbstart - chain.offset) +1 ;\r
-\r
- highlightSeqcanvas( chain.seqMapping[pos] );\r
+ highlightSeqcanvas( fatom.alignmentMapping );\r
}\r
}\r
\r
public void highlightRes(int ii)\r
{\r
\r
- int index = ii - mainchain.seqstart;\r
-\r
- if (highlightRes!=null\r
- && highlightRes.contains( mainchain.seqMapping[index]+ ""))\r
+ if (highlightRes != null\r
+ && highlightRes.contains((ii-1) + ""))\r
{\r
- return;\r
+ return;\r
}\r
\r
- if(highlightBond1!=null)\r
- highlightBond1.at2.isSelected = false;\r
-\r
- if(highlightBond2!=null)\r
- highlightBond2.at1.isSelected = false;\r
-\r
- highlightBond1 = null;\r
- highlightBond2 = null;\r
+ int index = -1;\r
+ Bond tmpBond;\r
+ for(index=0; index<mainchain.bonds.size(); index++)\r
+ {\r
+ tmpBond = (Bond) mainchain.bonds.elementAt(index);\r
+ if (tmpBond.at1.alignmentMapping == ii - 1)\r
+ {\r
+ if (highlightBond1 != null)\r
+ highlightBond1.at2.isSelected = false;\r
\r
+ if (highlightBond2 != null)\r
+ highlightBond2.at1.isSelected = false;\r
\r
+ highlightBond1 = null;\r
+ highlightBond2 = null;\r
\r
- if(index <0 )\r
- return;\r
+ if (index > 0)\r
+ {\r
+ highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);\r
+ highlightBond1.at2.isSelected = true;\r
+ }\r
\r
- if(index<=mainchain.bonds.size())\r
- {\r
- if(index>0)\r
- {\r
- highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);\r
- highlightBond1.at2.isSelected = true;\r
- // highlightBond1.at2.isSelected = true;\r
- }\r
+ if (index != mainchain.bonds.size())\r
+ {\r
+ highlightBond2 = (Bond) mainchain.bonds.elementAt(index);\r
+ highlightBond2.at1.isSelected = true;\r
+ }\r
\r
- if(index!=mainchain.bonds.size())\r
- {\r
- highlightBond2 = (Bond) mainchain.bonds.elementAt(index);\r
- highlightBond2.at1.isSelected = true;\r
- // highlightBond2.at2.isSelected = true;\r
+ break;\r
}\r
}\r
\r