X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2FMCview%2FPDBViewer.java;h=b8027084309e417fbc24214ed697d1fb3e550810;hb=47168f025aefdaa044802bd5f8f510ffe43a4808;hp=c70bc6f3e0b9e7b446228779e49b9a35c093302e;hpb=5e1c62d9da464c55d118d4d1155545017bf6feb5;p=jalview.git
diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java
index c70bc6f..b802708 100755
--- a/src/MCview/PDBViewer.java
+++ b/src/MCview/PDBViewer.java
@@ -1,83 +1,92 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, 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
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * 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.
- *
- * 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 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 this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package MCview;
import java.io.*;
-import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import java.util.BitSet;
import jalview.datamodel.*;
import jalview.gui.*;
import jalview.io.*;
import jalview.schemes.*;
+import jalview.util.MessageManager;
+import jalview.ws.ebi.EBIFetchClient;
-import org.jmol.api.*;
-import org.jmol.adapter.smarter.SmarterJmolAdapter;
-import org.jmol.util.Logger;
-import org.jmol.popup.*;
-
-public class PDBViewer
- extends JInternalFrame implements Runnable
+public class PDBViewer extends JInternalFrame implements Runnable
{
- PDBEntry pdb;
+
/**
* The associated sequence in an alignment
*/
- Sequence sequence;
PDBCanvas pdbcanvas;
+
+ PDBEntry pdbentry;
+
+ SequenceI[] seq;
+
+ String[] chains;
+
+ AlignmentPanel ap;
+
+ String protocol;
+
String tmpPDBFile;
- public PDBViewer(PDBEntry entry,
- Sequence seq,
- SeqCanvas seqcanvas)
+ public PDBViewer(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
+ AlignmentPanel ap, String protocol)
{
- /* try
+ this.pdbentry = pdbentry;
+ this.seq = seq;
+ this.chains = chains;
+ this.ap = ap;
+ this.protocol = protocol;
+
+ try
{
jbInit();
- }
- catch (Exception ex)
+ } catch (Exception ex)
{
ex.printStackTrace();
}
- if (entry == null)
- {
- return;
- }
- pdb = entry;
- sequence = seq;
- pdbcanvas = new PDBCanvas(seqcanvas, sequence);
+ StringBuffer title = new StringBuffer(seq[0].getName() + ":"
+ + pdbentry.getFile());
+
+ pdbcanvas = new PDBCanvas();
- if (pdb.getFile() != null)
+ setContentPane(pdbcanvas);
+
+ if (pdbentry.getFile() != null)
{
try
{
- tmpPDBFile = pdb.getFile();
+ tmpPDBFile = pdbentry.getFile();
PDBfile pdbfile = new PDBfile(tmpPDBFile,
- jalview.io.AppletFormatAdapter.FILE);
- pdbcanvas.setPDBFile(pdbfile);
+ jalview.io.AppletFormatAdapter.FILE);
- }
- catch (java.io.IOException ex)
+ pdbcanvas.init(pdbentry, seq, chains, ap, protocol);
+
+ } catch (java.io.IOException ex)
{
ex.printStackTrace();
}
@@ -88,282 +97,41 @@ public class PDBViewer
worker.start();
}
- public void run()
- {
- try
- {
- EBIFetchClient ebi = new EBIFetchClient();
- String query = "pdb:" + pdb.getId();
- tmpPDBFile = ebi.fetchDataAsFile(query, "default", "raw").getAbsolutePath();
- if (tmpPDBFile != null)
- {
- PDBfile pdbfile = new PDBfile(tmpPDBFile,
- jalview.io.AppletFormatAdapter.FILE);
- pdbcanvas.setPDBFile(pdbfile);
- }
- else
- {
- throw new Exception("Empty result for WSDbFetch Query: " + query);
- }
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- showErrorMessage("Failed to retrieve PDB structure.");
-// this.dispose();
- }
- }
-
-
- setContentPane(pdbcanvas);
- StringBuffer title = new StringBuffer(sequence.getName() + ":" + pdb.getId());
- if (pdb.getProperty() != null)
+ if (pdbentry.getProperty() != null)
{
- if (pdb.getProperty().get("method") != null)
+ if (pdbentry.getProperty().get("method") != null)
{
title.append(" Method: ");
- title.append(pdb.getProperty().get("method"));
+ title.append(pdbentry.getProperty().get("method"));
}
- if (pdb.getProperty().get("chains") != null)
+ if (pdbentry.getProperty().get("chains") != null)
{
title.append(" Chain:");
- title.append(pdb.getProperty().get("chains"));
- }
- }
- */
-
- Container contentPane = getContentPane();
- JmolPanel jmolPanel = new JmolPanel();
- contentPane.add(jmolPanel);
-
- JmolViewer viewer = jmolPanel.viewer;
-
-
- System.out.println(entry.getFile()+" "+entry.getId());
- viewer.openFile(entry.getFile());
-
-
- StringBuffer string = new StringBuffer();
-
- for(int i=0; i") > -1 || data.indexOf("") > -1)
- )
+ if (!(data.indexOf("