public static final String JALVIEW_ANNOTATION_ROW = "JalviewAnnotation";
/**
- * AlignmentAnnotation property to indicate that values should not be interpolated
+ * AlignmentAnnotation property to indicate that values should not be
+ * interpolated
*/
public static final String DISCRETE_ANNOTATION = "discrete";
+
/**
- * continuous property - optional to specify that annotation should be represented
- * as a continous graph line
+ * continuous property - optional to specify that annotation should be
+ * represented as a continous graph line
*/
private static final String CONTINUOUS_ANNOTATION = "continuous";
- private static final String THRESHOLD = "threshold";
-
+ private static final String THRESHOLD = "threshold";
Entry provEntry = null;
this.vobj2jv = vobj2jv;
this.jv2vobj = jv2vobj;
this.provEntry = provEntry;
- this.alignRDHash = alignRDHash;
+ this.alignRDHash = alignRDHash;
}
/**
* put the alignment viewed by AlignViewport into cdoc.
*
* @param av
- * alignViewport to be stored
+ * alignViewport to be stored
* @param aFtitle
- * title for alignment
+ * title for alignment
*/
public void storeVAMSAS(AlignViewport av, String aFtitle)
{
{
boolean dsmod = false;
// verify and update principal attributes.
- if (sq.getDescription()!=null && (sequence.getDescription()==null || !sequence.getDescription().equals(sq.getDescription())))
+ if (sq.getDescription() != null
+ && (sequence.getDescription() == null || !sequence
+ .getDescription().equals(sq.getDescription())))
{
sequence.setDescription(sq.getDescription());
dsmod = true;
}
- if (sequence.getSequence()==null || !sequence.getSequence().equals(sq.getSequenceAsString()))
+ if (sequence.getSequence() == null
+ || !sequence.getSequence().equals(
+ sq.getSequenceAsString()))
{
- if (sequence.getStart()!=sq.getStart() || sequence.getEnd()!=sq.getEnd())
+ if (sequence.getStart() != sq.getStart()
+ || sequence.getEnd() != sq.getEnd())
{
// update modified sequence.
sequence.setSequence(sq.getSequenceAsString());
}
}
if (!dict.equals(sequence.getDictionary()))
- {
+ {
sequence.setDictionary(dict);
dsmod = true;
}
for (int sf = 0; sf < sfSize; sf++)
{
- // TODO: update/modifiable synchronizer
+ // TODO: update/modifiable synchronizer
jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) sq
.getSequenceFeatures()[sf];
addProvenance(dsa.getProvenance(), "created"); // JBPNote - need
// to update
dsa.addSeqRef(sequence); // we have just created this annotation
- // - so safe to use this
+ // - so safe to use this
bindjvvobj(feature, dsa);
dataset.addDataSetAnnotations(dsa);
}
}
}
- if (dssmods.size()>0)
+ if (dssmods.size() > 0)
{
if (!nw)
{
- Entry pentry = this.addProvenance(dataset.getProvenance(), "updated sequences");
- // pentry.addInput(vInput); could write in which sequences were modified.
+ Entry pentry = this.addProvenance(dataset.getProvenance(),
+ "updated sequences");
+ // pentry.addInput(vInput); could write in which sequences were
+ // modified.
dssmods.removeAllElements();
}
}
// dataset.setProvenance(getVamsasProvenance(jal.getDataset().getProvenance()));
// ////////////////////////////////////////////
if (!av.getAlignment().isAligned())
- return; // TODO: trees could be written - but for the moment we just skip
+ return; // TODO: trees could be written - but for the moment we just
+ // skip
// ////////////////////////////////////////////
// Save the Alignments
- Alignment alignment = (Alignment) getjv2vObj(av.getSequenceSetId()); // this is so we can get
- // the alignviewport
- // back
+ Alignment alignment = (Alignment) getjv2vObj(av.getSequenceSetId()); // bind
+ // to
+ // the
+ // value
+ // used
+ // to
+ // associate
+ // different
+ // views
+ // to
+ // same
+ // alignment
+
if (alignment == null)
{
alignment = new Alignment();
alignment.setGapChar(String.valueOf(av.getGapCharacter()));
for (int i = 0; i < jal.getHeight(); i++)
{
- syncToAlignmentSequence(jal.getSequenceAt(i), alignment);
+ syncToAlignmentSequence(jal.getSequenceAt(i), alignment, null);
}
- alignRDHash.put(av.getSequenceSetId(),av.getUndoRedoHash());
+ alignRDHash.put(av.getSequenceSetId(), av.getUndoRedoHash());
}
else
{
- boolean alismod = av.isUndoRedoHashModified((long[]) alignRDHash.get(av.getSequenceSetId()));
+ // always prepare to clone the alignment
+ boolean alismod = av.isUndoRedoHashModified((long[]) alignRDHash
+ .get(av.getSequenceSetId()));
// todo: verify and update mutable alignment props.
// TODO: Use isLocked methods
- if (alignment.getModifiable() == null || alignment.getModifiable().length()==0)
+ if (alignment.getModifiable() == null
+ || alignment.getModifiable().length() == 0)
+ // && !alignment.isDependedOn())
{
boolean modified = false;
+ // check existing sequences in local and in document.
+ Vector docseqs = new Vector(alignment
+ .getAlignmentSequenceAsReference());
for (int i = 0; i < jal.getHeight(); i++)
{
- modified |= syncToAlignmentSequence(jal.getSequenceAt(i), alignment);
+ modified |= syncToAlignmentSequence(jal.getSequenceAt(i),
+ alignment, docseqs);
+ }
+ if (docseqs.size() > 0)
+ {
+ // removeValignmentSequences(alignment, docseqs);
+ docseqs.removeAllElements();
+ System.out
+ .println("Sequence deletion from alignment is not implemented.");
+
}
if (modified)
{
if (alismod)
{
// info in the undo
- addProvenance(alignment.getProvenance(), "Edited"); // TODO: insert something sensible here again
- }
- else {
+ addProvenance(alignment.getProvenance(), "Edited"); // TODO:
+ // insert
+ // something
+ // sensible
+ // here again
+ }
+ else
+ {
// info in the undo
- addProvenance(alignment.getProvenance(), "Attributes Edited"); // TODO: insert something sensible here again
+ addProvenance(alignment.getProvenance(), "Attributes Edited"); // TODO:
+ // insert
+ // something
+ // sensible
+ // here
+ // again
}
}
- System.out.println("update alignment in document.");
+ if (alismod)
+ {
+ System.out.println("update alignment in document.");
+ }
+ else
+ {
+ System.out.println("alignment in document left unchanged.");
+ }
}
else
{
+ // unbind alignment from view.
+ // create new binding and new alignment.
+ // mark trail on new alignment as being derived from old ?
System.out
.println("update edited alignment to new alignment in document.");
}
* if (valseqf.getProvenance() == null) { valseqf.setProvenance(new
* Provenance()); } addProvenance(valseqf.getProvenance(), "created"); //
* JBPNote - // need to // update bindjvvobj(features[i], valseqf);
- * valseq.addAlignmentSequenceAnnotation(valseqf); } }
- * }
+ * valseq.addAlignmentSequenceAnnotation(valseqf); } } }
*/
}
}
an.setDescription(aa[i].description);
alignment.addAlignmentAnnotation(an);
Seg vSeg = new Seg(); // TODO: refactor to have a default
- // rangeAnnotationType initer/updater that
- // takes a set of int ranges.
+ // rangeAnnotationType initer/updater that
+ // takes a set of int ranges.
vSeg.setStart(1);
vSeg.setInclusive(true);
vSeg.setEnd(jal.getWidth());
if (aa[i].graph != AlignmentAnnotation.NO_GRAPH)
{
an.setGroup(Integer.toString(aa[i].graphGroup)); // // JBPNote
- // -
+ // -
// originally we
// were going to
// store
// of
// utf8
// translation
- ae.addValue(aa[i].annotations[a].value);
+ if (an.isGraph())
+ {
+ ae.addValue(aa[i].annotations[a].value);
+ }
ae.setPosition(a + 1);
if (aa[i].annotations[a].secondaryStructure != ' ')
{
// modifiable flag is supposed to be used.
}
setAnnotationType(an, aa[i]);
-
+
if (aa[i].graph != jalview.datamodel.AlignmentAnnotation.NO_GRAPH)
{
an.setGraph(true);
an.setGroup(Integer.toString(aa[i].graphGroup));
- if (aa[i].threshold!=null && aa[i].threshold.displayed)
- an.addProperty(newProperty(THRESHOLD, "float", ""+aa[i].threshold.value));
- if (aa[i].threshold.label!=null)
- an.addProperty(newProperty(THRESHOLD+"Name", "string", ""+aa[i].threshold.label));
+ if (aa[i].threshold != null && aa[i].threshold.displayed)
+ {
+ an.addProperty(newProperty(THRESHOLD, "float", ""
+ + aa[i].threshold.value));
+ if (aa[i].threshold.label != null)
+ {
+ an.addProperty(newProperty(THRESHOLD + "Name",
+ "string", "" + aa[i].threshold.label));
+ }
}
-
}
-
+
+ }
+
else
{
if (an.getModifiable() == null) // TODO: USE VAMSAS LIBRARY OBJECT
- // LOCK METHODS)
+ // LOCK METHODS)
{
// verify annotation - update (perhaps)
Cache.log
}
}
+
+ /**
+ * remove docseqs from the given alignment marking provenance appropriately
+ * and removing any references to the sequences.
+ *
+ * @param alignment
+ * @param docseqs
+ */
+ private void removeValignmentSequences(Alignment alignment, Vector docseqs)
+ {
+ // delete these from document. This really needs to be a generic document
+ // API function derived by CASTOR.
+ Enumeration en = docseqs.elements();
+ while (en.hasMoreElements())
+ {
+ alignment.removeAlignmentSequence((AlignmentSequence) en
+ .nextElement());
+ }
+ Entry pe = addProvenance(alignment.getProvenance(), "Removed "
+ + docseqs.size() + " sequences");
+ en = alignment.enumerateAlignmentAnnotation();
+ Vector toremove = new Vector();
+ while (en.hasMoreElements())
+ {
+ uk.ac.vamsas.objects.core.AlignmentAnnotation alan = (uk.ac.vamsas.objects.core.AlignmentAnnotation) en
+ .nextElement();
+ if (alan.getSeqrefsCount() > 0)
+ {
+ int p = 0;
+ Vector storem = new Vector();
+ Enumeration sr = alan.enumerateSeqrefs();
+ while (sr.hasMoreElements())
+ {
+ Object alsr = sr.nextElement();
+ if (docseqs.contains(alsr))
+ {
+ storem.addElement(alsr);
+ }
+ }
+ // remove references to the deleted sequences
+ sr = storem.elements();
+ while (sr.hasMoreElements())
+ {
+ alan.removeSeqrefs(sr.nextElement());
+ }
+
+ if (alan.getSeqrefsCount() == 0)
+ {
+ // should then delete alan from dataset
+ toremove.addElement(alan);
+ }
+ }
+ }
+ // remove any annotation that used to be associated to a specific bunch of
+ // sequences
+ en = toremove.elements();
+ while (en.hasMoreElements())
+ {
+ alignment
+ .removeAlignmentAnnotation((uk.ac.vamsas.objects.core.AlignmentAnnotation) en
+ .nextElement());
+ }
+ // TODO: search through alignment annotations to remove any references to
+ // this alignment sequence
+ }
+
/**
- * sync a jalview alignment seuqence into a vamsas alignment
- * assumes all lock transformation/bindings have been sorted out before hand.
- * creates/syncs the vamsas alignment sequence for jvalsq and adds it to the alignment if necessary.
+ * sync a jalview alignment seuqence into a vamsas alignment assumes all lock
+ * transformation/bindings have been sorted out before hand. creates/syncs the
+ * vamsas alignment sequence for jvalsq and adds it to the alignment if
+ * necessary. unbounddocseq is a duplicate of the vamsas alignment sequences
+ * and these are removed after being processed w.r.t a bound jvalsq
+ *
*/
private boolean syncToAlignmentSequence(SequenceI jvalsq,
- Alignment alignment)
+ Alignment alignment, Vector unbounddocseq)
{
boolean modal = false;
// todo: islocked method here
- boolean up2doc=false;
+ boolean up2doc = false;
AlignmentSequence alseq = (AlignmentSequence) getjv2vObj(jvalsq);
- if (alseq==null)
+ if (alseq == null)
{
alseq = new AlignmentSequence();
up2doc = true;
}
- // boolean locked = (alignment.getModifiable()==null || alignment.getModifiable().length()>0);
+ else
+ {
+ if (unbounddocseq != null)
+ {
+ unbounddocseq.removeElement(alseq);
+ }
+ }
+ // boolean locked = (alignment.getModifiable()==null ||
+ // alignment.getModifiable().length()>0);
// TODO: VAMSAS: translate lowercase symbols to annotation ?
if (up2doc || !alseq.getSequence().equals(jvalsq.getSequenceAsString()))
{
modal = true;
alseq.setName(jvalsq.getName());
}
- if (jvalsq.getDescription()!=null && (alseq.getDescription()==null || !jvalsq.getDescription().equals(alseq.getDescription())))
+ if (jvalsq.getDescription() != null
+ && (alseq.getDescription() == null || !jvalsq.getDescription()
+ .equals(alseq.getDescription())))
{
modal = true;
alseq.setDescription(jvalsq.getDescription());
if (getjv2vObj(jvalsq.getDatasetSequence()) == null)
{
Cache.log
- .warn("Serious Implementation error - Unbound dataset sequence in alignment: "
- + jvalsq.getDatasetSequence());
+ .warn("Serious Implementation error - Unbound dataset sequence in alignment: "
+ + jvalsq.getDatasetSequence());
}
- alseq.setRefid(getjv2vObj(jvalsq
- .getDatasetSequence()));
+ alseq.setRefid(getjv2vObj(jvalsq.getDatasetSequence()));
if (up2doc)
{
-
+
alignment.addAlignmentSequence(alseq);
bindjvvobj(jvalsq, alseq);
}
return up2doc || modal;
}
+
/**
- * locally sync a jalview alignment seuqence from a vamsas alignment
- * assumes all lock transformation/bindings have been sorted out before hand.
- * creates/syncs the jvalsq from the alignment sequence
+ * locally sync a jalview alignment seuqence from a vamsas alignment assumes
+ * all lock transformation/bindings have been sorted out before hand.
+ * creates/syncs the jvalsq from the alignment sequence
*/
- private boolean syncFromAlignmentSequence(AlignmentSequence valseq, char valGapchar, char gapChar, Vector dsseqs)
-
+ private boolean syncFromAlignmentSequence(AlignmentSequence valseq,
+ char valGapchar, char gapChar, Vector dsseqs)
+
{
boolean modal = false;
// todo: islocked method here
- boolean upFromdoc=false;
+ boolean upFromdoc = false;
jalview.datamodel.SequenceI alseq = (SequenceI) getvObj2jv(valseq);
- if (alseq==null)
+ if (alseq == null)
{
upFromdoc = true;
}
if (alseq != null)
{
- // boolean locked = (alignment.getModifiable()==null || alignment.getModifiable().length()>0);
+ // boolean locked = (alignment.getModifiable()==null ||
+ // alignment.getModifiable().length()>0);
// TODO: VAMSAS: translate lowercase symbols to annotation ?
- if (upFromdoc || !valseq.getSequence().equals(alseq.getSequenceAsString()))
+ if (upFromdoc
+ || !valseq.getSequence().equals(alseq.getSequenceAsString()))
{
// this might go *horribly* wrong
alseq.setSequence(new String(valseq.getSequence()).replace(
modal = true;
alseq.setName(valseq.getName());
}
- if (alseq.getDescription()==null
- || (valseq.getDescription()==null
- || alseq.getDescription().equals(valseq.getDescription())))
+ if (alseq.getDescription() == null
+ || (valseq.getDescription() == null || alseq.getDescription()
+ .equals(valseq.getDescription())))
{
alseq.setDescription(valseq.getDescription());
modal = true;
}
else
{
- alseq = new jalview.datamodel.Sequence(valseq.getName(),
- valseq.getSequence().replace(valGapchar, gapChar),
- (int) valseq.getStart(), (int) valseq.getEnd());
+ alseq = new jalview.datamodel.Sequence(valseq.getName(), valseq
+ .getSequence().replace(valGapchar, gapChar), (int) valseq
+ .getStart(), (int) valseq.getEnd());
Vobject datsetseq = (Vobject) valseq.getRefid();
if (datsetseq != null)
{
- alseq
- .setDatasetSequence((SequenceI) getvObj2jv(datsetseq)); // exceptions
- // if
- // AlignemntSequence
- // reference
- // isn't
- // a
- // simple
- // SequenceI
+ alseq.setDatasetSequence((SequenceI) getvObj2jv(datsetseq)); // exceptions
+ // if
+ // AlignemntSequence
+ // reference
+ // isn't
+ // a
+ // simple
+ // SequenceI
}
else
{
{
modal = true;
}
- alseq
- .setDatasetSequence((SequenceI) getvObj2jv(datsetseq)); // exceptions
+ alseq.setDatasetSequence((SequenceI) getvObj2jv(datsetseq)); // exceptions
}
return upFromdoc || modal;
}
// the Jalview
// specific
// bits.
- if (alan.getThreshold()!=null && alan.getThreshold().displayed)
+ if (alan.getThreshold() != null && alan.getThreshold().displayed)
{
- an.addProperty(newProperty(THRESHOLD, "float", ""+alan.getThreshold().value));
- if (alan.getThreshold().label!=null)
- an.addProperty(newProperty(THRESHOLD+"Name", "string", ""+alan.getThreshold().label));
+ an.addProperty(newProperty(THRESHOLD, "float", ""
+ + alan.getThreshold().value));
+ if (alan.getThreshold().label != null)
+ an.addProperty(newProperty(THRESHOLD + "Name", "string", ""
+ + alan.getThreshold().label));
}
((DataSet) sref.getV_parent()).addDataSetAnnotations(an);
bindjvvobj(alan, an);
{
// update reference sequence Annotation
if (an.getModifiable() == null) // TODO: USE VAMSAS LIBRARY OBJECT LOCK
- // METHODS)
+ // METHODS)
{
// verify existing alignment sequence annotation is up to date
System.out.println("update dataset sequence annotation.");
* something extracted from another program, etc)
*/
an.setType(JALVIEW_ANNOTATION_ROW); // TODO: better fix
- // this rough guess ;)
+ // this rough guess ;)
alsref.addAlignmentSequenceAnnotation(an);
bindjvvobj(alan, an);
// These properties are directly supported by the
{
// update reference sequence Annotation
if (an.getModifiable() == null) // TODO: USE VAMSAS LIBRARY OBJECT LOCK
- // METHODS)
+ // METHODS)
{
// verify existing alignment sequence annotation is up to date
System.out.println("update alignment sequence annotation.");
/**
* set vamsas annotation object type from jalview annotation
+ *
* @param an
* @param alan
*/
- private void setAnnotationType(RangeAnnotation an, AlignmentAnnotation alan)
+ private void setAnnotationType(RangeAnnotation an,
+ AlignmentAnnotation alan)
{
if (an instanceof AlignmentSequenceAnnotation)
{
if (alan.graph != AlignmentAnnotation.NO_GRAPH)
{
- ((AlignmentSequenceAnnotation)an).setGraph(true);
- } else
+ ((AlignmentSequenceAnnotation) an).setGraph(true);
+ }
+ else
{
- ((AlignmentSequenceAnnotation)an).setGraph(false);
+ ((AlignmentSequenceAnnotation) an).setGraph(false);
}
}
if (an instanceof uk.ac.vamsas.objects.core.AlignmentAnnotation)
{
if (alan.graph != AlignmentAnnotation.NO_GRAPH)
{
- ((uk.ac.vamsas.objects.core.AlignmentAnnotation)an).setGraph(true);
- } else
+ ((uk.ac.vamsas.objects.core.AlignmentAnnotation) an).setGraph(true);
+ }
+ else
{
- ((uk.ac.vamsas.objects.core.AlignmentAnnotation)an).setGraph(false);
+ ((uk.ac.vamsas.objects.core.AlignmentAnnotation) an)
+ .setGraph(false);
}
}
switch (alan.graph)
{
- case AlignmentAnnotation.BAR_GRAPH:
- an.addProperty(newProperty(DISCRETE_ANNOTATION, "boolean","true"));
- break;
- case AlignmentAnnotation.LINE_GRAPH:
- an.addProperty(newProperty(CONTINUOUS_ANNOTATION, "boolean","true"));
- break;
- default:
- // don't add any kind of discrete or continous property info.
+ case AlignmentAnnotation.BAR_GRAPH:
+ an.addProperty(newProperty(DISCRETE_ANNOTATION, "boolean", "true"));
+ break;
+ case AlignmentAnnotation.LINE_GRAPH:
+ an.addProperty(newProperty(CONTINUOUS_ANNOTATION, "boolean", "true"));
+ break;
+ default:
+ // don't add any kind of discrete or continous property info.
}
}
* correctly create a RangeAnnotation from a jalview sequence feature
*
* @param dsa
- * (typically DataSetAnnotations or AlignmentSequenceAnnotation)
+ * (typically DataSetAnnotations or
+ * AlignmentSequenceAnnotation)
* @param feature
- * (the feature to be mapped from)
+ * (the feature to be mapped from)
* @return
*/
private RangeAnnotation getDSAnnotationFromJalview(RangeAnnotation dsa,
*
* @param visSeg
* @param ensureDirection
- * when true - always ensure start is less than end.
+ * when true - always ensure start is less than end.
* @return int[] { start, end, direction} where direction==1 for range running
* from end to start.
*/
{
SequenceI dsSeq = (SequenceI) getvObj2jv((Vobject) dseta
.getSeqRef(0)); // TODO: deal with group dataset
- // annotations
+ // annotations
if (dsSeq == null)
{
jalview.bin.Cache.log
{
uk.ac.vamsas.objects.core.Alignment alignment = dataset
.getAlignment(al);
- AlignViewport av=findViewport(alignment);
-
+ AlignViewport av = findViewport(alignment);
+
jalview.datamodel.AlignmentI jal = null;
if (av != null)
{
boolean refreshal = false;
Vector newasAnnots = new Vector();
char gapChar = ' '; // default for new alignments read in from the
- // document
+ // document
if (jal != null)
{
dsseqs = jal.getSequences(); // for merge/update
{
AlignmentSequence valseq = alignment.getAlignmentSequence(i);
jalview.datamodel.Sequence alseq = (jalview.datamodel.Sequence) getvObj2jv(valseq);
- if (syncFromAlignmentSequence(valseq, valGapchar, gapChar, dsseqs) && alseq!=null)
+ if (syncFromAlignmentSequence(valseq, valGapchar, gapChar,
+ dsseqs)
+ && alseq != null)
{
-
+
// updated to sequence from the document
jremain--;
refreshal = true;
for (int a = 0; a < vasannot.length; a++)
{
jalview.datamodel.AlignmentAnnotation asa = (jalview.datamodel.AlignmentAnnotation) getvObj2jv(vasannot[a]); // TODO:
- // 1:many
- // jalview
- // alignment
- // sequence
- // annotations
+ // 1:many
+ // jalview
+ // alignment
+ // sequence
+ // annotations
if (asa == null)
{
int se[] = getBounds(vasannot[a]);
asa = getjAlignmentAnnotation(jal, vasannot[a]);
asa.setSequenceRef(alseq);
asa.createSequenceMapping(alseq, se[0], false); // TODO:
- // verify
- // that
- // positions
- // in
- // alseqAnnotation
- // correspond
- // to
- // ungapped
- // residue
- // positions.
+ // verify
+ // that
+ // positions
+ // in
+ // alseqAnnotation
+ // correspond
+ // to
+ // ungapped
+ // residue
+ // positions.
alseq.addAlignmentAnnotation(asa);
bindjvvobj(asa, vasannot[a]);
newasAnnots.add(asa);
{
// update existing annotation - can do this in place
if (vasannot[a].getModifiable() == null) // TODO: USE
- // VAMSAS LIBRARY
- // OBJECT LOCK
- // METHODS)
+ // VAMSAS LIBRARY
+ // OBJECT LOCK
+ // METHODS)
{
Cache.log
.info("UNIMPLEMENTED: not recovering user modifiable sequence alignment annotation");
Cache.log
.debug("update from vamsas alignment annotation to existing jalview alignment annotation.");
if (an[j].getModifiable() == null) // TODO: USE VAMSAS
- // LIBRARY OBJECT LOCK
- // METHODS)
+ // LIBRARY OBJECT LOCK
+ // METHODS)
{
// TODO: user defined annotation is totally mutable... - so
// load it up or throw away if locally edited.
{
for (int p = 0, pe = alignment.getPropertyCount(); p < pe; p++)
{
- if (alignment.getProperty(p).getName().equals(
- "title"))
+ if (alignment.getProperty(p).getName().equals("title"))
{
title = alignment.getProperty(p).getContent();
}
// alignment using its provenance.
if (Cache.log.isDebugEnabled())
{
- title = title + "("
- + alignment.getVorbaId() + ")";
-
+ title = title + "(" + alignment.getVorbaId() + ")";
+
}
- jalview.gui.Desktop.addInternalFrame(alignFrame, title
- ,
+ jalview.gui.Desktop.addInternalFrame(alignFrame, title,
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
bindjvvobj(av.getSequenceSetId(), alignment);
}
this, alignFrame, alignment.getTree(t));
TreePanel tp = null;
if (vstree.isValidTree())
- {
- tp = alignFrame
- .ShowNewickTree(vstree.getNewickTree(), vstree
- .getTitle(), vstree.getInputData(), 600,
- 500, t * 20 + 50, t * 20 + 50);
-
+ {
+ tp = alignFrame.ShowNewickTree(vstree.getNewickTree(),
+ vstree.getTitle(), vstree.getInputData(), 600,
+ 500, t * 20 + 50, t * 20 + 50);
+
}
- if (tp!=null)
- {
+ if (tp != null)
+ {
bindjvvobj(tp, alignment.getTree(t));
try
{
vstree.UpdateSequenceTreeMap(tp);
} catch (RuntimeException e)
{
- Cache.log.warn("update of labels failed.",e);
+ Cache.log.warn("update of labels failed.", e);
}
}
else
{
- Cache.log.warn("Cannot create tree for tree "+t+" in document ("+alignment.getTree(t).getVorbaId());
+ Cache.log.warn("Cannot create tree for tree " + t
+ + " in document ("
+ + alignment.getTree(t).getVorbaId());
}
}
public AlignViewport findViewport(Alignment alignment)
{
- AlignViewport av=null;
- AlignViewport[] avs = findViewportForSequenceSetId((String)getvObj2jv(alignment));
- if (avs!=null)
+ AlignViewport av = null;
+ AlignViewport[] avs = findViewportForSequenceSetId((String) getvObj2jv(alignment));
+ if (avs != null)
{
av = avs[0];
}
{
if (frames[t] instanceof AlignFrame)
{
- if (((AlignFrame) frames[t]).getViewport().getSequenceSetId().equals(sequenceSetId))
+ if (((AlignFrame) frames[t]).getViewport().getSequenceSetId()
+ .equals(sequenceSetId))
{
viewp.addElement(((AlignFrame) frames[t]).getViewport());
}
}
}
- if (viewp.size()>0)
+ if (viewp.size() > 0)
{
AlignViewport[] vp = new AlignViewport[viewp.size()];
viewp.copyInto(vp);
{ new jalview.datamodel.Annotation[rangeMap.length],
new jalview.datamodel.Annotation[rangeMap.length] };
boolean mergeable = true; // false if 'after positions cant be placed on
- // same annotation row as positions.
+ // same annotation row as positions.
if (annotation.getAnnotationElementCount() > 0)
{
for (int aa = 0; aa < ae.length; aa++)
{
int pos = (int) ae[aa].getPosition() - 1; // pos counts from 1 to
- // (|seg.start-seg.end|+1)
+ // (|seg.start-seg.end|+1)
if (pos >= 0 && pos < rangeMap.length)
{
int row = ae[aa].getAfter() ? 1 : 0;
}
}
String dc = null; // ae[aa].getDisplayCharacter()==null ? "dc" :
- // ae[aa].getDisplayCharacter();
+ // ae[aa].getDisplayCharacter();
String ss = null; // ae[aa].getSecondaryStructure()==null ? "ss" :
- // ae[aa].getSecondaryStructure();
+ // ae[aa].getSecondaryStructure();
java.awt.Color colour = null;
if (ae[aa].getGlyphCount() > 0)
{
}
else
{
- Cache.log.debug("IMPLEMENTATION TODO: Ignoring unknown glyph type "
- + glyphs[g].getDict());
+ Cache.log
+ .debug("IMPLEMENTATION TODO: Ignoring unknown glyph type "
+ + glyphs[g].getDict());
}
}
}
anot[0][i] = anot[1][i];
anot[0][i].description = anot[0][i].description + " (after)";
AeContent[HASDESCSTR] = true; // we have valid description string
- // data
+ // data
anot[1][i] = null;
}
}
/**
* @param jal
- * the jalview alignment to which the annotation will be attached
- * (ideally - freshly updated from corresponding vamsas alignment)
+ * the jalview alignment to which the annotation will be
+ * attached (ideally - freshly updated from corresponding
+ * vamsas alignment)
* @param annotation
* @return unbound jalview alignment annotation object.
*/
Object[] parsedRangeAnnotation = parseRangeAnnotation(annotation);
String a_label = annotation.getLabel();
String a_descr = annotation.getDescription();
- GraphLine gl=null;
- int type=0;
- boolean interp=true; // cleared if annotation is DISCRETE
+ GraphLine gl = null;
+ int type = 0;
+ boolean interp = true; // cleared if annotation is DISCRETE
// set type and other attributes from properties
if (annotation.getPropertyCount() > 0)
{
// look for special jalview properties
- uk.ac.vamsas.objects.core.Property[] props = annotation
- .getProperty();
+ uk.ac.vamsas.objects.core.Property[] props = annotation.getProperty();
for (int p = 0; p < props.length; p++)
{
if (props[p].getName().equalsIgnoreCase(DISCRETE_ANNOTATION))
{
type = AlignmentAnnotation.BAR_GRAPH;
- interp=false;
- } else if
- (props[p].getName().equalsIgnoreCase(CONTINUOUS_ANNOTATION)) {
+ interp = false;
+ }
+ else if (props[p].getName().equalsIgnoreCase(CONTINUOUS_ANNOTATION))
+ {
type = AlignmentAnnotation.LINE_GRAPH;
- } else if
- (props[p].getName().equalsIgnoreCase(THRESHOLD))
+ }
+ else if (props[p].getName().equalsIgnoreCase(THRESHOLD))
{
- Float val=null;
- try {
+ Float val = null;
+ try
+ {
val = new Float(props[p].getContent());
- }catch (Exception e)
+ } catch (Exception e)
{
Cache.log.warn("Failed to parse threshold property");
}
- if (val!=null)
- if (gl==null)
- {
- gl = new GraphLine(val.floatValue(), "", java.awt.Color.black);
- } else
- {
- gl.value = val.floatValue();
- }
+ if (val != null)
+ if (gl == null)
+ {
+ gl = new GraphLine(val.floatValue(), "", java.awt.Color.black);
+ }
+ else
+ {
+ gl.value = val.floatValue();
+ }
}
- else if (props[p].getName().equalsIgnoreCase(THRESHOLD+"Name"))
+ else if (props[p].getName().equalsIgnoreCase(THRESHOLD + "Name"))
{
- if (gl==null)
+ if (gl == null)
gl = new GraphLine(0, "", java.awt.Color.black);
gl.label = props[p].getContent();
}
*/
if (has[HASVALS])
{
- if (type==0)
+ if (type == 0)
{
- type = jalview.datamodel.AlignmentAnnotation.BAR_GRAPH; // default type of value annotation
+ type = jalview.datamodel.AlignmentAnnotation.BAR_GRAPH; // default
+ // type of
+ // value
+ // annotation
if (has[HASHPHOB])
{
// no hints - so we ensure HPHOB display is like this.
if (!has[HASDC])
{
if (!interp)
- {
- if (arow[i].description!=null && arow[i].description.length()<3)
+ {
+ if (arow[i].description != null
+ && arow[i].description.length() < 3)
{
// copy over the description as the display char.
arow[i].displayCharacter = new String(arow[i].description);
}
- } else
- {
- // mark the position as a point used for the interpolation.
+ }
+ else
+ {
+ // mark the position as a point used for the interpolation.
arow[i].displayCharacter = arow[i].value + "";
- }
+ }
}
}
}
}
else
{
- if (annotation.getAnnotationElementCount()==0)
+ if (annotation.getAnnotationElementCount() == 0)
{
// empty annotation array
- // TODO: alignment 'features' compare rangeType spec to alignment width - if it is not complete, then mark regions on the annotation row.
+ // TODO: alignment 'features' compare rangeType spec to alignment
+ // width - if it is not complete, then mark regions on the annotation
+ // row.
}
jan = new jalview.datamodel.AlignmentAnnotation(a_label, a_descr,
arow);
Cache.log.warn("Ignoring " + annotation.getLinkCount()
+ "links added to AlignmentAnnotation.");
}
- if (annotation.getModifiable() == null || annotation.getModifiable().length()==0) // TODO: USE VAMSAS LIBRARY OBJECT
- // LOCK METHODS)
+ if (annotation.getModifiable() == null
+ || annotation.getModifiable().length() == 0) // TODO: USE VAMSAS
+ // LIBRARY OBJECT
+ // LOCK METHODS)
{
jan.editable = true;
}
if (annotation.getGroup() != null
&& annotation.getGroup().length() > 0)
{
- jan.graphGroup = Integer.parseInt(annotation.getGroup()); // TODO: group similarly named annotation together ?
+ jan.graphGroup = Integer.parseInt(annotation.getGroup()); // TODO:
+ // group
+ // similarly
+ // named
+ // annotation
+ // together
+ // ?
}
} catch (Exception e)
{
/**
*
* @param maprange
- * where the from range is the local mapped range, and the to range
- * is the 'mapped' range in the MapRangeType
+ * where the from range is the local mapped range, and the to
+ * range is the 'mapped' range in the MapRangeType
* @param default
- * unit for local
+ * unit for local
* @param default
- * unit for mapped
+ * unit for mapped
* @return MapList
*/
private jalview.util.MapList parsemapType(MapType maprange, int localu,