Merge branch 'develop' into features/filetypeEnum
[jalview.git] / src / jalview / io / StructureFile.java
index 97e11eb..152a2c0 100644 (file)
@@ -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
@@ -47,9 +48,10 @@ public abstract class StructureFile extends AlignFile
 
   private Vector<PDBChain> chains;
 
-  public StructureFile(String inFile, String type) throws IOException
+  public StructureFile(String inFile, DataSourceType sourceType)
+          throws IOException
   {
-    super(inFile, type);
+    super(inFile, sourceType);
   }
 
   public StructureFile(FileParse fp) throws IOException
@@ -70,16 +72,16 @@ public abstract class StructureFile extends AlignFile
     this.visibleChainAnnotation = StructureImportSettings
             .isVisibleChainAnnotation();
     this.predictSecondaryStructure = StructureImportSettings
-            .isPredictSecondaryStructure();
+            .isProcessSecondaryStructure();
     this.externalSecondaryStructure = StructureImportSettings
             .isExternalSecondaryStructure();
 
   }
 
-  public StructureFile(boolean parseImmediately, String dataObject, String type)
-          throws IOException
+  public StructureFile(boolean parseImmediately, String dataObject,
+          DataSourceType sourceType) throws IOException
   {
-    super(parseImmediately, dataObject, type);
+    super(parseImmediately, dataObject, sourceType);
   }
 
   public StructureFile(boolean a, FileParse fp) throws IOException
@@ -116,8 +118,6 @@ 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);
     pdbSequence.addPDBId(entry);
     pdbSequence.addDBRef(sourceDBRef);
@@ -155,7 +155,7 @@ public abstract class StructureFile extends AlignFile
                 new Object[] {});
         AlignmentI al = ((AlignmentI) cl.getMethod("getRNAMLFor",
                 new Class[] { FileParse.class }).invoke(annotate3d,
-                new Object[] { new FileParse(getDataName(), type) }));
+                new Object[] { new FileParse(getDataName(), dataSourceType) }));
         for (SequenceI sq : al.getSequences())
         {
           if (sq.getDatasetSequence() != null)
@@ -268,12 +268,12 @@ public abstract class StructureFile extends AlignFile
             boolean.class, boolean.class, boolean.class, FileParse.class });
         final Object[] args = new Object[] { visibleChainAnnotation,
             predictSecondaryStructure, externalSecondaryStructure,
-            new FileParse(getDataName(), type) };
+            new FileParse(getDataName(), dataSourceType) };
 
         StructureImportSettings.setShowSeqFeatures(false);
         StructureImportSettings.setVisibleChainAnnotation(false);
         StructureImportSettings
-                .setPredictSecondaryStructure(predictSecondaryStructure);
+                .setProcessSecondaryStructure(predictSecondaryStructure);
         StructureImportSettings
                 .setExternalSecondaryStructure(externalSecondaryStructure);
         Object jmf = constructor.newInstance(args);
@@ -401,13 +401,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.valueOf(dbRefType);
+  }
+
+  public void setDbRefType(Type dbRefType)
+  {
     this.dbRefType = dbRefType;
   }