X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FPdb.java;h=982c399a62b7aeab93cd37ed9cac6bcc679682bb;hb=00918171094ad58563bd0b82e18ecf19537ba132;hp=68dda8862ff7240c56d012e4b47ef6f41445e1d1;hpb=2b6a2fdd887521f16ec777aab3126d6209f2a0a6;p=jalview.git diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index 68dda88..982c399 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -38,6 +38,7 @@ import jalview.structure.StructureImportSettings; import jalview.util.MessageManager; import jalview.ws.ebi.EBIFetchClient; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -141,12 +142,19 @@ public class Pdb extends EbiFileRetrievedProxy stopQuery(); return null; } + + /* + * ensure that an mmCIF format structure file is saved with extension.cif, + * because the Chimera "open" command recognises this extension + */ Type pdbFileFormat = StructureImportSettings .getDefaultStructureFileFormat(); - String ext = "." + pdbFileFormat.getExtension(); + String ext = pdbFileFormat.getExtension(); + String fetchFormat = pdbFileFormat.getFormat(); + EBIFetchClient ebi = new EBIFetchClient(); - file = ebi.fetchDataAsFile("pdb:" + id, pdbFileFormat.getFormat(), ext) - .getAbsolutePath(); + File tmpFile = ebi.fetchDataAsFile("pdb:" + id, fetchFormat, ext); + file = tmpFile.getAbsolutePath(); stopQuery(); if (file == null) { @@ -155,8 +163,7 @@ public class Pdb extends EbiFileRetrievedProxy try { // todo get rid of Type and use FileFormatI instead? - // todo get rid of "ext" and just use "tmp"? - FileFormatI fileFormat = pdbFileFormat == Type.PDB ? FileFormat.PDB + FileFormatI fileFormat = (pdbFileFormat == Type.PDB) ? FileFormat.PDB : FileFormat.MMCif; pdbAlignment = new FormatAdapter().readFile(file, DataSourceType.FILE, fileFormat);