JAL-629 implementation of --tempfac options
[jalview.git] / src / jalview / io / StructureFile.java
index 3025907..c816f6d 100644 (file)
  */
 package jalview.io;
 
+import java.awt.Color;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.List;
+import java.util.Vector;
+
 import jalview.analysis.AlignSeq;
 import jalview.api.FeatureSettingsModelI;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentAnnotation.TFType;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.DBRefSource;
@@ -31,14 +38,7 @@ import jalview.datamodel.PDBEntry;
 import jalview.datamodel.PDBEntry.Type;
 import jalview.datamodel.SequenceI;
 import jalview.structure.StructureImportSettings;
-
-import java.awt.Color;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.List;
-import java.util.Vector;
-
-import MCview.PDBChain;
+import mc_view.PDBChain;
 
 public abstract class StructureFile extends AlignFile
 {
@@ -68,10 +68,16 @@ public abstract class StructureFile extends AlignFile
 
   private boolean pdbIdAvailable;
 
-  public StructureFile(String inFile, DataSourceType sourceType)
+  public StructureFile(Object inFile, DataSourceType sourceType)
           throws IOException
   {
-    super(inFile, sourceType);
+    this(inFile, sourceType, null);
+  }
+
+  public StructureFile(Object inFile, DataSourceType sourceType,
+          AlignmentAnnotation.TFType tempfacType) throws IOException
+  {
+    super(inFile, sourceType, tempfacType);
   }
 
   public StructureFile(FileParse fp) throws IOException
@@ -98,7 +104,7 @@ public abstract class StructureFile extends AlignFile
 
   }
 
-  public StructureFile(boolean parseImmediately, String dataObject,
+  public StructureFile(boolean parseImmediately, Object dataObject,
           DataSourceType sourceType) throws IOException
   {
     super(parseImmediately, dataObject, sourceType);
@@ -119,6 +125,7 @@ public abstract class StructureFile extends AlignFile
     pdbSequence.setName(getId() + "|" + pdbSequence.getName());
     PDBEntry entry = new PDBEntry();
     entry.setId(getId());
+    entry.setFakedPDBId(!isPPDBIdAvailable());
     entry.setType(getStructureFileType());
     if (chain.id != null)
     {
@@ -342,7 +349,14 @@ public abstract class StructureFile extends AlignFile
     StructureImportSettings.setShowSeqFeatures(true);
   }
 
-  public PDBChain findChain(String id) throws Exception
+  /**
+   * Answers the first PDBChain found matching the given id, or null if none is
+   * found
+   * 
+   * @param id
+   * @return
+   */
+  public PDBChain findChain(String id)
   {
     for (PDBChain chain : getChains())
     {
@@ -351,7 +365,7 @@ public abstract class StructureFile extends AlignFile
         return chain;
       }
     }
-    throw new Exception("PDB chain not Found!");
+    return null;
   }
 
   public void makeResidueList()