X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fgui%2FAppJmol.java;h=c18015ad9b1ae248a150b46d252c93dbf7e1291d;hb=1dabd11f09a42682d2b62d0a7bfccfd4114e07d9;hp=2137a8056e452f1653359ba7efef0bc11584c43e;hpb=2de8acfae59aced665e4c37ad0f7dcc2ed68818e;p=jalview.git diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index 2137a80..c18015a 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -1,20 +1,19 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) - * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) + * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Jalview. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ package jalview.gui; @@ -76,8 +75,10 @@ public class AppJmol extends GStructureViewer implements StructureListener, { this(file, id, seq, ap, loadStatus, bounds, null); } + public AppJmol(String file, String id, SequenceI[] seq, - AlignmentPanel ap, String loadStatus, Rectangle bounds, String viewid) + AlignmentPanel ap, String loadStatus, Rectangle bounds, + String viewid) { loadingFromArchive = true; pdbentry = new PDBEntry(); @@ -315,11 +316,27 @@ public class AppJmol extends GStructureViewer implements StructureListener, { try { - EBIFetchClient ebi = new EBIFetchClient(); - String query = "pdb:" + pdbentry.getId(); - pdbentry.setFile(ebi.fetchDataAsFile(query, "default", "raw") - .getAbsolutePath()); - initJmol("load " + pdbentry.getFile()); + // TODO: replace with reference fetching/transfer code (validate PDBentry + // as a DBRef?) + jalview.ws.dbsources.Pdb pdbclient = new jalview.ws.dbsources.Pdb(); + AlignmentI pdbseq; + if ((pdbseq = pdbclient.getSequenceRecords(pdbentry.getId())) != null) + { + // just transfer the file name from the first seuqence's first PDBEntry + pdbentry.setFile(((PDBEntry) pdbseq.getSequenceAt(0).getPDBId() + .elementAt(0)).getFile()); + initJmol("load " + pdbentry.getFile()); + } + else + { + JOptionPane + .showInternalMessageDialog( + Desktop.desktop, + pdbentry.getId() + + " could not be retrieved. Please try downloading the file manually.", + "Couldn't load file", JOptionPane.ERROR_MESSAGE); + + } } catch (OutOfMemoryError oomerror) { new OOMWarning("Retrieving PDB id " + pdbentry.getId() + " from MSD", @@ -379,7 +396,7 @@ public class AppJmol extends GStructureViewer implements StructureListener, * DOCUMENT ME! * * @param e - * DOCUMENT ME! + * DOCUMENT ME! */ public void eps_actionPerformed(ActionEvent e) { @@ -390,7 +407,7 @@ public class AppJmol extends GStructureViewer implements StructureListener, * DOCUMENT ME! * * @param e - * DOCUMENT ME! + * DOCUMENT ME! */ public void png_actionPerformed(ActionEvent e) { @@ -580,6 +597,7 @@ public class AppJmol extends GStructureViewer implements StructureListener, public void highlightAtom(int atomIndex, int pdbResNum, String chain, String pdbfile) { + // TODO: rna: remove CA dependency in select string if (!pdbfile.equals(pdbentry.getFile())) return; @@ -594,19 +612,22 @@ public class AppJmol extends GStructureViewer implements StructureListener, resetLastRes.setLength(0); resetLastRes.append("select " + pdbResNum); + eval.append(":"); + resetLastRes.append(":"); if (!chain.equals(" ")) { - eval.append(":" + chain); - resetLastRes.append(":" + chain); + eval.append(chain); + resetLastRes.append(chain); } - eval.append(";wireframe 100;" + eval.toString() + ".CA;"); + eval.append(";wireframe 100;" + eval.toString() + " and not hetero;"); // ".*;"); resetLastRes.append(";wireframe 0;" + resetLastRes.toString() - + ".CA;spacefill 0;"); + // + ".*;spacefill 0;"); + + " and not hetero;spacefill 0;"); eval.append("spacefill 200;select none"); - + // System.out.println("jmol:\n"+eval+"\n"); viewer.evalStringQuiet(eval.toString()); } @@ -973,12 +994,14 @@ public class AppJmol extends GStructureViewer implements StructureListener, } } } - String viewId=null; + + String viewId = null; + public String getViewId() { - if (viewId==null) + if (viewId == null) { - viewId=System.currentTimeMillis()+"."+this.hashCode(); + viewId = System.currentTimeMillis() + "." + this.hashCode(); } return viewId; }