if (av.isHiddenRepSequence(jal.getSequenceAt(i)))
{
- jalview.datamodel.SequenceI[] reps = av.getRepresentedSequences(jal.getSequenceAt(i)).getSequencesInOrder(jal);
+ jalview.datamodel.SequenceI[] reps = av.getRepresentedSequences(
+ jal.getSequenceAt(i)).getSequencesInOrder(jal);
for (int h = 0; h < reps.length; h++)
{
for (int smap = 0; smap < jmol.jmb.sequence[peid].length; smap++)
{
-// if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1)
- if (jds==jmol.jmb.sequence[peid][smap])
+ // if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1)
+ if (jds == jmol.jmb.sequence[peid][smap])
{
StructureState state = new StructureState();
state.setVisible(true);
an.setLabel(aa[i].label);
- if (aa[i] == av.getAlignmentQualityAnnot() || aa[i] == av.getAlignmentConservationAnnotation()
- || aa[i] == av.getAlignmentConsensusAnnotation() || aa[i].autoCalculated)
+ if (aa[i] == av.getAlignmentQualityAnnot()
+ || aa[i] == av.getAlignmentConservationAnnotation()
+ || aa[i] == av.getAlignmentConsensusAnnotation()
+ || aa[i].autoCalculated)
{
// new way of indicating autocalculated annotation -
an.setAutoCalculated(aa[i].autoCalculated);
an.setScore(aa[i].getScore());
}
- if (aa[i].getCalcId()!=null)
+ if (aa[i].getCalcId() != null)
{
calcIdSet.add(aa[i].getCalcId());
an.setCalcId(aa[i].getCalcId());
{
JGroup[] groups = new JGroup[jal.getGroups().size()];
int i = -1;
- for (jalview.datamodel.SequenceGroup sg:jal.getGroups())
+ for (jalview.datamodel.SequenceGroup sg : jal.getGroups())
{
groups[++i] = new JGroup();
fs.addSetting(setting);
settingsAdded.addElement(key);
}
- en = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups.keySet().iterator();
+ en = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups
+ .keySet().iterator();
Vector groupsAdded = new Vector();
while (en.hasNext())
{
vCalcIdParam.addServiceURL(settings.getServiceURI());
// generic URI allowing a third party to resolve another instance of the
// service used for this calculation
- for (String urls:settings.getServiceURLs())
+ for (String urls : settings.getServiceURLs())
{
vCalcIdParam.addServiceURL(urls);
}
// need to be able to recover 1) settings 2) user-defined presets or
// recreate settings from preset 3) predefined settings provided by
// service - or settings that can be transferred (or discarded)
- vCalcIdParam.setParameters(settings
- .getWsParamFile().replace("\n", "|\\n|"));
+ vCalcIdParam.setParameters(settings.getWsParamFile().replace("\n",
+ "|\\n|"));
vCalcIdParam.setAutoUpdate(settings.isAutoUpdate());
// todo - decide if updateImmediately is needed for any projects.
{
if (calcIdParam.getVersion().equals("1.0"))
{
- Jws2Instance service=Jws2Discoverer.getDiscoverer().getPreferredServiceFor(calcIdParam.getServiceURL());
- if (service!=null)
+ Jws2Instance service = Jws2Discoverer.getDiscoverer()
+ .getPreferredServiceFor(calcIdParam.getServiceURL());
+ if (service != null)
{
- WsParamSetI parmSet=null;
- try {
- parmSet = service.getParamStore().parseServiceParameterFile(calcIdParam.getName(), calcIdParam.getDescription(), calcIdParam.getServiceURL(), calcIdParam.getParameters().replace("|\\n|", "\n"));
+ WsParamSetI parmSet = null;
+ try
+ {
+ parmSet = service.getParamStore().parseServiceParameterFile(
+ calcIdParam.getName(), calcIdParam.getDescription(),
+ calcIdParam.getServiceURL(),
+ calcIdParam.getParameters().replace("|\\n|", "\n"));
} catch (IOException x)
{
- warn("Couldn't parse parameter data for "+calcIdParam.getCalcId(), x);
+ warn("Couldn't parse parameter data for "
+ + calcIdParam.getCalcId(), x);
return false;
}
- List<ArgumentI> argList=null;
- if (calcIdParam.getName().length()>0) {
- parmSet = service.getParamStore().getPreset(calcIdParam.getName());
- if (parmSet!=null)
+ List<ArgumentI> argList = null;
+ if (calcIdParam.getName().length() > 0)
+ {
+ parmSet = service.getParamStore()
+ .getPreset(calcIdParam.getName());
+ if (parmSet != null)
{
- // TODO : check we have a good match with settings in AACons - otherwise we'll need to create a new preset
+ // TODO : check we have a good match with settings in AACons -
+ // otherwise we'll need to create a new preset
}
}
- else {
+ else
+ {
argList = parmSet.getArguments();
- parmSet=null;
+ parmSet = null;
}
- AAConsSettings settings = new AAConsSettings(calcIdParam.isAutoUpdate(), service, parmSet, argList);
- av.setCalcIdSettingsFor(calcIdParam.getCalcId(), settings, calcIdParam.isNeedsUpdate());
+ AAConsSettings settings = new AAConsSettings(
+ calcIdParam.isAutoUpdate(), service, parmSet, argList);
+ av.setCalcIdSettingsFor(calcIdParam.getCalcId(), settings,
+ calcIdParam.isNeedsUpdate());
return true;
- } else {
+ }
+ else
+ {
warn("Cannot resolve a service for the parameters used in this project. Try configuring a JABAWS server.");
return false;
}
throw new Error("Unsupported Version for calcIdparam "
+ calcIdParam.toString());
}
+
/**
* External mapping between jalview objects and objects yielding a valid and
* unique object ID string. This is null for normal Jalview project IO, but
/**
* Construct a unique ID for jvobj using either existing bindings or if none
* exist, the result of the hashcode call for the object.
- *
+ *
* @param jvobj
* jalview data object
* @return unique ID for referring to jvobj
/**
* return local jalview object mapped to ID, if it exists
- *
+ *
* @param idcode
* (may be null)
* @return null or object bound to idcode
/**
* Load a jalview project archive from a jar file
- *
+ *
* @param file
* - HTTP URL or filename
*/
* initialise uniqueSetSuffix, seqRefIds, viewportsAdded and frefedSequence
* themselves. Any null fields will be initialised with default values,
* non-null fields are left alone.
- *
+ *
* @param jprovider
* @return
*/
}
;
out.close();
- String t=outFile.getAbsolutePath();
+ String t = outFile.getAbsolutePath();
alreadyLoadedPDB.put(pdbId, t);
return t;
}
/**
* Load alignment frame from jalview XML DOM object
- *
+ *
* @param object
* DOM
* @param file
hiddenSeqs = new Vector();
}
- hiddenSeqs.addElement(seqRefIds
- .get(seqId));
+ hiddenSeqs.addElement(seqRefIds.get(seqId));
}
}
}
if (an[i].hasBelowAlignment())
{
- jaa.belowAlignment=an[i].isBelowAlignment();
+ jaa.belowAlignment = an[i].isBelowAlignment();
}
jaa.setCalcId(an[i].getCalcId());
}
if (ids[p].getFile() != null)
{
- File mapkey=new File(ids[p].getFile());
+ File mapkey = new File(ids[p].getFile());
Object[] seqstrmaps = (Object[]) ((Hashtable) jmoldat[2])
.get(mapkey);
if (seqstrmaps == null)
{
- ((Hashtable) jmoldat[2]).put(
- mapkey,
+ ((Hashtable) jmoldat[2]).put(mapkey,
seqstrmaps = new Object[]
{ pdbFile, ids[p].getId(), new Vector(),
new Vector() });
{
newFileLoc = new StringBuffer();
}
- do {
+ do
+ {
// look for next filename in load statement
- newFileLoc.append(state.substring(cp,
- ncp = (state.indexOf("\"", ncp + 1) + 1)));
- String oldfilenam = state.substring(ncp,
- ecp = state.indexOf("\"", ncp));
- // recover the new mapping data for this old filename
- // have to normalize filename - since Jmol and jalview do filename
- // translation differently.
- Object[] filedat = oldFiles.get(new File(oldfilenam));
- newFileLoc.append(Platform.escapeString((String) filedat[0]));
- pdbfilenames.addElement((String) filedat[0]);
- pdbids.addElement((String) filedat[1]);
- seqmaps.addElement(((Vector<SequenceI>) filedat[2])
- .toArray(new SequenceI[0]));
- newFileLoc.append("\"");
- cp = ecp + 1; // advance beyond last \" and set cursor so we can
- // look for next file statement.
- } while ((ncp=state.indexOf("/*file*/",cp))>-1);
+ newFileLoc.append(state.substring(cp,
+ ncp = (state.indexOf("\"", ncp + 1) + 1)));
+ String oldfilenam = state.substring(ncp,
+ ecp = state.indexOf("\"", ncp));
+ // recover the new mapping data for this old filename
+ // have to normalize filename - since Jmol and jalview do
+ // filename
+ // translation differently.
+ Object[] filedat = oldFiles.get(new File(oldfilenam));
+ newFileLoc.append(Platform
+ .escapeString((String) filedat[0]));
+ pdbfilenames.addElement((String) filedat[0]);
+ pdbids.addElement((String) filedat[1]);
+ seqmaps.addElement(((Vector<SequenceI>) filedat[2])
+ .toArray(new SequenceI[0]));
+ newFileLoc.append("\"");
+ cp = ecp + 1; // advance beyond last \" and set cursor so we can
+ // look for next file statement.
+ } while ((ncp = state.indexOf("/*file*/", cp)) > -1);
}
if (cp > 0)
{
}
if (usetoColourbyseq)
{
- comp.useAlignmentPanelForColourbyseq(ap,
- !jmolColouring);
+ comp.useAlignmentPanelForColourbyseq(ap, !jmolColouring);
}
else
{
for (int i = 0; i < JSEQ.length; i++)
{
- af.viewport.setSequenceColour(af.viewport.getAlignment().getSequenceAt(i),
- new java.awt.Color(JSEQ[i].getColour()));
+ af.viewport.setSequenceColour(af.viewport.getAlignment()
+ .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour()));
}
af.viewport.gatherViewsHere = view.getGatheredViews();
if (view.getAnnotationColours().getColourScheme()
.equals("None"))
{
- cs = new AnnotationColourGradient(
- af.viewport.getAlignment().getAlignmentAnnotation()[i],
+ cs = new AnnotationColourGradient(af.viewport
+ .getAlignment().getAlignmentAnnotation()[i],
new java.awt.Color(view.getAnnotationColours()
.getMinColour()), new java.awt.Color(view
.getAnnotationColours().getMaxColour()),
else if (view.getAnnotationColours().getColourScheme()
.startsWith("ucs"))
{
- cs = new AnnotationColourGradient(
- af.viewport.getAlignment().getAlignmentAnnotation()[i],
+ cs = new AnnotationColourGradient(af.viewport
+ .getAlignment().getAlignmentAnnotation()[i],
GetUserColourScheme(jms, view
.getAnnotationColours().getColourScheme()),
view.getAnnotationColours().getAboveThreshold());
}
else
{
- cs = new AnnotationColourGradient(
- af.viewport.getAlignment().getAlignmentAnnotation()[i],
+ cs = new AnnotationColourGradient(af.viewport
+ .getAlignment().getAlignmentAnnotation()[i],
ColourSchemeProperty.getColour(al, view
.getAnnotationColours().getColourScheme()),
view.getAnnotationColours().getAboveThreshold());
{
for (int g = 0; g < al.getGroups().size(); g++)
{
- jalview.datamodel.SequenceGroup sg = al
- .getGroups().get(g);
+ jalview.datamodel.SequenceGroup sg = al.getGroups()
+ .get(g);
if (sg.cs == null)
{
* view.getAnnotationColours().getAboveThreshold()); } else
*/
{
- sg.cs = new AnnotationColourGradient(
- af.viewport.getAlignment().getAlignmentAnnotation()[i],
+ sg.cs = new AnnotationColourGradient(af.viewport
+ .getAlignment().getAlignmentAnnotation()[i],
sg.cs, view.getAnnotationColours()
.getAboveThreshold());
}
}
if (view.hasIgnoreGapsinConsensus())
{
- af.viewport.setIgnoreGapsConsensus(view
- .getIgnoreGapsinConsensus(), null);
+ af.viewport.setIgnoreGapsConsensus(view.getIgnoreGapsinConsensus(),
+ null);
}
if (view.hasFollowHighlight())
{
}
for (JvAnnotRow auan : autoAlan)
{
- visan.put(auan.template.label+(auan.template.getCalcId()==null ? "" : "\t"+auan.template.getCalcId()), auan);
+ visan.put(auan.template.label
+ + (auan.template.getCalcId() == null ? "" : "\t"
+ + auan.template.getCalcId()), auan);
}
int hSize = al.getAlignmentAnnotation().length;
ArrayList<JvAnnotRow> reorder = new ArrayList<JvAnnotRow>();
// work through any autoCalculated annotation already on the view
// removing it if it should be placed in a different location on the
// annotation panel.
- List<String> remains=new ArrayList(visan.keySet());
+ List<String> remains = new ArrayList(visan.keySet());
for (int h = 0; h < hSize; h++)
{
jalview.datamodel.AlignmentAnnotation jalan = al
if (jalan.autoCalculated)
{
String k;
- JvAnnotRow valan = visan.get(k=jalan.label);
- if (jalan.getCalcId()!=null)
+ JvAnnotRow valan = visan.get(k = jalan.label);
+ if (jalan.getCalcId() != null)
{
- valan = visan.get(k=jalan.label+ "\t"+jalan.getCalcId());
+ valan = visan.get(k = jalan.label + "\t" + jalan.getCalcId());
}
-
+
if (valan != null)
{
// delete the auto calculated row from the alignment
}
}
}
- // Add any (possibly stale) autocalculated rows that were not appended to the view during construction
- for (String other:remains)
+ // Add any (possibly stale) autocalculated rows that were not appended to
+ // the view during construction
+ for (String other : remains)
{
- JvAnnotRow othera=visan.get(other);
- if (othera!=nullAnnot && othera.template.getCalcId()!=null && othera.template.getCalcId().length()>0)
+ JvAnnotRow othera = visan.get(other);
+ if (othera != nullAnnot && othera.template.getCalcId() != null
+ && othera.template.getCalcId().length() > 0)
{
reorder.add(othera);
}
public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
{
Jws2Instance service;
+
@SuppressWarnings("unchecked")
protected SequenceAnnotation aaservice;
* reconfigure and restart the AAConsClient. 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);
}
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])
{
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.
*/