fixed window title names for prediction on MSA or Sequence.
authorjprocter <Jim Procter>
Mon, 23 May 2005 17:45:51 +0000 (17:45 +0000)
committerjprocter <Jim Procter>
Mon, 23 May 2005 17:45:51 +0000 (17:45 +0000)
src/jalview/ws/JPredClient.java

index ba3186c..9f68dca 100755 (executable)
@@ -17,21 +17,25 @@ public class JPredClient
   int jobsRunning = 0;\r
   ext.vamsas.JpredSoapBindingStub server;\r
   WebserviceInfo wsInfo;\r
-\r
-  public JPredClient(SequenceI[] msf)\r
+  String altitle = "";\r
+  java.util.Hashtable SequenceInfo = null;\r
+  public JPredClient(String title, SequenceI[] msf)\r
   {\r
-    wsInfo = new WebserviceInfo("JNet secondary structure prediction job",\r
+    wsInfo = new WebserviceInfo("JNet secondary structure prediction on "+title,\r
           "\"Cuff J. A and Barton G.J (1999) Application of enhanced multiple sequence alignment profiles to improve protein secondary structure prediction, Proteins 40:502-511\".");\r
 \r
     SequenceI seq = msf[0];\r
-    wsInfo.setProgressText("Job details for MSA based prediction on sequence :\nName : "\r
-                   + seq.getName() + "\nSequence : "\r
+    altitle = "JNet prediction on "+seq.getName()+" using "+title;\r
+    wsInfo.setProgressText("Job details for MSA based prediction ("+title+") on sequence :\n>"\r
+                   + seq.getName() + "\n"\r
                    + AlignSeq.extractGaps("-. ",seq.getSequence()) + "\n");\r
 \r
+    SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
 \r
     JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default\r
+    // JBPNote url will be set from properties\r
     try {\r
-      this.server = (JpredSoapBindingStub) loc.getjpred(); // JBPNote will be set from properties\r
+      this.server = (JpredSoapBindingStub) loc.getjpred(new java.net.URL("http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred"));\r
     }\r
     catch (Exception ex) {\r
       wsInfo.setProgressText("Serious! JPred Service location failed\nfor URL :"\r
@@ -44,16 +48,18 @@ public class JPredClient
 \r
   public JPredClient(SequenceI seq)\r
   {\r
-    wsInfo = new WebserviceInfo("JNet secondary structure prediction job",\r
+    wsInfo = new WebserviceInfo("JNet secondary structure prediction Job",\r
                                 "\"Cuff J. A and Barton G.J (1999) Application of enhanced multiple sequence alignment profiles to improve protein secondary structure prediction, Proteins 40:502-511\".");\r
 \r
 \r
-    wsInfo.setProgressText("Job details for prediction on sequence :\nName : "\r
-                   + seq.getName() + "\nSequence : " + AlignSeq.extractGaps("-. ",seq.getSequence()) + "\n");\r
+    wsInfo.setProgressText("Job details for prediction on sequence :\n>"\r
+                   + seq.getName() + "\n" + AlignSeq.extractGaps("-. ",seq.getSequence()) + "\n");\r
+    altitle = "JNet prediction for sequence "+seq.getName();\r
+    SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
 // TODO: put proper url in\r
     JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default\r
     try {\r
-      this.server = (JpredSoapBindingStub) loc.getjpred(); // JBPNote will be set from properties\r
+      this.server = (JpredSoapBindingStub) loc.getjpred(new java.net.URL("http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred")); // JBPNote will be set from properties\r
     }\r
     catch (Exception ex) {\r
       wsInfo.setProgressText("Serious! JPred Service location failed\nfor URL :"\r
@@ -217,6 +223,9 @@ public class JPredClient
           FirstSeq = prediction.getQuerySeqPosition();\r
         }\r
 \r
+        if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash(al.getSequenceAt(FirstSeq), SequenceInfo))\r
+          throw (new Exception("Couldn't recover sequence properties for JNet Query sequence!"));\r
+\r
         AlignmentAnnotation annot;\r
         Annotation [] annotations = null;\r
         int i = 0;\r
@@ -224,8 +233,9 @@ public class JPredClient
 \r
 \r
         int[] gapmap = al.getSequenceAt(FirstSeq).gapMap();\r
+\r
         if (gapmap.length!=width) {\r
-          throw (new Exception("Jpred Client Error\nNumber of residues in supposed query sequence :\n"\r
+          throw (new Exception("Jnet Client Error\nNumber of residues in supposed query sequence :\n"\r
                                +al.getSequenceAt(FirstSeq).getName()+"\n"\r
                                +al.getSequenceAt(FirstSeq).getSequence()\r
                                +"\nDiffer from number of prediction sites in \n"+result.getPredfile()+"\n"));\r
@@ -293,7 +303,7 @@ public class JPredClient
 \r
 \r
         Desktop.addInternalFrame(af,\r
-                                 "JNet Prediction for sequence ",\r
+                                 altitle,\r
                                  AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
       }catch(Exception ex){ex.printStackTrace();}\r
 \r