X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAppJmolBinding.java;h=3f8175d204631cfb5e6a3a21c5b7ce3cf858dbc3;hb=efba321f20b819819c0b1cd9c9133d9d1a2ab314;hp=037b97e1ce9c889037047c5bbea7839cec939cd7;hpb=e17fd50136e5e56d2695002d00047281ca0fa4e3;p=jalview.git diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java index 037b97e..3f8175d 100644 --- a/src/jalview/gui/AppJmolBinding.java +++ b/src/jalview/gui/AppJmolBinding.java @@ -33,7 +33,7 @@ import org.openscience.jmol.app.jmolpanel.console.AppConsole; import jalview.api.AlignmentViewPanel; import jalview.api.structures.JalviewStructureDisplayI; -import jalview.bin.Cache; +import jalview.bin.Console; import jalview.datamodel.AlignmentI; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; @@ -91,7 +91,7 @@ public class AppJmolBinding extends JalviewJmolBinding jalview.util.BrowserLauncher.openURL(url); } catch (Exception e) { - Cache.log.error("Failed to launch Jmol-associated url " + url, e); + Console.error("Failed to launch Jmol-associated url " + url, e); // TODO: 2.6 : warn user if browser was not configured. } } @@ -214,7 +214,7 @@ public class AppJmolBinding extends JalviewJmolBinding { // todo - record which pdbids were successfully imported. StringBuilder errormsgs = new StringBuilder(); - + List files = new ArrayList<>(); String pdbid = ""; try @@ -222,45 +222,18 @@ public class AppJmolBinding extends JalviewJmolBinding String[] filesInViewer = getStructureFiles(); // TODO: replace with reference fetching/transfer code (validate PDBentry // as a DBRef?) - Pdb pdbclient = new Pdb(); - EBIAlfaFold afclient = new EBIAlfaFold(); - + for (int pi = 0; pi < getPdbCount(); pi++) { - String file = getPdbEntry(pi).getFile(); + PDBEntry strucEntry = getPdbEntry(pi); + + String file = strucEntry.getFile(); if (file == null) { - // todo: extract block as method and pull up (also ChimeraViewFrame) - // retrieve the pdb and store it locally - AlignmentI pdbseq = null; - PDBEntry strucEntry = getPdbEntry(pi); pdbid = strucEntry.getId(); - long hdl = pdbid.hashCode() - System.currentTimeMillis(); - structureViewer.setProgressMessage(MessageManager - .formatMessage("status.fetching_pdb", new String[] - { pdbid }), hdl); try { - if (afclient.isValidReference(pdbid)) - { - pdbseq = afclient.getSequenceRecords(pdbid); - } else { - if (strucEntry.hasRetrievalUrl()) - { - File tmpFile = File.createTempFile(pdbid, ".cif"); - String fromUrl = strucEntry.getRetrievalUrl(); - UrlDownloadClient.download(fromUrl, tmpFile); - - // may not need this check ? - file = tmpFile.getAbsolutePath(); - if (file != null) - { - pdbseq = EBIAlfaFold.importDownloadedStructureFromUrl(fromUrl,tmpFile,pdbid,null,null,null); - } - } else { - pdbseq = pdbclient.getSequenceRecords(pdbid); - } - } + file = structureViewer.fetchPdbFile(strucEntry); } catch (OutOfMemoryError oomerror) { new OOMWarning("Retrieving PDB id " + pdbid, oomerror); @@ -268,18 +241,10 @@ public class AppJmolBinding extends JalviewJmolBinding { ex.printStackTrace(); errormsgs.append("'").append(pdbid).append("'"); - } finally - { - structureViewer.setProgressMessage( - MessageManager.getString("label.state_completed"), hdl); } - if (pdbseq != null) + if (file != null) { - // just transfer the file name from the first sequence's first - // PDBEntry - file = new File(pdbseq.getSequenceAt(0).getAllPDBEntries() - .elementAt(0).getFile()).getAbsolutePath(); - getPdbEntry(pi).setFile(file); + // success files.add(file); } else