/*
* 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
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
* @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)
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<viscontigs.length; contig += 2)
+ for (int contig = 0; contig < viscontigs.length; contig += 2)
{
-
- while (spos<gapMap.length && gapMap[spos]<viscontigs[contig]) {
+
+ while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
+ {
spos++;
}
- while (spos<gapMap.length && gapMap[spos]<=viscontigs[contig+1]) {
+ while (spos < gapMap.length && gapMap[spos] <= viscontigs[contig + 1])
+ {
delMap[i++] = spos++;
}
}
int tmap[] = new int[i];
System.arraycopy(delMap, 0, tmap, 0, i);
- delMap=tmap;
- }
+ delMap = tmap;
+ }
}
if (msa && msf.length > 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];
{
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);
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)
{
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++)
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)
{
}
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;
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();
}
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);
}
return server;
}
}
-