X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FVamsasAppDatastore.java;h=95f6849883ea3b3eca9e7f124388286388317b4a;hb=1d534b200f4a912f02f869c9d860f462511ea46f;hp=e3134701f2cdea655cc9417bc054c81a6cabaf30;hpb=96f41aa46d3e568f8734834ab36fdc9ad8e54ac1;p=jalview.git
diff --git a/src/jalview/io/VamsasAppDatastore.java b/src/jalview/io/VamsasAppDatastore.java
index e313470..95f6849 100644
--- a/src/jalview/io/VamsasAppDatastore.java
+++ b/src/jalview/io/VamsasAppDatastore.java
@@ -1,20 +1,19 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, 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
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
*/
package jalview.io;
@@ -144,11 +143,11 @@ public class VamsasAppDatastore
{
return cdoc.getObject((VorbaId) jv2vobj.get(jvobj));
}
- // check if we're working with a string - then workaround
+ // check if we're working with a string - then workaround
// the use of IdentityHashTable because different strings
// have different object IDs.
if (jvobj instanceof String)
- {
+ {
Object seqsetidobj = null;
seqsetidobj = getVamsasObjectBinding().get(jvobj);
if (seqsetidobj != null)
@@ -158,18 +157,19 @@ public class VamsasAppDatastore
// what is expected. object returned by av.getSequenceSetId() -
// reverse lookup to get the 'registered' instance of this string
Vobject obj = getjv2vObj(seqsetidobj);
- if (obj!=null && !(obj instanceof Alignment))
+ if (obj != null && !(obj instanceof Alignment))
{
- Cache.log.warn("IMPLEMENTATION ERROR?: Unexpected mapping for unmapped jalview string object content:"
- + seqsetidobj + " to object " + obj);
+ Cache.log
+ .warn("IMPLEMENTATION ERROR?: Unexpected mapping for unmapped jalview string object content:"
+ + seqsetidobj + " to object " + obj);
}
return obj;
}
else
{
Cache.log.warn("Unexpected mapping for Jalview String Object ID "
- + seqsetidobj
- + " to another jalview dataset object " + seqsetidobj);
+ + seqsetidobj + " to another jalview dataset object "
+ + seqsetidobj);
}
}
}
@@ -252,10 +252,11 @@ public class VamsasAppDatastore
* put the alignment viewed by AlignViewport into cdoc.
*
* @param av
- * alignViewport to be stored
+ * alignViewport to be stored
* @param aFtitle
- * title for alignment
- * @return true if alignment associated with viewport was stored/synchronized to document
+ * title for alignment
+ * @return true if alignment associated with viewport was stored/synchronized
+ * to document
*/
public boolean storeVAMSAS(AlignViewport av, String aFtitle)
{
@@ -274,22 +275,25 @@ public class VamsasAppDatastore
jal.setDataset(null);
jds = jal.getDataset();
}
-
+
// try and get alignment and association for sequence set id
Alignment alignment = (Alignment) getjv2vObj(av.getSequenceSetId());
- if (alignment!=null)
+ if (alignment != null)
{
dataset = (DataSet) alignment.getV_parent();
- } else {
- // is the dataset already registered
- dataset = (DataSet) getjv2vObj(jds);
}
-
+ else
+ {
+ // is the dataset already registered
+ dataset = (DataSet) getjv2vObj(jds);
+ }
+
if (dataset == null)
{
// it might be that one of the dataset sequences does actually have a
- // binding, so search for it indirectly. If it does, then the local jalview dataset
+ // binding, so search for it indirectly. If it does, then the local
+ // jalview dataset
// must be merged with the existing vamsas dataset.
jalview.datamodel.SequenceI[] jdatset = jds.getSequencesArray();
for (int i = 0; i < jdatset.length; i++)
@@ -305,7 +309,8 @@ public class VamsasAppDatastore
}
else
{
- if (vbound.getV_parent()!=null && dataset != vbound.getV_parent())
+ if (vbound.getV_parent() != null
+ && dataset != vbound.getV_parent())
{
throw new Error(
"IMPLEMENTATION ERROR: Cannot map an alignment of sequences from different datasets into a single alignment in the vamsas document.");
@@ -350,11 +355,14 @@ public class VamsasAppDatastore
// referenced
// sequences
// to dataset.
- Datasetsequence dssync = new jalview.io.vamsas.Datasetsequence(this, sq, dict, dataset);
+ Datasetsequence dssync = new jalview.io.vamsas.Datasetsequence(
+ this, sq, dict, dataset);
sequence = (Sequence) dssync.getVobj();
- if (dssync.getModified()) {
- dssmods.addElement(sequence);
- };
+ if (dssync.getModified())
+ {
+ dssmods.addElement(sequence);
+ }
+ ;
}
if (dssmods.size() > 0)
{
@@ -488,16 +496,17 @@ public class VamsasAppDatastore
* jalview.datamodel.SequenceFeature[] features = alseq
* .getSequenceFeatures(); for (int f = 0; f < features.length; f++) {
* if (features[f] != null) { AlignmentSequenceAnnotation valseqf = (
- * AlignmentSequenceAnnotation) getjv2vObj(features[i]); if (valseqf ==
- * null) {
+ * AlignmentSequenceAnnotation) getjv2vObj(features[i]); if (valseqf
+ * == null) {
*
* valseqf = (AlignmentSequenceAnnotation) getDSAnnotationFromJalview(
* new AlignmentSequenceAnnotation(), features[i]);
* valseqf.setGraph(false);
- * valseqf.addProperty(newProperty("jalview:feature","boolean","true"));
- * if (valseqf.getProvenance() == null) { valseqf.setProvenance(new
- * Provenance()); } addProvenance(valseqf.getProvenance(), "created"); //
- * JBPNote - // need to // update bindjvvobj(features[i], valseqf);
+ * valseqf.addProperty(newProperty("jalview:feature"
+ * ,"boolean","true")); if (valseqf.getProvenance() == null) {
+ * valseqf.setProvenance(new Provenance()); }
+ * addProvenance(valseqf.getProvenance(), "created"); // JBPNote - //
+ * need to // update bindjvvobj(features[i], valseqf);
* valseq.addAlignmentSequenceAnnotation(valseqf); } } }
*/
}
@@ -518,10 +527,11 @@ public class VamsasAppDatastore
{
continue;
}
- if (aa[i].groupRef!=null)
+ if (aa[i].groupRef != null)
{
// TODO: store any group associated annotation references
- Cache.log.warn("Group associated sequence annotation is not stored in VAMSAS document.");
+ Cache.log
+ .warn("Group associated sequence annotation is not stored in VAMSAS document.");
continue;
}
if (aa[i].sequenceRef != null)
@@ -647,12 +657,15 @@ public class VamsasAppDatastore
an.setGroup(Integer.toString(aa[i].graphGroup));
if (aa[i].threshold != null && aa[i].threshold.displayed)
{
- an.addProperty(Properties.newProperty(THRESHOLD, Properties.FLOATTYPE, ""
- + aa[i].threshold.value));
+ an
+ .addProperty(Properties.newProperty(THRESHOLD,
+ Properties.FLOATTYPE, ""
+ + aa[i].threshold.value));
if (aa[i].threshold.label != null)
{
- an.addProperty(Properties.newProperty(THRESHOLD + "Name", Properties.STRINGTYPE,
- "" + aa[i].threshold.label));
+ an.addProperty(Properties.newProperty(THRESHOLD
+ + "Name", Properties.STRINGTYPE, ""
+ + aa[i].threshold.label));
}
}
}
@@ -695,7 +708,8 @@ public class VamsasAppDatastore
{
TreePanel tp = (TreePanel) frames[t];
- if (tp.getViewPort().getSequenceSetId().equals(av.getSequenceSetId()))
+ if (tp.getViewPort().getSequenceSetId().equals(
+ av.getSequenceSetId()))
{
DatastoreItem vtree = new jalview.io.vamsas.Tree(this, tp,
jal, alignment);
@@ -716,10 +730,13 @@ public class VamsasAppDatastore
}
/**
- * very quick test to see if the viewport would be stored in the vamsas document.
- * Reasons for not storing include the unaligned flag being false.
+ * very quick test to see if the viewport would be stored in the vamsas
+ * document. Reasons for not storing include the unaligned flag being false
+ * (for all sequences, including the hidden ones!)
+ *
* @param av
- * @return true if alignment associated with this view will be stored in document.
+ * @return true if alignment associated with this view will be stored in
+ * document.
*/
public boolean alignmentWillBeSkipped(AlignViewport av)
{
@@ -903,8 +920,9 @@ public class VamsasAppDatastore
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;
@@ -920,19 +938,22 @@ public class VamsasAppDatastore
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 (valseq.getDescription()!=null)
+ if (valseq.getDescription() != null)
{
alseq.setDescription(valseq.getDescription());
- } else {
+ }
+ else
+ {
// inherit description line from dataset.
- if (alseq.getDatasetSequence().getDescription()!=null)
+ if (alseq.getDatasetSequence().getDescription() != null)
{
- alseq.setDescription(alseq.getDatasetSequence().getDescription());
+ alseq.setDescription(alseq.getDatasetSequence()
+ .getDescription());
}
}
// if
@@ -1055,12 +1076,11 @@ public class VamsasAppDatastore
// bits.
if (alan.getThreshold() != null && alan.getThreshold().displayed)
{
- an.addProperty(Properties.newProperty(THRESHOLD, Properties.FLOATTYPE,
- ""
- + alan.getThreshold().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));
+ an.addProperty(Properties.newProperty(THRESHOLD + "Name",
+ Properties.STRINGTYPE, "" + alan.getThreshold().label));
}
((DataSet) sref.getV_parent()).addDataSetAnnotations(an);
bindjvvobj(alan, an);
@@ -1186,24 +1206,25 @@ public class VamsasAppDatastore
switch (alan.graph)
{
case AlignmentAnnotation.BAR_GRAPH:
- an.addProperty(Properties.newProperty(DISCRETE_ANNOTATION, Properties.BOOLEANTYPE, "true"));
+ an.addProperty(Properties.newProperty(DISCRETE_ANNOTATION,
+ Properties.BOOLEANTYPE, "true"));
break;
case AlignmentAnnotation.LINE_GRAPH:
- an.addProperty(Properties.newProperty(CONTINUOUS_ANNOTATION, Properties.BOOLEANTYPE, "true"));
+ an.addProperty(Properties.newProperty(CONTINUOUS_ANNOTATION,
+ Properties.BOOLEANTYPE, "true"));
break;
default:
// don't add any kind of discrete or continous property info.
}
}
-
/**
* get start 0)
+ if (cframes[cf].getdnaSeqs() != null
+ && cframes[cf].getdnaSeqs().length > 0)
{
jalview.datamodel.SequenceI[] dmps = cframes[cf].getdnaSeqs();
jalview.datamodel.Mapping[] mps = cframes[cf].getProtMappings();
@@ -2733,19 +2761,22 @@ public class VamsasAppDatastore
}
/**
- * @param skipList the skipList to set
+ * @param skipList
+ * the skipList to set
*/
public void setSkipList(Hashtable skipList)
{
this.skipList = skipList;
}
+
/**
* registry for datastoreItems
*/
DatastoreRegistry dsReg = new DatastoreRegistry();
+
public DatastoreRegistry getDatastoreRegisty()
{
- if (dsReg==null)
+ if (dsReg == null)
{
dsReg = new DatastoreRegistry();
}