Merge branch 'feature/JAL-2909bamfiles_features' into features/JAL-2909_bamImport2_11
[jalview.git] / src / jalview / io / AppletFormatAdapter.java
index 5e209e6..da78420 100755 (executable)
@@ -147,6 +147,20 @@ public class AppletFormatAdapter
   public AlignmentI readFile(String file, DataSourceType sourceType,
           FileFormatI fileFormat) throws IOException
   {
+    if (alignFile == null)
+    {
+      prepareFileReader(file, sourceType, fileFormat);
+    }
+    else
+    {
+      alignFile.parse();
+    }
+    return buildAlignmentFromFile();
+  }
+  
+  public void prepareFileReader(String file, DataSourceType sourceType,
+          FileFormatI fileFormat) throws IOException
+  {
     this.inFile = file;
     try
     {
@@ -176,10 +190,9 @@ public class AppletFormatAdapter
       }
       else
       {
-        // alignFile = fileFormat.getAlignmentFile(inFile, sourceType);
         alignFile = fileFormat.getReader(new FileParse(inFile, sourceType));
       }
-      return buildAlignmentFromFile();
+      return;
     } catch (Exception e)
     {
       e.printStackTrace();
@@ -200,7 +213,7 @@ public class AppletFormatAdapter
           // Possible sequence is just residues with no label
           alignFile = new FastaFile(">UNKNOWN\n" + inFile,
                   DataSourceType.PASTE);
-          return buildAlignmentFromFile();
+          return;
 
         } catch (Exception ex)
         {