/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
import jalview.bin.Cache;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.GraphLine;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.io.vamsas.DatastoreItem;
import jalview.io.vamsas.DatastoreRegistry;
import jalview.io.vamsas.Rangetype;
+import jalview.util.MapList;
import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
import java.io.IOException;
import java.util.Enumeration;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import java.util.Vector;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
-import uk.ac.vamsas.client.*;
-import uk.ac.vamsas.objects.core.*;
+import uk.ac.vamsas.client.IClientAppdata;
+import uk.ac.vamsas.client.IClientDocument;
+import uk.ac.vamsas.client.Vobject;
+import uk.ac.vamsas.client.VorbaId;
+import uk.ac.vamsas.objects.core.Alignment;
+import uk.ac.vamsas.objects.core.AlignmentSequence;
+import uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation;
+import uk.ac.vamsas.objects.core.AnnotationElement;
+import uk.ac.vamsas.objects.core.DataSet;
+import uk.ac.vamsas.objects.core.DataSetAnnotations;
+import uk.ac.vamsas.objects.core.DbRef;
+import uk.ac.vamsas.objects.core.Entry;
+import uk.ac.vamsas.objects.core.Glyph;
+import uk.ac.vamsas.objects.core.Local;
+import uk.ac.vamsas.objects.core.MapType;
+import uk.ac.vamsas.objects.core.Mapped;
+import uk.ac.vamsas.objects.core.Property;
+import uk.ac.vamsas.objects.core.Provenance;
+import uk.ac.vamsas.objects.core.RangeAnnotation;
+import uk.ac.vamsas.objects.core.RangeType;
+import uk.ac.vamsas.objects.core.Seg;
+import uk.ac.vamsas.objects.core.Sequence;
+import uk.ac.vamsas.objects.core.SequenceType;
+import uk.ac.vamsas.objects.core.VAMSAS;
import uk.ac.vamsas.objects.utils.Properties;
/*
private void buildSkipList()
{
skipList = new Hashtable();
- AlignFrame[] al = Desktop.getAlignframes();
+ AlignFrame[] al = Desktop.getAlignFrames();
for (int f = 0; al != null && f < al.length; f++)
{
skipList.put(al[f].getViewport().getSequenceSetId(), al[f]);
{
try
{
- jalview.datamodel.AlignmentI jal = av.getAlignment();
- jalview.datamodel.AlignmentI jds = jal.getDataset();
+ AlignmentI jal = av.getAlignment();
+ AlignmentI jds = jal.getDataset();
boolean nw = false;
VAMSAS root = null; // will be resolved based on Dataset Parent.
// /////////////////////////////////////////
// SAVE ANNOTATIONS
if (jal.getAlignmentAnnotation() != null)
{
- jalview.datamodel.AlignmentAnnotation[] aa = jal
+ AlignmentAnnotation[] aa = jal
.getAlignmentAnnotation();
java.util.HashMap AlSeqMaps = new HashMap(); // stores int maps from
// alignment columns to
}
setAnnotationType(an, aa[i]);
- if (aa[i].graph != jalview.datamodel.AlignmentAnnotation.NO_GRAPH)
+ if (aa[i].graph != AlignmentAnnotation.NO_GRAPH)
{
an.setGraph(true);
an.setGroup(Integer.toString(aa[i].graphGroup));
* @return true if alignment associated with this view will be stored in
* document.
*/
- public boolean alignmentWillBeSkipped(AlignViewport av)
+ public boolean alignmentWillBeSkipped(AlignmentViewport av)
{
return (!av.getAlignment().isAligned());
}
- private void addToSkipList(AlignViewport av)
+ private void addToSkipList(AlignmentViewport av)
{
if (skipList == null)
{
// of
// utf8
// translation
- if (alan.graph != jalview.datamodel.AlignmentAnnotation.NO_GRAPH)
+ if (alan.graph != AlignmentAnnotation.NO_GRAPH)
{
ae.addValue(alan.annotations[a].value);
}
an.addProperty(Properties.newProperty(THRESHOLD,
Properties.FLOATTYPE, "" + alan.getThreshold().value));
if (alan.getThreshold().label != null)
+ {
an.addProperty(Properties.newProperty(THRESHOLD + "Name",
Properties.STRINGTYPE, "" + alan.getThreshold().label));
+ }
}
((DataSet) sref.getV_parent()).addDataSetAnnotations(an);
bindjvvobj(alan, an);
@Override
public JarInputStream getJarInputStream() throws IOException
{
- jalview.bin.Cache.log
+ Cache.log
.debug("Returning client input stream for Jalview from Vamsas Document.");
return new JarInputStream(cappdata.getClientInputStream());
}
@Override
public JarInputStream getJarInputStream() throws IOException
{
- jalview.bin.Cache.log
+ Cache.log
.debug("Returning user input stream for Jalview from Vamsas Document.");
return new JarInputStream(cappdata.getUserInputStream());
}
// sync,
// and if any contain more than one view, then remove the one generated by
// document update.
- AlignViewport views[], av = null;
+ AlignmentViewport views[], av = null;
AlignFrame af = null;
Iterator newviews = newAlignmentViews.iterator();
while (newviews.hasNext())
{
- av = (AlignViewport) newviews.next();
+ av = (AlignmentViewport) newviews.next();
af = Desktop.getAlignFrameFor(av);
// TODO implement this : af.getNumberOfViews
String seqsetidobj = av.getSequenceSetId();
// to the align frames.
boolean gathered = false;
String newviewid = null;
- AlignedCodonFrame[] mappings = av.getAlignment().getCodonFrames();
+ Set<AlignedCodonFrame> mappings = av.getAlignment()
+ .getCodonFrames();
for (int i = 0; i < views.length; i++)
{
if (views[i] != av)
{
// ensure sequence mappings from vamsas document view still
// active
- if (mappings != null && mappings.length > 0)
+ if (mappings != null)
{
jalview.structure.StructureSelectionManager
.getStructureSelectionManager(Desktop.instance)
} catch (Exception e)
{
// TODO raise GUI warning if user requests it.
- jalview.bin.Cache.log
+ Cache.log
.error("Couldn't update jalview client application data. Giving up - local settings probably lost.",
e);
}
}
else
{
- jalview.bin.Cache.log
+ Cache.log
.error("Couldn't access client application data for vamsas session. This is probably a vamsas client bug.");
}
}
// annotations
if (dsSeq == null)
{
- jalview.bin.Cache.log
+ Cache.log
.warn("Couldn't resolve jalview sequenceI for dataset object reference "
+ ((Vobject) dataset.getDataSetAnnotations(
dsa).getSeqRef(0)).getVorbaId()
uk.ac.vamsas.objects.core.Alignment alignment = dataset
.getAlignment(al);
// TODO check this handles multiple views properly
- AlignViewport av = findViewport(alignment);
+ AlignmentViewport av = findViewport(alignment);
- jalview.datamodel.AlignmentI jal = null;
+ AlignmentI jal = null;
if (av != null)
{
// TODO check that correct alignment object is retrieved when
.getAlignmentSequenceAnnotation();
for (int a = 0; a < vasannot.length; a++)
{
- jalview.datamodel.AlignmentAnnotation asa = (jalview.datamodel.AlignmentAnnotation) getvObj2jv(vasannot[a]); // TODO:
+ AlignmentAnnotation asa = (AlignmentAnnotation) getvObj2jv(vasannot[a]); // TODO:
// 1:many
// jalview
// alignment
for (int j = 0; j < an.length; j++)
{
- jalview.datamodel.AlignmentAnnotation jan = (jalview.datamodel.AlignmentAnnotation) getvObj2jv(an[j]);
+ AlignmentAnnotation jan = (AlignmentAnnotation) getvObj2jv(an[j]);
if (jan != null)
{
// update or stay the same.
return newAlignmentViews.size();
}
- public AlignViewport findViewport(Alignment alignment)
+ public AlignmentViewport findViewport(Alignment alignment)
{
- AlignViewport av = null;
- AlignViewport[] avs = Desktop
+ AlignmentViewport av = null;
+ AlignmentViewport[] avs = Desktop
.getViewports((String) getvObj2jv(alignment));
if (avs != null)
{
* @param annotation
* @return unbound jalview alignment annotation object.
*/
- private jalview.datamodel.AlignmentAnnotation getjAlignmentAnnotation(
- jalview.datamodel.AlignmentI jal,
+ private AlignmentAnnotation getjAlignmentAnnotation(
+ AlignmentI jal,
uk.ac.vamsas.objects.core.RangeAnnotation annotation)
{
if (annotation == null)
Cache.log.warn("Failed to parse threshold property");
}
if (val != null)
+ {
if (gl == null)
{
gl = new GraphLine(val.floatValue(), "", java.awt.Color.black);
{
gl.value = val.floatValue();
}
+ }
}
else if (props[p].getName().equalsIgnoreCase(THRESHOLD + "Name"))
{
if (gl == null)
+ {
gl = new GraphLine(0, "", java.awt.Color.black);
+ }
gl.label = props[p].getContent();
}
}
}
- jalview.datamodel.AlignmentAnnotation jan = null;
+ AlignmentAnnotation jan = null;
if (a_label == null || a_label.length() == 0)
{
a_label = annotation.getType();
{
if (type == 0)
{
- type = jalview.datamodel.AlignmentAnnotation.BAR_GRAPH; // default
+ type = AlignmentAnnotation.BAR_GRAPH; // default
// type of
// value
// annotation
if (has[HASHPHOB])
{
// no hints - so we ensure HPHOB display is like this.
- type = jalview.datamodel.AlignmentAnnotation.BAR_GRAPH;
+ type = AlignmentAnnotation.BAR_GRAPH;
}
}
// make bounds and automatic description strings for jalview user's
}
}
}
- jan = new jalview.datamodel.AlignmentAnnotation(a_label, a_descr,
+ jan = new AlignmentAnnotation(a_label, a_descr,
arow, min, max, type);
}
else
// width - if it is not complete, then mark regions on the annotation
// row.
}
- jan = new jalview.datamodel.AlignmentAnnotation(a_label, a_descr,
+ jan = new AlignmentAnnotation(a_label, a_descr,
arow);
jan.setThreshold(null);
jan.annotationId = annotation.getVorbaId().toString(); // keep all the
* @param default unit for mapped
* @return MapList
*/
- private jalview.util.MapList parsemapType(MapType maprange, int localu,
+ private MapList parsemapType(MapType maprange, int localu,
int mappedu)
{
- jalview.util.MapList ml = null;
+ MapList ml = null;
int[] localRange = getMapping(maprange.getLocal());
int[] mappedRange = getMapping(maprange.getMapped());
long lu = maprange.getLocal().hasUnit() ? maprange.getLocal().getUnit()
: localu;
long mu = maprange.getMapped().hasUnit() ? maprange.getMapped()
.getUnit() : mappedu;
- ml = new jalview.util.MapList(localRange, mappedRange, (int) lu,
+ ml = new MapList(localRange, mappedRange, (int) lu,
(int) mu);
return ml;
}
* initialise a range type object from a set of start/end inclusive intervals
*
* @param mrt
- * @param range
+ * @param ranges
*/
- private void initRangeType(RangeType mrt, int[] range)
+ private void initRangeType(RangeType mrt, List<int[]> ranges)
{
- for (int i = 0; i < range.length; i += 2)
+ for (int[] range : ranges)
{
Seg vSeg = new Seg();
- vSeg.setStart(range[i]);
- vSeg.setEnd(range[i + 1]);
+ vSeg.setStart(range[0]);
+ vSeg.setEnd(range[1]);
mrt.addSeg(vSeg);
}
}
* @param ml
* @param setUnits
*/
- private void initMapType(MapType maprange, jalview.util.MapList ml,
+ private void initMapType(MapType maprange, MapList ml,
boolean setUnits)
{
maprange.setLocal(new Local());
return vobj2jv;
}
- public void storeSequenceMappings(AlignViewport viewport, String title)
+ public void storeSequenceMappings(AlignmentViewport viewport, String title)
throws Exception
{
- AlignViewport av = viewport;
+ AlignmentViewport av = viewport;
try
{
- jalview.datamodel.AlignmentI jal = av.getAlignment();
+ AlignmentI jal = av.getAlignment();
// /////////////////////////////////////////
// SAVE THE DATASET
DataSet dataset = null;
}
// Store any sequence mappings.
- if (av.getAlignment().getCodonFrames() != null
- && av.getAlignment().getCodonFrames().length > 0)
+ Set<AlignedCodonFrame> cframes = av.getAlignment().getCodonFrames();
+ if (cframes != null)
{
- jalview.datamodel.AlignedCodonFrame[] cframes = av.getAlignment()
- .getCodonFrames();
- for (int cf = 0; cf < cframes.length; cf++)
+ for (AlignedCodonFrame acf : cframes)
{
- if (cframes[cf].getdnaSeqs() != null
- && cframes[cf].getdnaSeqs().length > 0)
+ if (acf.getdnaSeqs() != null && acf.getdnaSeqs().length > 0)
{
- jalview.datamodel.SequenceI[] dmps = cframes[cf].getdnaSeqs();
- jalview.datamodel.Mapping[] mps = cframes[cf].getProtMappings();
+ jalview.datamodel.SequenceI[] dmps = acf.getdnaSeqs();
+ jalview.datamodel.Mapping[] mps = acf.getProtMappings();
for (int smp = 0; smp < mps.length; smp++)
{
uk.ac.vamsas.objects.core.SequenceType mfrom = (SequenceType) getjv2vObj(dmps[smp]);