JAL-2480 tidy generic initialisations, SequenceFeatures.varargToTypes
[jalview.git] / src / jalview / io / StructureFile.java
index d39ab38..7628115 100644 (file)
@@ -42,14 +42,8 @@ import MCview.PDBChain;
 
 public abstract class StructureFile extends AlignFile
 {
-
   private String id;
 
-  public enum StructureFileType
-  {
-    PDB, MMCIF, MMTF
-  };
-
   private PDBEntry.Type dbRefType;
 
   /**
@@ -398,8 +392,10 @@ public abstract class StructureFile extends AlignFile
 
   public static boolean isRNA(SequenceI seq)
   {
-    for (char c : seq.getSequence())
+    int length = seq.getLength();
+    for (int i = 0; i < length; i++)
     {
+      char c = seq.getCharAt(i);
       if ((c != 'A') && (c != 'C') && (c != 'G') && (c != 'U'))
       {
         return false;
@@ -412,7 +408,8 @@ public abstract class StructureFile extends AlignFile
    * make a friendly ID string.
    * 
    * @param dataName
-   * @return truncated dataName to after last '/'
+   * @return truncated dataName to after last '/' and pruned .extension if
+   *         present
    */
   protected String safeName(String dataName)
   {
@@ -421,6 +418,9 @@ public abstract class StructureFile extends AlignFile
     {
       dataName = dataName.substring(p + 1);
     }
+    if(dataName.indexOf(".") > -1){
+      dataName = dataName.substring(0, dataName.lastIndexOf("."));
+    }
     return dataName;
   }
 
@@ -488,20 +488,4 @@ public abstract class StructureFile extends AlignFile
   {
     this.pdbIdAvailable = pdbIdAvailable;
   }
-
-  public static boolean isStructureFile(String fileType)
-  {
-    if (fileType == null)
-    {
-      return false;
-    }
-    for (StructureFileType sfType : StructureFileType.values())
-    {
-      if (sfType.name().equalsIgnoreCase(fileType))
-      {
-        return true;
-      }
-    }
-    return false;
-  }
 }