From 6fb093f228a5083b55f3b1f4886337540b3b3d42 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 7 Sep 2016 11:55:51 +0100 Subject: [PATCH] JAL-1803 JAL-1919 set type when structure file is parsed --- src/jalview/ext/jmol/JmolParser.java | 13 +++++++++++++ src/jalview/io/StructureFile.java | 22 +++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index 848e7db..2cb7559 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -22,6 +22,7 @@ package jalview.ext.jmol; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; +import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.io.FileParse; import jalview.io.StructureFile; @@ -97,6 +98,18 @@ public class JmolParser extends StructureFile implements JmolStatusListener */ if (jmolModel.ms.mc > 0) { + // ideally we do this + // try + // { + // setStructureFileType(jmolModel.evalString("show _fileType")); + // } catch (Exception q) + // { + // } + // ; + // instead, we distinguish .cif from non-.cif by filename + setStructureFileType(getDataName().toLowerCase().endsWith(".cif") ? PDBEntry.Type.MMCIF + .toString() : "PDB"); + transformJmolModelToJalview(jmolModel.ms); } } diff --git a/src/jalview/io/StructureFile.java b/src/jalview/io/StructureFile.java index 995e6d3..4a6a1c2 100644 --- a/src/jalview/io/StructureFile.java +++ b/src/jalview/io/StructureFile.java @@ -99,7 +99,7 @@ public abstract class StructureFile extends AlignFile pdbSequence.setName(getId() + "|" + pdbSequence.getName()); PDBEntry entry = new PDBEntry(); entry.setId(getId()); - entry.setType(this.dbRefType); + entry.setType(getStructureFileType()); entry.setProperty(new Hashtable()); if (chain.id != null) { @@ -137,6 +137,26 @@ public abstract class StructureFile extends AlignFile return chainseq; } + /** + * filetype of structure file - default is PDB + */ + String structureFileType = PDBEntry.Type.PDB.toString(); + + protected void setStructureFileType(String structureFileType) + { + this.structureFileType = structureFileType; + } + + /** + * filetype of last file processed + * + * @return + */ + public String getStructureFileType() + { + return structureFileType; + } + @SuppressWarnings({ "unchecked", "rawtypes" }) protected void processPdbFileWithAnnotate3d(List rna) throws Exception -- 1.7.10.2