X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FJPredClient.java;h=2475fb1ec6ddd587c8ff1d1fab5ee4f07f0f3405;hb=d1279cb823245d1a412cd2f66771c6505ee538c4;hp=a4d8b1fa0d133432e4da53ee6c9b5bf134145848;hpb=a5481d6e853a962af603f4a21b171ba6fc9c200d;p=jalview.git diff --git a/src/jalview/ws/JPredClient.java b/src/jalview/ws/JPredClient.java index a4d8b1f..2475fb1 100755 --- a/src/jalview/ws/JPredClient.java +++ b/src/jalview/ws/JPredClient.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,31 +26,29 @@ import ext.vamsas.*; import jalview.analysis.*; import jalview.bin.*; import jalview.datamodel.*; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentView; import jalview.gui.*; -import jalview.io.*; -import jalview.util.*; -import jalview.ws.WSThread.*; -import vamsas.objects.simple.*; public class JPredClient extends WSClient { - /** - * crate a new GUI JPred Job - * @param sh ServiceHandle - * @param title String - * @param msa boolean - true - submit alignment as a sequence profile - * @param alview AlignmentView - * @param viewonly TODO - */ - public JPredClient(ext.vamsas.ServiceHandle sh, String title, boolean msa, AlignmentView alview, AlignFrame parentFrame, boolean viewonly) { + /** + * crate a new GUI JPred Job + * @param sh ServiceHandle + * @param title String + * @param msa boolean - true - submit alignment as a sequence profile + * @param alview AlignmentView + * @param viewonly TODO + */ + public JPredClient(ext.vamsas.ServiceHandle sh, String title, boolean msa, + AlignmentView alview, AlignFrame parentFrame, + boolean viewonly) + { super(); - wsInfo=setWebService(sh); + wsInfo = setWebService(sh); startJPredClient(title, msa, alview, parentFrame, viewonly); } + /** * startJPredClient * TODO: refine submission to cope with local prediction of visible regions or multiple single sequence jobs @@ -60,10 +58,11 @@ public class JPredClient * @param title String * @param msa boolean * @param alview AlignmentView - * @param viewonly if true then the prediction will be made just on the concatenated visible regions + * @param viewonly if true then the prediction will be made just on the concatenated visible regions */ private void startJPredClient(String title, boolean msa, - jalview.datamodel.AlignmentView alview, AlignFrame parentFrame, boolean viewonly) + jalview.datamodel.AlignmentView alview, + AlignFrame parentFrame, boolean viewonly) { AlignmentView input = alview; if (wsInfo == null) @@ -76,42 +75,47 @@ public class JPredClient Cache.log.warn("Couldn't find a Jpred webservice to invoke!"); return; } - SeqCigar[] msf=null; - SequenceI seq=null; - int[] delMap=null; + SeqCigar[] msf = null; + SequenceI seq = null; + int[] delMap = null; // original JNetClient behaviour - submit full length of sequence or profile // and mask result. msf = input.getSequences(); seq = msf[0].getSeq('-'); - if (viewonly) { + if (viewonly) + { int[] viscontigs = alview.getVisibleContigs(); - int spos=0; - int i=0; - if (viscontigs!=null) { - // Construct the delMap - mapping from the positions within the input to Jnet to the contigs in the original sequence - - delMap = new int[seq.getEnd()-seq.getStart()+1]; + int spos = 0; + int i = 0; + if (viscontigs != null) + { + // Construct the delMap - mapping from the positions within the input to Jnet to the contigs in the original sequence + + delMap = new int[seq.getEnd() - seq.getStart() + 1]; int gapMap[] = seq.gapMap(); - for (int contig = 0; contig 1) { - - String altitle = "JNet prediction on "+(viewonly?"visible ":"") + seq.getName() + + + String altitle = "JNet prediction on " + (viewonly ? "visible " : "") + + seq.getName() + " using alignment from " + title; SequenceI aln[] = new SequenceI[msf.length]; @@ -119,61 +123,74 @@ public class JPredClient { aln[i] = msf[i].getSeq('-'); } - - + Hashtable SequenceInfo = jalview.analysis.SeqsetUtils.uniquify(aln, true); - if (viewonly) { + if (viewonly) + { // Remove hidden regions from sequence objects. String seqs[] = alview.getSequenceStrings('-'); for (int i = 0, j = msf.length; i < j; i++) - { + { aln[i].setSequence(seqs[i]); - } + } seq.setSequence(seqs[0]); - } - wsInfo.setProgressText("Job details for "+(viewonly?"visible ":"")+"MSA based prediction (" + - title + ") on sequence :\n>" + seq.getName() + - "\n" + - AlignSeq.extractGaps("-. ", seq.getSequence()) + - "\n"); + } + wsInfo.setProgressText("Job details for " + (viewonly ? "visible " : "") + + "MSA based prediction (" + + title + ") on sequence :\n>" + seq.getName() + + "\n" + + AlignSeq.extractGaps("-. ", + seq.getSequenceAsString()) + + "\n"); JPredThread jthread = new JPredThread(wsInfo, altitle, server, - SequenceInfo, aln, delMap, alview, parentFrame, WsURL); + SequenceInfo, aln, delMap, alview, + parentFrame, WsURL); wsInfo.setthisService(jthread); jthread.start(); } else { - if (!msa && msf.length>1) + if (!msa && msf.length > 1) + { throw new Error("Implementation Error! Multiple single sequence prediction jobs are not yet supported."); - String altitle = "JNet prediction for "+(viewonly?"visible ":"")+"sequence " + seq.getName() + + } + String altitle = "JNet prediction for " + (viewonly ? "visible " : "") + + "sequence " + seq.getName() + " from " + title; String seqname = seq.getName(); Hashtable SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash( seq); - if (viewonly) { + if (viewonly) + { // Remove hidden regions from input sequence String seqs[] = alview.getSequenceStrings('-'); seq.setSequence(seqs[0]); - } - wsInfo.setProgressText("Job details for prediction on "+(viewonly?"visible ":"")+"sequence :\n>" + - seqname + "\n" + - AlignSeq.extractGaps("-. ", seq.getSequence()) + - "\n"); + } + wsInfo.setProgressText("Job details for prediction on " + + (viewonly ? "visible " : "") + "sequence :\n>" + + seqname + "\n" + + AlignSeq.extractGaps("-. ", + seq.getSequenceAsString()) + + "\n"); JPredThread jthread = new JPredThread(wsInfo, altitle, server, WsURL, - SequenceInfo, seq, delMap, alview, parentFrame); + SequenceInfo, seq, delMap, alview, + parentFrame); wsInfo.setthisService(jthread); jthread.start(); } } - public JPredClient(ext.vamsas.ServiceHandle sh, String title, SequenceI seq, AlignFrame parentFrame) + + public JPredClient(ext.vamsas.ServiceHandle sh, String title, SequenceI seq, + AlignFrame parentFrame) { super(); wsInfo = setWebService(sh); startJPredClient(title, seq, parentFrame); } - public JPredClient(ext.vamsas.ServiceHandle sh, String title, SequenceI[] msa, AlignFrame parentFrame) + public JPredClient(ext.vamsas.ServiceHandle sh, String title, SequenceI[] msa, + AlignFrame parentFrame) { wsInfo = setWebService(sh); startJPredClient(title, msa, parentFrame); @@ -189,7 +206,8 @@ public class JPredClient startJPredClient(title, seq, null); } - private void startJPredClient(String title, SequenceI[] msf, AlignFrame parentFrame) + private void startJPredClient(String title, SequenceI[] msf, + AlignFrame parentFrame) { if (wsInfo == null) { @@ -203,7 +221,7 @@ public class JPredClient wsInfo.setProgressText("Job details for MSA based prediction (" + title + ") on sequence :\n>" + seq.getName() + "\n" + - AlignSeq.extractGaps("-. ", seq.getSequence()) + + AlignSeq.extractGaps("-. ", seq.getSequenceAsString()) + "\n"); SequenceI aln[] = new SequenceI[msf.length]; for (int i = 0, j = msf.length; i < j; i++) @@ -214,17 +232,19 @@ public class JPredClient Hashtable SequenceInfo = jalview.analysis.SeqsetUtils.uniquify(aln, true); Jpred server = locateWebService(); - if (server==null) + if (server == null) { return; } - JPredThread jthread = new JPredThread(wsInfo, altitle, server, SequenceInfo, aln,null, null, parentFrame, WsURL); + JPredThread jthread = new JPredThread(wsInfo, altitle, server, SequenceInfo, + aln, null, null, parentFrame, WsURL); wsInfo.setthisService(jthread); jthread.start(); } - public void startJPredClient(String title, SequenceI seq, AlignFrame parentFrame) + public void startJPredClient(String title, SequenceI seq, + AlignFrame parentFrame) { if (wsInfo == null) { @@ -232,7 +252,7 @@ public class JPredClient } wsInfo.setProgressText("Job details for prediction on sequence :\n>" + seq.getName() + "\n" + - AlignSeq.extractGaps("-. ", seq.getSequence()) + + AlignSeq.extractGaps("-. ", seq.getSequenceAsString()) + "\n"); String altitle = "JNet prediction for sequence " + seq.getName() + " from " + title; @@ -240,12 +260,14 @@ public class JPredClient Hashtable SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq); Jpred server = locateWebService(); - if (server==null) + if (server == null) { return; } - JPredThread jthread = new JPredThread(wsInfo, altitle, server, WsURL, SequenceInfo, seq,null, null, parentFrame); + JPredThread jthread = new JPredThread(wsInfo, altitle, server, WsURL, + SequenceInfo, seq, null, null, + parentFrame); wsInfo.setthisService(jthread); jthread.start(); } @@ -269,11 +291,11 @@ public class JPredClient private ext.vamsas.Jpred locateWebService() { ext.vamsas.JpredServiceLocator loc = new JpredServiceLocator(); // Default - ext.vamsas.Jpred server=null; + ext.vamsas.Jpred server = null; try { server = loc.getjpred(new java.net.URL(WsURL)); // JBPNote will be set from properties - ( (JpredSoapBindingStub)server).setTimeout(60000); // one minute stub + ( (JpredSoapBindingStub) server).setTimeout(60000); // one minute stub //((JpredSoapBindingStub)this.server)._setProperty(org.apache.axis.encoding.C, Boolean.TRUE); } @@ -296,4 +318,3 @@ public class JPredClient return server; } } -