X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FPdb.java;fp=src%2Fjalview%2Fws%2Fdbsources%2FPdb.java;h=982c399a62b7aeab93cd37ed9cac6bcc679682bb;hb=2595e9d4ee0dbbd3406a98c4e49a61ccde806479;hp=11fe95e36330a721254024d17bde26b939ecdb4d;hpb=e20075ba805d744d7cc4976e2b8d5e5840fb0a8d;p=jalview.git diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index 11fe95e..982c399 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -1,3 +1,4 @@ + /* * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) * Copyright (C) $$Year-Rel$$ The Jalview Authors @@ -28,12 +29,16 @@ import jalview.datamodel.DBRefSource; import jalview.datamodel.PDBEntry; import jalview.datamodel.PDBEntry.Type; import jalview.datamodel.SequenceI; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; +import jalview.io.FileFormatI; import jalview.io.FormatAdapter; import jalview.io.PDBFeatureSettings; 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; @@ -137,13 +142,19 @@ public class Pdb extends EbiFileRetrievedProxy stopQuery(); return null; } - String ext = StructureImportSettings.getDefaultStructureFileFormat() - .equalsIgnoreCase(Type.MMCIF.toString()) ? ".cif" : ".xml"; + + /* + * 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 fetchFormat = pdbFileFormat.getFormat(); + EBIFetchClient ebi = new EBIFetchClient(); - file = ebi.fetchDataAsFile( - "pdb:" + id, - StructureImportSettings.getDefaultStructureFileFormat() - .toLowerCase(), ext).getAbsolutePath(); + File tmpFile = ebi.fetchDataAsFile("pdb:" + id, fetchFormat, ext); + file = tmpFile.getAbsolutePath(); stopQuery(); if (file == null) { @@ -151,10 +162,11 @@ public class Pdb extends EbiFileRetrievedProxy } try { - + // todo get rid of Type and use FileFormatI instead? + FileFormatI fileFormat = (pdbFileFormat == Type.PDB) ? FileFormat.PDB + : FileFormat.MMCif; pdbAlignment = new FormatAdapter().readFile(file, - jalview.io.AppletFormatAdapter.FILE, - StructureImportSettings.getDefaultStructureFileFormat()); + DataSourceType.FILE, fileFormat); if (pdbAlignment != null) { List toremove = new ArrayList();