\r
Vector lineArray = new Vector();\r
\r
+ public PDBfile(String [] lines)\r
+ {\r
+ for(int i=0; i<lines.length; i++)\r
+ lineArray.add(lines[i]);\r
+\r
+ noLines = lineArray.size();\r
+ parse();\r
+ }\r
+\r
public PDBfile(String inFile, String inType) throws IOException {\r
\r
super(inFile,inType);\r
\r
public void parse() {\r
\r
- System.out.println("Parsing");\r
-\r
for (int i = 0; i < lineArray.size(); i++) {\r
StringTokenizer str = new StringTokenizer(lineArray.elementAt(i).toString());\r
if (str.hasMoreTokens()) {\r
try {\r
myAtom tmpatom = new myAtom(str);\r
if (findChain(tmpatom.chain) != null) {\r
- System.out.println("Adding to chain " + tmpatom.chain);\r
+ // System.out.println("Adding to chain " + tmpatom.chain);\r
findChain(tmpatom.chain).atoms.addElement(tmpatom);\r
} else {\r
- System.out.println("Making chain " + tmpatom.chain);\r
+ // System.out.println("Making chain " + tmpatom.chain);\r
PDBChain tmpchain = new PDBChain(tmpatom.chain);\r
chains.addElement(tmpchain);\r
tmpchain.atoms.addElement(tmpatom);\r
}\r
}\r
if(fatom!=null)\r
+ {\r
this.setToolTipText(fatom.resName);\r
+ System.out.println(fatom.resName);\r
+ }\r
else\r
this.setToolTipText(null);\r
}\r
return pos;\r
}\r
\r
+ class FeatureThread extends Thread\r
+ {\r
+\r
+ }\r
+\r
+ public static void addUniprotFeatures(AlignmentI align)\r
+ {\r
+ EBIFetchClient ebi = new EBIFetchClient();\r
+ int seqIndex = 0;\r
+ Vector sequences = align.getSequences();\r
+ SequenceI sequence;\r
+\r
+ while (seqIndex < sequences.size())\r
+ {\r
+ StringBuffer ids = new StringBuffer("uniprot:");\r
+ for (int i=0; seqIndex<sequences.size() && i<50; seqIndex++, i++)\r
+ {\r
+ sequence = (SequenceI) sequences.get(seqIndex);\r
+ ids.append(sequence.getName() + ";");\r
+ }\r
+\r
+ String[] result = ebi.fetchData(ids.toString(), "xml", null);\r
+ sequence = null;\r
+ Vector features = null;\r
+ String type, description, status, start, end, pdb = null;\r
+\r
+ for (int r = 0; r < result.length; r++)\r
+ {\r
+ if(sequence==null && result[r].indexOf("<name>")>-1)\r
+ {\r
+ sequence = align.findName( parseElement( result[r], "<name>" )) ;\r
+ features = new Vector();\r
+ type=""; start="0"; end="0"; description=""; status=""; pdb="";\r
+ }\r
+\r
+ if(sequence==null)\r
+ continue;\r
+\r
+ if( result[r].indexOf("<property type=\"pdb accession\"")>-1)\r
+ {\r
+ pdb = parseValue( result[r], "value=" );\r
+ sequence.setPDBId(pdb);\r
+ }\r
+\r
+ if(result[r].indexOf("feature type")>-1)\r
+ {\r
+ type = parseValue( result[r], "type=" );\r
+ description = parseValue( result[r], "description=" );\r
+ status = parseValue ( result[r], "status=");\r
+\r
+ while( result[r].indexOf("<location>")==-1)\r
+ {\r
+ r++; //<location>\r
+ }\r
+ r++;\r
+ if(result[r].indexOf("begin")>-1)\r
+ {\r
+ start = parseValue( result[r], "position=" );\r
+ end = parseValue( result[++r], "position=" );\r
+ }\r
+ else\r
+ {\r
+ start = parseValue( result[r], "position=" );\r
+ end = parseValue( result[r], "position=" );\r
+ }\r
+ int sstart = Integer.parseInt(start);\r
+ int eend = Integer.parseInt(end);\r
+\r
+ if(sstart>=sequence.getStart() && eend<=sequence.getEnd())\r
+ {\r
+ SequenceFeature sf = new SequenceFeature(type,\r
+ sstart,\r
+ eend,\r
+ description,\r
+ status);\r
+ features.add(sf);\r
+ }\r
+ }\r
+\r
+ if(result[r].indexOf("</entry>")>-1)\r
+ {\r
+ sequence.setSequenceFeatures( features );\r
+ features = null;\r
+ sequence = null;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ static String parseValue(String line, String tag)\r
+ {\r
+\r
+ int index = line.indexOf(tag)+tag.length()+1;\r
+ if(index==tag.length())\r
+ return "";\r
+\r
+ return line.substring( index, line.indexOf("\"", index+1) );\r
+ }\r
+\r
+\r
+ static String parseElement(String line, String tag)\r
+ {\r
+ int index = line.indexOf(tag)+tag.length();\r
+ return line.substring( index, line.indexOf("</") ) ;\r
+ }\r
+\r
+\r
+\r
+\r
+\r
}\r
+++ /dev/null
-package jalview.datamodel;\r
-\r
-import java.util.*;\r
-\r
-public class FeaturePair {\r
- SequenceFeature f1;\r
- SequenceFeature f2;\r
-\r
- public FeaturePair() {\r
- this.f1 = new SequenceFeature();\r
- this.f2 = new SequenceFeature();\r
- }\r
- public FeaturePair(SequenceFeature f1, SequenceFeature f2) {\r
- this.f1 = f1;\r
- this.f2 = f2;\r
- }\r
- public void setQueryFeature(SequenceFeature feature) {\r
- this.f1 = feature;\r
- }\r
- public SequenceFeature getQueryFeature() {\r
- return f1;\r
- }\r
- public void setHitFeature(SequenceFeature feature) {\r
- this.f2 = feature;\r
- }\r
- public SequenceFeature getHitFeature() {\r
- return f2;\r
- }\r
- public void setStart(int start) {\r
- f1.setStart(start);\r
- }\r
- public int getStart() {\r
- return f1.getStart();\r
- }\r
- public void setEnd(int end) {\r
- f1.setEnd(end);\r
- }\r
- public int getEnd() {\r
- return f1.getEnd();\r
- }\r
- public void setStrand(int strand) {\r
- f1.setStrand(strand);\r
- }\r
- public int getStrand() {\r
- return f1.getStrand();\r
- }\r
- public String getId() {\r
- return f1.getId();\r
- }\r
- public void setId(String id) {\r
- f1.setId(id);\r
- }\r
- public double getScore() {\r
- return f1.getScore();\r
- }\r
- public void setScore(double score) {\r
- f1.setScore(score);\r
- f2.setScore(score);\r
- }\r
-\r
- public String getHitId() {\r
- return f2.getId();\r
- }\r
- public void setHitId(String name) {\r
- f2.setId(name);\r
- }\r
- public int getHstart() {\r
- return f2.getStart();\r
- }\r
- public void setHstart(int start) {\r
- f2.setStart(start);\r
- }\r
- public int getHend() {\r
- return f2.getEnd();\r
- }\r
- public void setHend(int end) {\r
- f2.setEnd(end);\r
- }\r
- public void setHstrand(int strand) {\r
- f2.setStrand(strand);\r
- }\r
- public int getHstrand() {\r
- return f2.getStrand();\r
- }\r
-\r
- public double getPValue() {\r
- return f1.getPValue();\r
- }\r
- public void setPValue(double value) {\r
- f1.setPValue(value);\r
- f2.setPValue(value);\r
- }\r
- public double getPercentId() {\r
- return f1.getPercentId();\r
- }\r
- public void setPercentId(double pid) {\r
- f1.setPercentId(pid);\r
- f2.setPercentId(pid);\r
- }\r
- \r
- public void invert() {\r
- SequenceFeature tmp = f1;\r
- f1 = f2;\r
- f2 = tmp;\r
- }\r
-\r
- public String toGFFString() {\r
- String tmp = f1.toGFFString();\r
-\r
- tmp = tmp + "\t" + getHitId() + "\t" + getHstart() + "\t" + getHend() + "\t" + getPValue() + "\t" + getPercentId();\r
-\r
- return tmp;\r
- }\r
- \r
- public static void main(String[] args) {\r
- FeaturePair fp = new FeaturePair();\r
- }\r
-}
\ No newline at end of file
\r
import jalview.analysis.*;\r
import java.awt.*;\r
-import java.util.StringTokenizer;\r
+import java.util.*;\r
import MCview.*;\r
\r
\r
{\r
protected String name;\r
protected String sequence;\r
+ protected String description;\r
protected int start;\r
protected int end;\r
- protected String description;\r
- protected int charHeight;\r
protected String displayId;\r
protected Color color = Color.white;\r
+ String pdbId;\r
PDBfile pdb;\r
- public int maxchain = -1;\r
\r
+ public int maxchain = -1;\r
public int pdbstart;\r
public int pdbend;\r
public int seqstart;\r
public int seqend;\r
+\r
+ public Vector sequenceFeatures = new Vector();\r
+ public void setSequenceFeatures(Vector v)\r
+ {\r
+ sequenceFeatures = v;\r
+ }\r
+\r
+ public Vector getSequenceFeatures()\r
+ {return sequenceFeatures; }\r
+\r
+ public void setPDBId(String id)\r
+ {\r
+ pdbId = id;\r
+ }\r
+ public String getPDBId()\r
+ {\r
+ return pdbId;\r
+ }\r
+\r
public void setPDBfile(PDBfile pdb)\r
{\r
this.pdb = pdb;\r
package jalview.datamodel;\r
\r
-import jalview.util.*;\r
-import jalview.jbgui.*;\r
-import jalview.schemes.*;\r
import java.awt.*;\r
\r
public class SequenceFeature {\r
- int start;\r
+ int begin;\r
int end;\r
String type;\r
String description;\r
- Color color;\r
- Sequence sequence;\r
- String id;\r
- double score;\r
- int strand;\r
- double pvalue;\r
- double pid;\r
+ String status;\r
\r
- public SequenceFeature() {\r
+ public SequenceFeature()\r
+ {\r
}\r
\r
- public SequenceFeature(Sequence sequence,String type, int start, int end, String description) {\r
- this.sequence = sequence;\r
+ public SequenceFeature(String type, int start, int end, String description, String status)\r
+ {\r
this.type = type;\r
- this.start = start;\r
+ this.begin = start;\r
this.end = end;\r
this.description = description;\r
-\r
- setColor();\r
- }\r
-\r
-\r
- public String toGFFString() {\r
- String gff = id + "\t" + type + "\tfeature\t" + start + "\t" + end + "\t" + score + "\t" + strand + "\t.";\r
- return gff;\r
- }\r
- public double getScore() {\r
- return score;\r
+ this.status = status;\r
}\r
\r
- public void setScore(double score) {\r
- this.score = score;\r
- }\r
-\r
- public String getId() {\r
- return this.id;\r
- }\r
- public void setId(String id) {\r
- this.id = id;\r
- }\r
- public void setSequence(Sequence seq) {\r
- this.sequence = seq;\r
- }\r
- public void setStart(int start) {\r
- this.start = start;\r
- }\r
- public void setEnd(int end) {\r
- this.end = end;\r
- }\r
- public int getStrand() {\r
- return strand;\r
- }\r
- public void setStrand(int strand) {\r
- this.strand = strand;\r
- }\r
public int getStart() {\r
- return start;\r
+ return begin;\r
}\r
-\r
public int getEnd() {\r
return end;\r
}\r
-\r
public String getType() {\r
return type;\r
}\r
-\r
public String getDescription() {\r
return description;\r
}\r
-\r
- public double getPValue() {\r
- return pvalue;\r
- }\r
- public void setPValue(double value) {\r
- this.pvalue = value;\r
- }\r
- public double getPercentId() {\r
- return pid;\r
- }\r
- public void setPercentId(double pid) {\r
- this.pid = pid;\r
- }\r
- public Color getColor() {\r
- return color;\r
- }\r
-\r
- public void setColor() {\r
- if (type.equals("CHAIN")) {\r
- color = Color.white;\r
- } else if (type.equals("DOMAIN")) {\r
- color = Color.white;\r
- } else if (type.equals("TRANSMEM")) {\r
- color = Color.red.darker();\r
- } else if (type.equals("SIGNAL")) {\r
- color = Color.cyan;\r
- } else if (type.equals("HELIX")) {\r
- color = Color.magenta;\r
- } else if (type.equals("TURN")) {\r
- color = Color.cyan;\r
- } else if (type.equals("SHEET")) {\r
- color = Color.yellow;\r
- } else if (type.equals("STRAND")) {\r
- color = Color.yellow;\r
- } else if (type.equals("CARBOHYD")) {\r
- color = Color.pink;\r
- } else if (type.equals("ACT_SITE")) {\r
- color = Color.red;\r
- } else if (type.equals("TRANSIT")) {\r
- color = Color.orange;\r
- } else if (type.equals("VARIANT")) {\r
- color = Color.orange.darker();\r
- } else if (type.equals("BINDING")) {\r
- color = Color.blue;\r
- } else if (type.equals("DISULFID")) {\r
- color = Color.yellow.darker();\r
- } else if (type.equals("NP_BIND")) {\r
- color = Color.red;\r
- } else if (type.indexOf("BIND") > 0) {\r
- color = Color.red;\r
- } else {\r
- color = Color.lightGray;\r
- }\r
- }\r
- public String print() {\r
- String tmp = new Format("%15s").form(type);\r
- tmp = tmp + new Format("%6d").form(start);\r
- tmp = tmp + new Format("%6d").form(end);\r
- tmp = tmp + " " + description;\r
- return tmp;\r
- }\r
- public void draw(Graphics g, int fstart, int fend, int x1, int y1, int width, int height) {\r
- g.setColor(new Color((float)(Math.random()),(float)(Math.random()),(float)(Math.random())));\r
-\r
- // int xstart = sequence.findIndex(start);\r
- //int xend = sequence.findIndex(end);\r
- int xstart = start;\r
- int xend = end;\r
- long tstart = System.currentTimeMillis();\r
- if (!(xend < fstart && xstart > fend)) {\r
-\r
- if (xstart > fstart) {\r
- x1 = x1 + (xstart-fstart)*width;\r
- fstart = xstart;\r
- }\r
-\r
- if (xend < fend) {\r
- fend = xend;\r
- }\r
-\r
- for (int i = fstart; i <= fend; i++) {\r
- char c = sequence.sequence.charAt(i);\r
- if (!jalview.util.Comparison.isGap((c)))\r
- g.fillRect(x1+(i-fstart)*width,y1,width,height);\r
- else\r
- g.drawString("-",x1+(i-fstart)*width,y1+height);\r
-\r
- }\r
-\r
- }\r
- long tend = System.currentTimeMillis();\r
- System.out.println("Time = " + (tend-tstart) + "ms");\r
-\r
- }\r
-\r
- public static void main(String[] args) {\r
- SequenceFeature sf = new SequenceFeature();\r
-\r
- System.out.println("Feature " + sf);\r
- }\r
- public static int CHAIN = 0;\r
- public static int DOMAIN = 1;\r
- public static int TRANSMEM = 2;\r
- public static int SIGNAL = 3;\r
- public static int HELIX = 4;\r
- public static int TURN = 5;\r
- public static int SHEET = 6;\r
- public static int CARBOHYD = 7;\r
- public static int ACT_SITE = 8;\r
- public static int TRANSIT = 9;\r
- public static int VARIANT = 10;\r
- public static int BINDING = 11;\r
+ public String getStatus()\r
+ {return status;}\r
+\r
+\r
+/*\r
+ <xs:enumeration value="active site" />\r
+<xs:enumeration value="binding site" />\r
+<xs:enumeration value="calcium-binding region" />\r
+<xs:enumeration value="chain" />\r
+<xs:enumeration value="cross-link" />\r
+<xs:enumeration value="disulfide bond" />\r
+<xs:enumeration value="DNA-binding region" />\r
+<xs:enumeration value="domain" />\r
+<xs:enumeration value="glycosylation site" />\r
+<xs:enumeration value="helix" />\r
+<xs:enumeration value="initiator methionine" />\r
+<xs:enumeration value="lipid moiety-binding region" />\r
+<xs:enumeration value="metal ion-binding site" />\r
+<xs:enumeration value="modified residue" />\r
+<xs:enumeration value="mutagenesis site" />\r
+<xs:enumeration value="non-consecutive residues" />\r
+<xs:enumeration value="non-terminal residue" />\r
+<xs:enumeration value="nucleotide phosphate-binding region" />\r
+<xs:enumeration value="peptide" />\r
+<xs:enumeration value="propeptide" />\r
+<xs:enumeration value="repeat" />\r
+<xs:enumeration value="selenocysteine" />\r
+<xs:enumeration value="sequence conflict" />\r
+<xs:enumeration value="sequence variant" />\r
+<xs:enumeration value="signal peptide" />\r
+<xs:enumeration value="similar" />\r
+<xs:enumeration value="site" />\r
+<xs:enumeration value="splice variant" />\r
+<xs:enumeration value="strand" />\r
+<xs:enumeration value="thioether bond" />\r
+<xs:enumeration value="thiolester bond" />\r
+<xs:enumeration value="transit peptide" />\r
+<xs:enumeration value="transmembrane region" />\r
+<xs:enumeration value="turn" />\r
+<xs:enumeration value="unsure residue" />\r
+<xs:enumeration value="zinc finger region" />\r
+*/\r
\r
}\r
\r
\r
public void setColor(Color c);\r
public Color getColor();\r
+\r
+ public Vector getSequenceFeatures();\r
+ public void setSequenceFeatures(Vector v);\r
+\r
+ public void setPDBId(String id);\r
+ public String getPDBId();\r
+\r
}\r
\r
\r
import jalview.analysis.*;\r
import jalview.io.*;\r
import jalview.ws.*;\r
-import MCview.*;\r
import java.awt.*;\r
import java.awt.event.*;\r
import java.awt.print.*;\r
{\r
super();\r
\r
+ AlignmentUtil.addUniprotFeatures(al);\r
+\r
viewport = new AlignViewport(al,true,true,true,false);\r
alignPanel = new AlignmentPanel(this, viewport);\r
getContentPane().add(alignPanel, java.awt.BorderLayout.CENTER);\r
fontNameMenuItem.setText(viewport.getFont().getName());\r
fontSizeMenuItem.setText(viewport.getFont().getSize()+"");\r
-\r
- clustalColour.setSelected(true);\r
- clustalColour_actionPerformed(null);\r
}\r
\r
protected void saveAs_actionPerformed(ActionEvent e)\r
alignPanel.RefreshPanels();\r
}\r
\r
- public void secondaryStructure_actionPerformed(ActionEvent evt)\r
+ public void sequenceFeatures_actionPerformed(ActionEvent evt)\r
{\r
- alignPanel.setSecondaryStructureVisible(secondaryStructure.isSelected());\r
+ viewport.showSequenceFeatures(sequenceFeatures.isSelected());\r
+ alignPanel.RefreshPanels();\r
}\r
\r
public void consensusGraphMenuItem_actionPerformed(ActionEvent e)\r
if (alignment != null)\r
{\r
AlignFrame af = new AlignFrame(new Alignment(alignment));\r
+ af.clustalColour.setSelected(true);\r
+ af.clustalColour_actionPerformed(null);\r
Desktop.addInternalFrame(af, getTitle().concat(" - ClustalW Alignment"),\r
700, 500); // JBPNote - is there a new window geom. property ?\r
}\r
g.setColor(Color.black);\r
g.drawString("Clustal Alignment Web Service running", 30,30);\r
}\r
-\r
-\r
- }\r
-\r
-\r
- public void pdbTest_actionPerformed(ActionEvent e)\r
- {\r
- String reply =\r
- JOptionPane.showInternalInputDialog(this, "Enter pdb code",\r
- "PDB test viewer", JOptionPane.QUESTION_MESSAGE);\r
-\r
- String url = "http://www.ebi.ac.uk/cgi-bin/pdbfetch?id=1a4u";\r
- if (reply.length()>1)\r
- url = "http://www.ebi.ac.uk/cgi-bin/pdbfetch?id="+reply;\r
-\r
- try\r
- {\r
- PDBfile pdb = new PDBfile(url,\r
- "URL");\r
- Sequence seq = (Sequence)viewport.getAlignment().getSequenceAt(0);\r
- seq.setPDBfile(pdb);\r
- ( (PDBChain) pdb.chains.elementAt(seq.maxchain)).isVisible = true;\r
- ( (PDBChain) pdb.chains.elementAt(seq.maxchain)).sequence = seq;\r
- // ( (PDBChain) pdb.chains.elementAt(seq.maxchain)).colourBySequence();\r
-\r
- rotCanvas rc = new rotCanvas(pdb);\r
- JInternalFrame frame = new JInternalFrame();\r
- frame.setContentPane(rc);\r
- Desktop.addInternalFrame(frame, url, 400,400);\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
-\r
}\r
\r
\r
public void doKeyPressed(KeyEvent evt)\r
{\r
-\r
- System.out.println(evt.getKeyChar());\r
if(evt.isControlDown() && evt.getKeyChar()=='f')\r
findMenuItem_actionPerformed(null);\r
-\r
}\r
\r
\r
boolean showBoxes=true;\r
boolean wrapAlignment=false;\r
boolean renderGaps = true;\r
+ boolean showSequenceFeatures = true;\r
\r
ColourSchemeI globalColourScheme = null;\r
boolean conservationColourSelected = false;\r
setFont( font );\r
}\r
\r
+ public void showSequenceFeatures(boolean b)\r
+ {\r
+ showSequenceFeatures = b;\r
+ }\r
\r
public String getVisibleConsensus()\r
{\r
import jalview.datamodel.*;\r
import jalview.schemes.*;\r
import java.awt.*;\r
+import java.util.*;\r
\r
public class DrawableSequence implements SequenceI {\r
protected boolean fastDraw = true;\r
\r
ColourSchemeI cs = null;\r
\r
+ public Vector sequenceFeatures = new Vector();\r
+ public void setSequenceFeatures(Vector v)\r
+ { sequenceFeatures = v; }\r
+ public Vector getSequenceFeatures()\r
+ {return sequenceFeatures; }\r
+\r
+ String pdbId;\r
+ public void setPDBId(String id)\r
+ { pdbId = id; }\r
+ public String getPDBId()\r
+ { return pdbId; }\r
+\r
+\r
public DrawableSequence(SequenceI s) {\r
this.sequence = s;\r
\r
--- /dev/null
+package jalview.gui;\r
+\r
+import jalview.datamodel.*;\r
+import jalview.schemes.*;\r
+import java.awt.*;\r
+import java.util.*;\r
+\r
+public class FeatureRenderer implements RendererI\r
+{\r
+ AlignViewport av;\r
+\r
+ SequenceGroup currentSequenceGroup = null;\r
+ SequenceGroup [] allGroups = null;\r
+ Color resBoxColour;\r
+ Graphics graphics;\r
+\r
+ public FeatureRenderer(AlignViewport av)\r
+ {\r
+ this.av = av;\r
+ }\r
+\r
+\r
+ public void drawSequence(Graphics g,SequenceI seq,SequenceGroup [] sg, int start, int end, int x1, int y1, int width, int height, Vector pid, int seqnum)\r
+ {\r
+ Vector features = seq.getSequenceFeatures();\r
+ Enumeration e = features.elements();\r
+ while( e.hasMoreElements() )\r
+ {\r
+ SequenceFeature sf = (SequenceFeature)e.nextElement();\r
+ int fstart = seq.findIndex(sf.getStart())-1;\r
+ int fend = seq.findIndex(sf.getEnd())-1;\r
+\r
+ if( (fstart>=start&&fstart<=end) || (fend>=start&&fend<=end))\r
+ {\r
+ if(fstart==fend)\r
+ {\r
+ g.setColor(Color.red);\r
+ g.fillRoundRect( (fstart - start) * width, y1, width, height, 4,4);\r
+ g.setColor(Color.white);\r
+\r
+ char s = seq.getSequence().charAt(fstart);\r
+ FontMetrics fm = g.getFontMetrics();\r
+ int charOffset = (width - fm.charWidth(s))/2;\r
+ int pady = height/5;\r
+ g.drawString(String.valueOf(s), charOffset + x1 + width * (fstart - start), y1 + height - pady);\r
+\r
+ }\r
+ else\r
+ {\r
+ for (int i = fstart; i <= fend; i++)\r
+ {\r
+ g.setColor(Color.blue);\r
+ g.fillRect( (i-start) * width, y1, width, height);\r
+\r
+ g.setColor(Color.white);\r
+ char s = seq.getSequence().charAt(i);\r
+ FontMetrics fm = g.getFontMetrics();\r
+ int charOffset = (width - fm.charWidth(s)) / 2;\r
+ int pady = height / 5;\r
+ g.drawString(String.valueOf(s),\r
+ charOffset + x1 + width * (i-start),\r
+ y1 + height - pady);\r
+\r
+ }\r
+ }\r
+ }\r
+\r
+ }\r
+ }\r
+\r
+}\r
if (javax.swing.SwingUtilities.isRightMouseButton(e))\r
{\r
jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(alignPanel,\r
- av.getAlignment().getSequenceAt(seq));\r
+ (Sequence)av.getAlignment().getSequenceAt(seq));\r
pop.show(this, e.getX(), y);\r
return;\r
}\r
import jalview.schemes.*;\r
import javax.swing.*;\r
import java.awt.event.*;\r
-\r
+import jalview.io.*;\r
+import MCview.*;\r
\r
public class PopupMenu extends JPopupMenu\r
{\r
JMenu residueMenu = new JMenu();\r
JMenuItem annotateResidue = new JMenuItem();\r
\r
- SequenceI sequence;\r
+ Sequence sequence;\r
JMenuItem unGroupMenuItem = new JMenuItem();\r
+ JMenuItem pdbMenuItem = new JMenuItem();\r
\r
- public PopupMenu(AlignmentPanel ap, SequenceI seq)\r
+ public PopupMenu(AlignmentPanel ap, Sequence seq)\r
{\r
///////////////////////////////////////////////////////////\r
// If this is activated from the sequence panel, the user may want to\r
unGroupMenuItem_actionPerformed(e);\r
}\r
});\r
+ pdbMenuItem.setText("View PDB structure");\r
+ pdbMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ pdbMenuItem_actionPerformed(e);\r
+ }\r
+ });\r
add(groupMenu);\r
this.add(sequenceMenu);\r
this.add(residueMenu);\r
defineMenu.add(conservationMenuItem);\r
\r
sequenceMenu.add(sequenceName);\r
+ sequenceMenu.add(pdbMenuItem);\r
residueMenu.add(annotateResidue);\r
\r
noColourmenuItem.setText("None");\r
ap.av.setRubberbandGroup(null);\r
ap.RefreshPanels();\r
}\r
+\r
+ void pdbMenuItem_actionPerformed(ActionEvent e)\r
+ {\r
+ if(sequence.getPDBId()==null)\r
+ return;\r
+\r
+ try\r
+ {\r
+ EBIFetchClient ebi = new EBIFetchClient();\r
+ String[] result = ebi.fetchData("pdb:" + sequence.getPDBId(), null, null);\r
+\r
+ PDBfile pdb = new PDBfile(result);\r
+ sequence.setPDBfile(pdb);\r
+\r
+ ( (PDBChain) pdb.chains.elementAt(sequence.maxchain)).isVisible = true;\r
+ ( (PDBChain) pdb.chains.elementAt(sequence.maxchain)).sequence = sequence;\r
+ // ( (PDBChain)pdb.chains.elementAt(sequence.maxchain)).colourBySequence();\r
+\r
+ rotCanvas rc = new rotCanvas(pdb);\r
+ JInternalFrame frame = new JInternalFrame();\r
+ frame.setContentPane(rc);\r
+ Desktop.addInternalFrame(frame,sequence.getName()+" "+ sequence.getPDBId(), 400, 400);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+\r
}\r
\r
public class SeqCanvas extends JPanel\r
{\r
+ FeatureRenderer fr;\r
Image img;\r
Graphics gg;\r
int imgWidth;\r
public SeqCanvas(AlignViewport av)\r
{\r
this.av = av;\r
+ fr = new FeatureRenderer(av);\r
setLayout(new BorderLayout());\r
PaintRefresher.Register(this);\r
\r
offset + AlignmentUtil.getPixelHeight(starty, i, av.getCharHeight()),\r
charWidth,charHeight,null, i);\r
\r
+ if(av.showSequenceFeatures)\r
+ {\r
+ fr.drawSequence(g, nextSeq, groups, x1, x2,\r
+ (x1 - startx) * charWidth,\r
+ offset +\r
+ AlignmentUtil.getPixelHeight(starty, i, av.getCharHeight()),\r
+ charWidth, charHeight, null, i);\r
+ }\r
+\r
+\r
+\r
\r
if( group!=null )\r
{\r
import java.awt.event.*;\r
import jalview.datamodel.*;\r
import javax.swing.*;\r
+import java.util.*;\r
import jalview.schemes.*;\r
import jalview.analysis.*;\r
\r
if(seq>=av.getAlignment().getHeight())\r
return;\r
\r
- Object obj = ResidueProperties.aa2Triplet.get( av.getAlignment().getSequenceAt(seq).getCharAt(res)+"" ) ;\r
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);\r
+ Object obj = ResidueProperties.aa2Triplet.get( sequence.getCharAt(res)+"" ) ;\r
String aa = "";\r
if(obj!=null)\r
aa = obj.toString();\r
\r
- StringBuffer text = new StringBuffer("Sequence " +(seq+1)+" ID: "+av.getAlignment().getSequenceAt(seq).getName());\r
+ StringBuffer text = new StringBuffer("Sequence " +(seq+1)+" ID: "+sequence.getName());\r
if(aa!="")\r
text.append(" Residue: "+aa+" ("+ av.getAlignment().getSequenceAt(seq).findPosition(res)+")");\r
\r
ap.alignFrame.statusBar.setText(text.toString());\r
\r
+ if(av.showSequenceFeatures)\r
+ {\r
+ Vector features = sequence.getSequenceFeatures();\r
+ Enumeration e = features.elements();\r
+ StringBuffer sbuffer = new StringBuffer();\r
+\r
+ this.setToolTipText(null);\r
+ while (e.hasMoreElements())\r
+ {\r
+ SequenceFeature sf = (SequenceFeature) e.nextElement();\r
+ if (sf.getStart() <= sequence.findPosition(res) &&\r
+ sf.getEnd() >= sequence.findPosition(res))\r
+ {\r
+ sbuffer.append(sf.getType() + " " + sf.getDescription());\r
+ ToolTipManager.sharedInstance().registerComponent(this);\r
+ this.setToolTipText(sbuffer.toString());\r
+ }\r
+\r
+ }\r
+ }\r
+\r
+\r
}\r
\r
public void doMouseDragged(MouseEvent evt) {\r
JMenuItem findMenuItem = new JMenuItem();\r
JMenu searchMenu = new JMenu();\r
protected JCheckBoxMenuItem abovePIDThreshold = new JCheckBoxMenuItem();\r
- protected JCheckBoxMenuItem secondaryStructure = new JCheckBoxMenuItem();\r
+ protected JCheckBoxMenuItem sequenceFeatures = new JCheckBoxMenuItem();\r
protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();\r
JMenuItem deleteGroups = new JMenuItem();\r
public GAlignFrame()\r
abovePIDThreshold_actionPerformed(e);\r
}\r
});\r
- secondaryStructure.setEnabled(false);\r
- secondaryStructure.setSelected(true);\r
- secondaryStructure.setText("Secondary Structure");\r
- secondaryStructure.addActionListener(new ActionListener()\r
+ sequenceFeatures.setSelected(true);\r
+ sequenceFeatures.setText("Sequence Features");\r
+ sequenceFeatures.addActionListener(new ActionListener()\r
{\r
public void actionPerformed(ActionEvent actionEvent)\r
{\r
- secondaryStructure_actionPerformed(actionEvent);\r
+ sequenceFeatures_actionPerformed(actionEvent);\r
}\r
});\r
nucleotideColour.setText("Nucleotide colours");\r
viewMenu.add(renderGapsMenuItem);\r
viewMenu.add(consensusGraphMenuItem);\r
viewMenu.add(overviewMenuItem);\r
- viewMenu.add(secondaryStructure);\r
+ viewMenu.add(sequenceFeatures);\r
colourMenu.add(noColourmenuItem);\r
colourMenu.add(clustalColour);\r
colourMenu.add(zappoColour);\r
\r
}\r
\r
- public void secondaryStructure_actionPerformed(ActionEvent actionEvent)\r
+ public void sequenceFeatures_actionPerformed(ActionEvent actionEvent)\r
{\r
\r
}\r