import jalview.analysis.SeqsetUtils;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
-import jalview.bin.Cache;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
-import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.IProgressIndicator;
import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.WsParamSetI;
-import java.awt.Color;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import com.sun.xml.internal.ws.client.ClientTransportException;
-
import compbio.data.msa.SequenceAnnotation;
import compbio.data.sequence.FastaSequence;
import compbio.data.sequence.Score;
public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
{
Jws2Instance service;
+
@SuppressWarnings("unchecked")
protected SequenceAnnotation aaservice;
}
/**
- * reconfigure and restart the AAConsClient. This method will spawn a new
+ * reconfigure and restart the AAConClient. This method will spawn a new
* thread that will wait until any current jobs are finished, modify the
* parameters and restart the conservation calculation with the new values.
- *
+ *
* @param newpreset
* @param newarguments
*/
int serverErrorsLeft = 3;
String rslt = "JOB NOT DEFINED";
- StringBuffer msg=new StringBuffer();
+ StringBuffer msg = new StringBuffer();
try
{
if (checkDone())
guiProgress.setProgressBar("JABA " + getServiceActionText(),
progressId = System.currentTimeMillis());
}
- if (preset == null && arguments==null)
+ if (preset == null && arguments == null)
{
rslt = aaservice.analize(seqs);
}
{
finished = true;
}
- if (calcMan.isPending(this) && this instanceof AAConsClient)
+ if (calcMan.isPending(this) && this instanceof AAConClient)
{
finished = true;
// cancel this job and yield to the new job
try
{
stats = aaservice.pullExecStatistics(rslt, rpos);
- } catch (Exception x)
+ } catch (Exception x)
{
if (x.getMessage().contains(
if (--serverErrorsLeft > 0)
{
retry = true;
- try {
+ try
+ {
Thread.sleep(200);
- } catch (InterruptedException q) {};
- } else {
+ } catch (InterruptedException q)
+ {
+ }
+ ;
+ }
+ else
+ {
throw x;
}
}
;
}
} while (!finished);
- if (serverErrorsLeft>0)
+ if (serverErrorsLeft > 0)
{
try
{
.debug("Updating result annotation from Job " + rslt
+ " at " + service.getUri());
updateResultAnnotation(true);
+ ap.adjustAnnotationHeight();
}
}
}
if (ap != null)
{
calcMan.workerComplete(this);
- if (guiProgress != null && progressId!=-1)
+ if (guiProgress != null && progressId != -1)
{
guiProgress.setProgressBar("", progressId);
}
ap.paintAlignment(true);
}
- if (msg.length()>0)
+ if (msg.length() > 0)
{
// TODO: stash message somewhere in annotation or alignment view.
// code below shows result in a text box popup
- /* jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer();
- cap.setText(msg.toString());
- jalview.gui.Desktop.addInternalFrame(cap, "Job Status for "+getServiceActionText(), 600, 400); */
+ /*
+ * jalview.gui.CutAndPasteTransfer cap = new
+ * jalview.gui.CutAndPasteTransfer(); cap.setText(msg.toString());
+ * jalview.gui.Desktop.addInternalFrame(cap,
+ * "Job Status for "+getServiceActionText(), 600, 400);
+ */
}
}
protected boolean bySequence = false;
Map<String, SequenceI> seqNames;
+
boolean[] gapMap;
+
int realw;
+
public List<FastaSequence> getInputSequences(AlignmentI alignment)
{
if (alignment == null || alignment.getWidth() <= 0
{
seqNames = new HashMap<String, SequenceI>();
}
- gapMap=new boolean[0];
+ gapMap = new boolean[0];
for (SequenceI sq : ((List<SequenceI>) alignment.getSequences()))
{
if (sq.getEnd() - sq.getStart() > minlen - 1)
FastaSequence seq;
if (submitGaps)
{
- seqs.add(seq = new compbio.data.sequence.FastaSequence(newname,sq.getSequenceAsString()));
- if (gapMap==null || gapMap.length<seq.getSequence().length())
+ seqs.add(seq = new compbio.data.sequence.FastaSequence(newname,
+ sq.getSequenceAsString()));
+ if (gapMap == null || gapMap.length < seq.getSequence().length())
{
- boolean[] tg=gapMap;
- gapMap=new boolean[seq.getLength()];
+ boolean[] tg = gapMap;
+ gapMap = new boolean[seq.getLength()];
System.arraycopy(tg, 0, gapMap, 0, tg.length);
- for (int p=tg.length;p<gapMap.length;p++)
+ for (int p = tg.length; p < gapMap.length; p++)
{
- gapMap[p]=false; // init as a gap
+ gapMap[p] = false; // init as a gap
}
}
- for (int apos:sq.gapMap()) {
- gapMap[apos]=true; // aligned.
+ for (int apos : sq.gapMap())
+ {
+ gapMap[apos] = true; // aligned.
}
- } else {
- seqs.add(seq = new compbio.data.sequence.FastaSequence(newname,
- AlignSeq
- .extractGaps(jalview.util.Comparison.GapChars,
- sq.getSequenceAsString())));
+ }
+ else
+ {
+ seqs.add(seq = new compbio.data.sequence.FastaSequence(newname,
+ AlignSeq.extractGaps(jalview.util.Comparison.GapChars,
+ sq.getSequenceAsString())));
}
if (seq.getSequence().length() > ln)
{
if (alignedSeqs && submitGaps)
{
realw = 0;
- for (int i=0;i<gapMap.length;i++)
+ for (int i = 0; i < gapMap.length; i++)
{
if (gapMap[i])
{
}
}
// try real hard to return something submittable
- // TODO: some of AAcons measures need a minimum of two or three amino
- // acids at each position, and aacons doesn't gracefully degrade.
+ // TODO: some of AAcon measures need a minimum of two or three amino
+ // acids at each position, and AAcon doesn't gracefully degrade.
for (int p = 0; p < seqs.size(); p++)
{
FastaSequence sq = seqs.get(p);
int l = sq.getSequence().length();
// strip gapped columns
- char[] padded = new char[realw],orig=sq.getSequence().toCharArray();
- for (int i=0,pp=0;i<realw; pp++)
+ char[] padded = new char[realw], orig = sq.getSequence()
+ .toCharArray();
+ for (int i = 0, pp = 0; i < realw; pp++)
{
if (gapMap[pp])
{
- if (orig.length>pp)
+ if (orig.length > pp)
{
- padded[i++]=orig[pp];
- } else {
- padded[i++]='-';
- }
+ padded[i++] = orig[pp];
+ }
+ else
+ {
+ padded[i++] = '-';
+ }
}
}
seqs.set(p, new compbio.data.sequence.FastaSequence(sq.getId(),
- new String(padded)));
+ new String(padded)));
}
}
return seqs;
/**
* notify manager that we have started, and wait for a free calculation slot
- *
+ *
* @return true if slot is obtained and work still valid, false if another
* thread has done our work for us.
*/
// annotation.setCalcId(calcId);
AlignmentAnnotation annotation = alignViewport.getAlignment()
.findOrCreateAnnotation(typeName, calcId, false, dseq, null);
- constructAnnotationFromScore(annotation, base, dseq.getLength(), scr);
- annotation.createSequenceMapping(dseq, dseq.findPosition(base), false);
+ constructAnnotationFromScore(annotation, 0, dseq.getLength(), scr);
+ annotation.createSequenceMapping(dseq, base, false);
annotation.adjustForAlignment();
dseq.addAlignmentAnnotation(annotation);
ourAnnot.add(annotation);
Annotation[] elm = new Annotation[alWidth];
Iterator<Float> vals = scr.getScores().iterator();
float m = 0f, x = 0f;
- for (int i = base; vals.hasNext(); i++)
+ for (int i = 0; vals.hasNext(); i++)
{
float val = vals.next().floatValue();
if (i == 0)