JAL-2103 proof of concept - patch to retrieve full width MSA.
authorJim Procter <jprocter@issues.jalview.org>
Tue, 10 May 2016 08:01:03 +0000 (09:01 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 10 May 2016 08:01:03 +0000 (09:01 +0100)
src/jalview/ws/jws1/JPredThread.java

index 7d60860..7176163 100644 (file)
@@ -179,10 +179,38 @@ class JPredThread extends JWS1Thread implements WSClientI
       }
       else
       {
-        al = new Alignment(preds);
-        FirstSeq = prediction.getQuerySeqPosition();
+        AlignmentI fullAlignment = null;
+        try
+        {
+          // locate full alignment
+          // http://www.compbio.dundee.ac.uk/jpred/results/jp_GuygEzV/jp_GuygEzV.full_MSA.fasta
+          String jobid = getJobId().substring(
+                  getJobId().lastIndexOf("/") + 1);
+          String job_alignment = "http://www.compbio.dundee.ac.uk/jpred/results/"
+                  + jobid + "/" + jobid + ".full_MSA.fasta";
+          fullAlignment = new FormatAdapter().readFile(job_alignment,
+                  FormatAdapter.URL, "FASTA");
+        } catch (Exception q)
+        {
+
+        } finally
+        {
+          if (fullAlignment != null)
+          {
+            al = fullAlignment;
+            FirstSeq = 0;
+          }
+          else
+          {
+            al = new Alignment(preds);
+            FirstSeq = prediction.getQuerySeqPosition();
+          }
+        }
+
         if (predMap != null)
         {
+          // map the prediction onto the query sequence, excluding positions
+          // corresponding to hidden regions in the original input.
           char gc = getGapChar();
           SequenceI[] sqs = (SequenceI[]) input
                   .getAlignmentAndColumnSelection(gc)[0];
@@ -192,16 +220,18 @@ class JPredThread extends JWS1Thread implements WSClientI
                     MessageManager
                             .getString("error.implementation_error_invalid_msa_index_for_job"));
           }
-
-          // ///
-          // Uses RemoveGapsCommand
-          // ///
-          new jalview.commands.RemoveGapsCommand(
-                  MessageManager.getString("label.remove_gaps"),
-                  new SequenceI[] { sqs[msaIndex] }, currentView);
-
-          SequenceI profileseq = al.getSequenceAt(FirstSeq);
-          profileseq.setSequence(sqs[msaIndex].getSequenceAsString());
+          if (fullAlignment == null)
+          {
+            // ///
+            // Uses RemoveGapsCommand
+            // ///
+            // new jalview.commands.RemoveGapsCommand(
+            // MessageManager.getString("label.remove_gaps"),
+            // new SequenceI[] { sqs[msaIndex] }, currentView);
+
+            SequenceI profileseq = al.getSequenceAt(FirstSeq);
+            profileseq.setSequence(sqs[msaIndex].getSequenceAsString());
+          }
         }
 
         if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash(
@@ -225,8 +255,11 @@ class JPredThread extends JWS1Thread implements WSClientI
           jalview.io.JnetAnnotationMaker.add_annotation(prediction, al,
                   FirstSeq, true, predMap);
           SequenceI profileseq = al.getSequenceAt(0); // this includes any gaps.
-          alignToProfileSeq(al, profileseq);
-          if (predMap != null)
+          if (fullAlignment == null)
+          {
+            alignToProfileSeq(al, profileseq);
+          }
+          if (fullAlignment == null && predMap != null)
           {
             // Adjust input view for gaps
             // propagate insertions into profile