X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fstructure%2FStructureSelectionManager.java;h=6bb04abee84dcec1794ed2ff47daf7cdd335fdd0;hb=86e1bfc3ed99bee91069b3238eb291c3955338d3;hp=00b3143bf4585b979d7a78f9e538cf9f57c6d18e;hpb=f3da4113cd7d574966523982ed5145a918c63556;p=jalview.git diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 00b3143..6bb04ab 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -34,6 +34,7 @@ import jalview.datamodel.SearchResults; import jalview.datamodel.SequenceI; import jalview.gui.IProgressIndicator; import jalview.io.AppletFormatAdapter; +import jalview.io.StructureFile; import jalview.util.MappingUtils; import jalview.util.MessageManager; import jalview.ws.sifts.SiftsClient; @@ -319,12 +320,13 @@ public class StructureSelectionManager * - how to resolve data from resource * @return null or the structure data parsed as a pdb file */ - synchronized public PDBfile setMapping(SequenceI[] sequence, + synchronized public StructureFile setMapping(SequenceI[] sequence, String[] targetChains, String pdbFile, String protocol) { return setMapping(true, sequence, targetChains, pdbFile, protocol); } + /** * create sequence structure mappings between each sequence and the given * pdbFile (retrieved via the given protocol). @@ -343,7 +345,7 @@ public class StructureSelectionManager * - how to resolve data from resource * @return null or the structure data parsed as a pdb file */ - synchronized public PDBfile setMapping(boolean forStructureView, + synchronized public StructureFile setMapping(boolean forStructureView, SequenceI[] sequenceArray, String[] targetChainIds, String pdbFile, String protocol) @@ -378,12 +380,21 @@ public class StructureSelectionManager } } } - PDBfile pdb = null; + StructureFile pdb = null; boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts(); try { - pdb = new PDBfile(addTempFacAnnot, parseSecStr, secStructServices, - pdbFile, protocol); + + if (pdbFile != null && isCIFFile(pdbFile)) + { + pdb = new jalview.ext.jmol.JmolParser(addTempFacAnnot, parseSecStr, + secStructServices, pdbFile, protocol); + } + else + { + pdb = new PDBfile(addTempFacAnnot, parseSecStr, secStructServices, + pdbFile, protocol); + } if (pdb.getId() != null && pdb.getId().trim().length() > 0 && AppletFormatAdapter.FILE.equals(protocol)) @@ -525,8 +536,15 @@ public class StructureSelectionManager return pdb; } + private boolean isCIFFile(String filename) + { + String fileExt = filename.substring(filename.lastIndexOf(".") + 1, + filename.length()); + return "cif".equalsIgnoreCase(fileExt); + } + private StructureMapping getStructureMapping(SequenceI seq, - String pdbFile, String targetChainId, PDBfile pdb, + String pdbFile, String targetChainId, StructureFile pdb, PDBChain maxChain, jalview.datamodel.Mapping sqmpping, AlignSeq maxAlignseq) { @@ -560,7 +578,7 @@ public class StructureSelectionManager private StructureMapping getNWMappings(SequenceI seq, String pdbFile, - String maxChainId, PDBChain maxChain, PDBfile pdb, + String maxChainId, PDBChain maxChain, StructureFile pdb, AlignSeq maxAlignseq) { final StringBuilder mappingDetails = new StringBuilder(128);