JAL-3807 Fix SlivkaWSInstance not fetching alignments.
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 9 Jul 2021 14:44:53 +0000 (16:44 +0200)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 9 Jul 2021 14:44:53 +0000 (16:44 +0200)
src/jalview/ws/slivkaws/SlivkaJPredServiceInstance.java
src/jalview/ws/slivkaws/SlivkaMsaServiceInstance.java
src/jalview/ws/slivkaws/SlivkaWSInstance.java

index a614f02..00843fc 100644 (file)
@@ -36,7 +36,11 @@ public class SlivkaJPredServiceInstance extends SlivkaWSInstance
     try {
       files = client.getJobResults(jobId.getJobId());
       for (RemoteFile f : files) {
-        return readAlignment(f);
+        if (f.getMimeType().equals("application/clustal")
+            || f.getMimeType().equals("application/fasta"))
+        {
+          return readAlignment(f);
+        }
       }
     }
     catch (IOException e) {
index a04cff5..93c0bdb 100644 (file)
@@ -1,17 +1,22 @@
 package jalview.ws.slivkaws;
 
-import java.io.IOError;
-import java.io.IOException;
-import java.rmi.ServerError;
-import java.util.List;
-
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceI;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
+import jalview.io.FormatAdapter;
 import jalview.ws.api.JobId;
 import jalview.ws.api.MultipleSequenceAlignmentI;
 import jalview.ws.params.ArgumentI;
 import jalview.ws.params.InvalidArgumentException;
 import jalview.ws.params.WsParamSetI;
+
+import java.io.IOError;
+import java.io.IOException;
+import java.rmi.ServerError;
+import java.util.List;
+
+import compbio.data.msa.Category;
 import uk.ac.dundee.compbio.slivkaclient.RemoteFile;
 import uk.ac.dundee.compbio.slivkaclient.SlivkaClient;
 import uk.ac.dundee.compbio.slivkaclient.SlivkaService;
@@ -32,13 +37,16 @@ public class SlivkaMsaServiceInstance extends SlivkaWSInstance implements Multip
   @Override
   public AlignmentI getAlignmentFor(JobId jobId) throws InvalidArgumentException, ServerError, IOError
   {
-    List<RemoteFile> files;
     try
     {
-      files = client.getJobResults(jobId.getJobId());
+      List<RemoteFile> files = client.getJobResults(jobId.getJobId());
       for (RemoteFile f : files)
       {
-        return readAlignment(f);
+        if (f.getMimeType().equals("application/clustal") 
+            || f.getMimeType().equals("application/fasta"))
+        {
+          return readAlignment(f);
+        }
       }
     } catch (IOException e)
     {
index 8aa56fa..138b432 100644 (file)
@@ -252,9 +252,9 @@ public abstract class SlivkaWSInstance extends ServiceWithParameters
   {
     final var mimetype = f.getMimeType();
     FileFormat format;
-    if (mimetype == "application/clustal")
+    if (mimetype.equals("application/clustal"))
       format = FileFormat.Clustal;
-    else if (mimetype == "application/fasta")
+    else if (mimetype.equals("application/fasta"))
       format = FileFormat.Fasta;
     else
       return null;