X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FStructureFile.java;h=0bc6a73f40c5ebeb40b192b02a430f75fdbd156c;hb=5873fba98bc2a645aaebef32da0cb7dddb9d9de5;hp=97e11eb05db197b43cb7ce699922e845e76aaf73;hpb=12b5088afc51d015eb9c16f5d79b95918e0e1a5b;p=jalview.git diff --git a/src/jalview/io/StructureFile.java b/src/jalview/io/StructureFile.java index 97e11eb..0bc6a73 100644 --- a/src/jalview/io/StructureFile.java +++ b/src/jalview/io/StructureFile.java @@ -8,6 +8,7 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; import jalview.datamodel.PDBEntry; +import jalview.datamodel.PDBEntry.Type; import jalview.datamodel.SequenceI; import jalview.structure.StructureImportSettings; @@ -25,7 +26,7 @@ public abstract class StructureFile extends AlignFile private String id; - private String dbRefType; + private PDBEntry.Type dbRefType; /** * set to true to add derived sequence annotations (temp factor read from @@ -70,7 +71,7 @@ public abstract class StructureFile extends AlignFile this.visibleChainAnnotation = StructureImportSettings .isVisibleChainAnnotation(); this.predictSecondaryStructure = StructureImportSettings - .isPredictSecondaryStructure(); + .isProcessSecondaryStructure(); this.externalSecondaryStructure = StructureImportSettings .isExternalSecondaryStructure(); @@ -98,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) { @@ -116,9 +117,9 @@ public abstract class StructureFile extends AlignFile DBRefEntry sourceDBRef = new DBRefEntry(); sourceDBRef.setAccessionId(getId()); sourceDBRef.setSource(DBRefSource.PDB); - sourceDBRef.setStartRes(pdbSequence.getStart()); - sourceDBRef.setEndRes(pdbSequence.getEnd()); - pdbSequence.setSourceDBRef(sourceDBRef); + // TODO: specify version for 'PDB' database ref if it is read from a file. + // TODO: decide if jalview.io should be creating primary refs! + sourceDBRef.setVersion(""); pdbSequence.addPDBId(entry); pdbSequence.addDBRef(sourceDBRef); SequenceI chainseq = pdbSequence; @@ -136,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 @@ -264,16 +285,15 @@ public abstract class StructureFile extends AlignFile Class cl = Class.forName("jalview.ext.jmol.JmolParser"); if (cl != null) { - final Constructor constructor = cl.getConstructor(new Class[] { - boolean.class, boolean.class, boolean.class, FileParse.class }); - final Object[] args = new Object[] { visibleChainAnnotation, - predictSecondaryStructure, externalSecondaryStructure, - new FileParse(getDataName(), type) }; + final Constructor constructor = cl + .getConstructor(new Class[] { FileParse.class }); + final Object[] args = new Object[] { new FileParse(getDataName(), + type) }; StructureImportSettings.setShowSeqFeatures(false); StructureImportSettings.setVisibleChainAnnotation(false); StructureImportSettings - .setPredictSecondaryStructure(predictSecondaryStructure); + .setProcessSecondaryStructure(predictSecondaryStructure); StructureImportSettings .setExternalSecondaryStructure(externalSecondaryStructure); Object jmf = constructor.newInstance(args); @@ -401,13 +421,18 @@ public abstract class StructureFile extends AlignFile this.chains = chains; } - public String getDbRefType() + public Type getDbRefType() { return dbRefType; } public void setDbRefType(String dbRefType) { + this.dbRefType = Type.getType(dbRefType); + } + + public void setDbRefType(Type dbRefType) + { this.dbRefType = dbRefType; }