/* * 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 * 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. * * 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 */ 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 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 { PDBEntry pdb; /** * The associated sequence in an alignment */ Sequence sequence; PDBCanvas pdbcanvas; String tmpPDBFile; public PDBViewer(PDBEntry entry, Sequence seq, SeqCanvas seqcanvas) { /* try { jbInit(); } catch (Exception ex) { ex.printStackTrace(); } if (entry == null) { return; } pdb = entry; sequence = seq; pdbcanvas = new PDBCanvas(seqcanvas, sequence); if (pdb.getFile() != null) { try { tmpPDBFile = pdb.getFile(); PDBfile pdbfile = new PDBfile(tmpPDBFile, jalview.io.AppletFormatAdapter.FILE); pdbcanvas.setPDBFile(pdbfile); } catch (java.io.IOException ex) { ex.printStackTrace(); } } else { Thread worker = new Thread(this); 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 (pdb.getProperty().get("method") != null) { title.append(" Method: "); title.append(pdb.getProperty().get("method")); } if (pdb.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) ) { out.println(data); } } out.close(); } catch (Exception ex) { ex.printStackTrace(); } } } }