2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
20 import jalview.bin.Cache;
21 import jalview.datamodel.AlignedCodonFrame;
22 import jalview.datamodel.AlignmentAnnotation;
23 import jalview.datamodel.AlignmentI;
24 import jalview.datamodel.AlignmentView;
25 import jalview.datamodel.DBRefEntry;
26 import jalview.datamodel.GraphLine;
27 import jalview.datamodel.SequenceFeature;
28 import jalview.datamodel.SequenceI;
29 import jalview.gui.AlignFrame;
30 import jalview.gui.AlignViewport;
31 import jalview.gui.Desktop;
32 import jalview.gui.TreePanel;
33 import jalview.io.vamsas.Datasetsequence;
34 import jalview.io.vamsas.DatastoreItem;
35 import jalview.io.vamsas.DatastoreRegistry;
36 import jalview.io.vamsas.Rangetype;
37 import jalview.util.UrlLink;
39 import java.io.IOException;
40 import java.util.Enumeration;
41 import java.util.HashMap;
42 import java.util.Hashtable;
43 import java.util.IdentityHashMap;
44 import java.util.Iterator;
45 import java.util.Vector;
46 import java.util.jar.JarInputStream;
47 import java.util.jar.JarOutputStream;
49 import uk.ac.vamsas.client.*;
50 import uk.ac.vamsas.objects.core.*;
51 import uk.ac.vamsas.objects.utils.Properties;
56 * org.exolab.castor.util.LocalConfiguration.getInstance().getProperties().setProperty(
57 * "org.exolab.castor.serializer", "org.apache.xml.serialize.XMLSerilazizer"); }
61 * TODO: check/verify consistency for vamsas sync with group associated alignment annotation
63 public class VamsasAppDatastore
66 * Type used for general jalview generated annotation added to vamsas document
68 public static final String JALVIEW_ANNOTATION_ROW = "JalviewAnnotation";
71 * AlignmentAnnotation property to indicate that values should not be
74 public static final String DISCRETE_ANNOTATION = "discrete";
77 * continuous property - optional to specify that annotation should be
78 * represented as a continous graph line
80 private static final String CONTINUOUS_ANNOTATION = "continuous";
82 private static final String THRESHOLD = "threshold";
85 * template for provenance entries written to vamsas session document
87 Entry provEntry = null;
90 * Instance of the session document being synchronized with
95 * map Vorba (vamsas object xml ref) IDs to live jalview object references
100 * map live jalview object references to Vorba IDs
102 IdentityHashMap jv2vobj;
105 * map jalview sequence set ID (which is vorba ID for alignment) to last
106 * recorded hash value for the alignment viewport (the undo/redo hash value)
108 Hashtable alignRDHash;
110 public VamsasAppDatastore(IClientDocument cdoc, Hashtable vobj2jv,
111 IdentityHashMap jv2vobj, Entry provEntry, Hashtable alignRDHash)
114 this.vobj2jv = vobj2jv;
115 this.jv2vobj = jv2vobj;
116 this.provEntry = provEntry;
117 this.alignRDHash = alignRDHash;
122 * the skipList used to skip over views from Jalview Appdata's that we've
123 * already syncrhonized
127 private void buildSkipList()
129 skipList = new Hashtable();
130 AlignFrame[] al = Desktop.getAlignframes();
131 for (int f = 0; al != null && f < al.length; f++)
133 skipList.put(al[f].getViewport().getSequenceSetId(), al[f]);
138 * @return the Vobject bound to Jalview datamodel object
140 protected Vobject getjv2vObj(Object jvobj)
142 if (jv2vobj.containsKey(jvobj))
144 return cdoc.getObject((VorbaId) jv2vobj.get(jvobj));
146 // check if we're working with a string - then workaround
147 // the use of IdentityHashTable because different strings
148 // have different object IDs.
149 if (jvobj instanceof String)
151 Object seqsetidobj = null;
152 seqsetidobj = getVamsasObjectBinding().get(jvobj);
153 if (seqsetidobj != null)
155 if (seqsetidobj instanceof String)
157 // what is expected. object returned by av.getSequenceSetId() -
158 // reverse lookup to get the 'registered' instance of this string
159 Vobject obj = getjv2vObj(seqsetidobj);
160 if (obj != null && !(obj instanceof Alignment))
163 .warn("IMPLEMENTATION ERROR?: Unexpected mapping for unmapped jalview string object content:"
164 + seqsetidobj + " to object " + obj);
170 Cache.log.warn("Unexpected mapping for Jalview String Object ID "
171 + seqsetidobj + " to another jalview dataset object "
177 if (Cache.log.isDebugEnabled())
179 Cache.log.debug("Returning null VorbaID binding for jalview object "
188 * @return Jalview datamodel object bound to the vamsas document object
190 protected Object getvObj2jv(uk.ac.vamsas.client.Vobject vobj)
192 VorbaId id = vobj.getVorbaId();
195 id = cdoc.registerObject(vobj);
197 .debug("Registering new object and returning null for getvObj2jv");
200 if (vobj2jv.containsKey(vobj.getVorbaId()))
202 return vobj2jv.get(vobj.getVorbaId());
207 protected void bindjvvobj(Object jvobj, uk.ac.vamsas.client.Vobject vobj)
209 VorbaId id = vobj.getVorbaId();
212 id = cdoc.registerObject(vobj);
213 if (id == null || vobj.getVorbaId() == null
214 || cdoc.getObject(id) != vobj)
216 Cache.log.error("Failed to get id for "
217 + (vobj.isRegisterable() ? "registerable"
218 : "unregisterable") + " object " + vobj);
222 if (vobj2jv.containsKey(vobj.getVorbaId())
223 && !((VorbaId) vobj2jv.get(vobj.getVorbaId())).equals(jvobj))
226 "Warning? Overwriting existing vamsas id binding for "
227 + vobj.getVorbaId(), new Exception(
228 "Overwriting vamsas id binding."));
230 else if (jv2vobj.containsKey(jvobj)
231 && !((VorbaId) jv2vobj.get(jvobj)).equals(vobj.getVorbaId()))
234 "Warning? Overwriting existing jalview object binding for "
235 + jvobj, new Exception(
236 "Overwriting jalview object binding."));
239 * Cache.log.error("Attempt to make conflicting object binding! "+vobj+" id "
240 * +vobj.getVorbaId()+" already bound to "+getvObj2jv(vobj)+" and "+jvobj+"
241 * already bound to "+getjv2vObj(jvobj),new Exception("Excessive call to
244 // we just update the hash's regardless!
245 Cache.log.debug("Binding " + vobj.getVorbaId() + " to " + jvobj);
246 vobj2jv.put(vobj.getVorbaId(), jvobj);
247 // JBPNote - better implementing a hybrid invertible hash.
248 jv2vobj.put(jvobj, vobj.getVorbaId());
252 * put the alignment viewed by AlignViewport into cdoc.
255 * alignViewport to be stored
257 * title for alignment
258 * @return true if alignment associated with viewport was stored/synchronized
261 public boolean storeVAMSAS(AlignViewport av, String aFtitle)
265 jalview.datamodel.AlignmentI jal = av.getAlignment();
266 jalview.datamodel.AlignmentI jds = jal.getDataset();
268 VAMSAS root = null; // will be resolved based on Dataset Parent.
269 // /////////////////////////////////////////
271 DataSet dataset = null;
274 Cache.log.warn("Creating new dataset for an alignment.");
275 jal.setDataset(null);
276 jds = jal.getDataset();
279 // try and get alignment and association for sequence set id
281 Alignment alignment = (Alignment) getjv2vObj(av.getSequenceSetId());
282 if (alignment != null)
284 dataset = (DataSet) alignment.getV_parent();
288 // is the dataset already registered
289 dataset = (DataSet) getjv2vObj(jds);
294 // it might be that one of the dataset sequences does actually have a
295 // binding, so search for it indirectly. If it does, then the local
297 // must be merged with the existing vamsas dataset.
298 jalview.datamodel.SequenceI[] jdatset = jds.getSequencesArray();
299 for (int i = 0; i < jdatset.length; i++)
301 Vobject vbound = getjv2vObj(jdatset[i]);
304 if (vbound instanceof uk.ac.vamsas.objects.core.Sequence)
308 dataset = (DataSet) vbound.getV_parent();
312 if (vbound.getV_parent() != null
313 && dataset != vbound.getV_parent())
316 "IMPLEMENTATION ERROR: Cannot map an alignment of sequences from different datasets into a single alignment in the vamsas document.");
317 // This occurs because the dataset for the alignment we are
328 Cache.log.warn("Creating new vamsas dataset for alignment view "
329 + av.getSequenceSetId());
330 // we create a new dataset on the default vamsas root.
331 root = cdoc.getVamsasRoots()[0]; // default vamsas root for modifying.
332 dataset = new DataSet();
333 root.addDataSet(dataset);
334 bindjvvobj(jds, dataset);
335 dataset.setProvenance(dummyProvenance());
336 // dataset.getProvenance().addEntry(provEntry);
341 root = (VAMSAS) dataset.getV_parent();
345 // set new dataset and alignment sequences based on alignment Nucleotide
347 // this *will* break when alignment contains both nucleotide and amino
349 String dict = jal.isNucleotide() ? uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_NA
350 : uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_AA;
351 Vector dssmods = new Vector();
352 for (int i = 0; i < jal.getHeight(); i++)
354 SequenceI sq = jal.getSequenceAt(i).getDatasetSequence(); // only insert
358 Datasetsequence dssync = new jalview.io.vamsas.Datasetsequence(
359 this, sq, dict, dataset);
360 sequence = (Sequence) dssync.getVobj();
361 if (dssync.getModified())
363 dssmods.addElement(sequence);
367 if (dssmods.size() > 0)
371 Entry pentry = this.addProvenance(dataset.getProvenance(),
372 "updated sequences");
373 // pentry.addInput(vInput); could write in which sequences were
375 dssmods.removeAllElements();
378 // dataset.setProvenance(getVamsasProvenance(jal.getDataset().getProvenance()));
379 // ////////////////////////////////////////////
380 if (alignmentWillBeSkipped(av))
382 // TODO: trees could be written - but for the moment we just
384 // add to the JalviewXML skipList and ..
388 if (alignment == null)
390 alignment = new Alignment();
391 bindjvvobj(av.getSequenceSetId(), alignment);
392 if (alignment.getProvenance() == null)
394 alignment.setProvenance(new Provenance());
396 addProvenance(alignment.getProvenance(), "added"); // TODO: insert some
399 dataset.addAlignment(alignment);
401 Property title = new Property();
402 title.setName("title");
403 title.setType("string");
404 title.setContent(aFtitle);
405 alignment.addProperty(title);
407 alignment.setGapChar(String.valueOf(av.getGapCharacter()));
408 for (int i = 0; i < jal.getHeight(); i++)
410 syncToAlignmentSequence(jal.getSequenceAt(i), alignment, null);
412 alignRDHash.put(av.getSequenceSetId(), av.getUndoRedoHash());
416 // always prepare to clone the alignment
417 boolean alismod = av.isUndoRedoHashModified((long[]) alignRDHash
418 .get(av.getSequenceSetId()));
419 // todo: verify and update mutable alignment props.
420 // TODO: Use isLocked methods
421 if (alignment.getModifiable() == null
422 || alignment.getModifiable().length() == 0)
423 // && !alignment.isDependedOn())
425 boolean modified = false;
426 // check existing sequences in local and in document.
427 Vector docseqs = new Vector(
428 alignment.getAlignmentSequenceAsReference());
429 for (int i = 0; i < jal.getHeight(); i++)
431 modified |= syncToAlignmentSequence(jal.getSequenceAt(i),
434 if (docseqs.size() > 0)
436 // removeValignmentSequences(alignment, docseqs);
437 docseqs.removeAllElements();
439 .println("Sequence deletion from alignment is not implemented.");
447 addProvenance(alignment.getProvenance(), "Edited"); // TODO:
456 addProvenance(alignment.getProvenance(), "Attributes Edited"); // TODO:
466 System.out.println("update alignment in document.");
470 System.out.println("alignment in document left unchanged.");
475 // unbind alignment from view.
476 // create new binding and new alignment.
477 // mark trail on new alignment as being derived from old ?
479 .println("update edited alignment to new alignment in document.");
482 // ////////////////////////////////////////////
483 // SAVE Alignment Sequence Features
484 for (int i = 0, iSize = alignment.getAlignmentSequenceCount(); i < iSize; i++)
486 AlignmentSequence valseq;
487 SequenceI alseq = (SequenceI) getvObj2jv(valseq = alignment
488 .getAlignmentSequence(i));
489 if (alseq != null && alseq.getSequenceFeatures() != null)
492 * We do not put local Alignment Sequence Features into the vamsas
496 * jalview.datamodel.SequenceFeature[] features = alseq
497 * .getSequenceFeatures(); for (int f = 0; f < features.length; f++) {
498 * if (features[f] != null) { AlignmentSequenceAnnotation valseqf = (
499 * AlignmentSequenceAnnotation) getjv2vObj(features[i]); if (valseqf
502 * valseqf = (AlignmentSequenceAnnotation) getDSAnnotationFromJalview(
503 * new AlignmentSequenceAnnotation(), features[i]);
504 * valseqf.setGraph(false);
505 * valseqf.addProperty(newProperty("jalview:feature"
506 * ,"boolean","true")); if (valseqf.getProvenance() == null) {
507 * valseqf.setProvenance(new Provenance()); }
508 * addProvenance(valseqf.getProvenance(), "created"); // JBPNote - //
509 * need to // update bindjvvobj(features[i], valseqf);
510 * valseq.addAlignmentSequenceAnnotation(valseqf); } } }
515 // ////////////////////////////////////////////
517 if (jal.getAlignmentAnnotation() != null)
519 jalview.datamodel.AlignmentAnnotation[] aa = jal
520 .getAlignmentAnnotation();
521 java.util.HashMap AlSeqMaps = new HashMap(); // stores int maps from
522 // alignment columns to
523 // sequence positions.
524 for (int i = 0; i < aa.length; i++)
526 if (aa[i] == null || isJalviewOnly(aa[i]))
530 if (aa[i].groupRef != null)
532 // TODO: store any group associated annotation references
534 .warn("Group associated sequence annotation is not stored in VAMSAS document.");
537 if (aa[i].sequenceRef != null)
539 // Deal with sequence associated annotation
540 Vobject sref = getjv2vObj(aa[i].sequenceRef);
541 if (sref instanceof uk.ac.vamsas.objects.core.AlignmentSequence)
543 saveAlignmentSequenceAnnotation(AlSeqMaps,
544 (AlignmentSequence) sref, aa[i]);
548 // first find the alignment sequence to associate this with.
549 SequenceI jvalsq = null;
550 Enumeration jval = av.getAlignment().getSequences()
552 while (jval.hasMoreElements())
554 jvalsq = (SequenceI) jval.nextElement();
555 // saveDatasetSequenceAnnotation(AlSeqMaps,(uk.ac.vamsas.objects.core.Sequence)
557 if (jvalsq.getDatasetSequence() == aa[i].sequenceRef)
559 Vobject alsref = getjv2vObj(jvalsq);
560 saveAlignmentSequenceAnnotation(AlSeqMaps,
561 (AlignmentSequence) alsref, aa[i]);
570 // add Alignment Annotation
571 uk.ac.vamsas.objects.core.AlignmentAnnotation an = (uk.ac.vamsas.objects.core.AlignmentAnnotation) getjv2vObj(aa[i]);
574 an = new uk.ac.vamsas.objects.core.AlignmentAnnotation();
575 an.setType(JALVIEW_ANNOTATION_ROW);
576 an.setDescription(aa[i].description);
577 alignment.addAlignmentAnnotation(an);
578 Seg vSeg = new Seg(); // TODO: refactor to have a default
579 // rangeAnnotationType initer/updater that
580 // takes a set of int ranges.
582 vSeg.setInclusive(true);
583 vSeg.setEnd(jal.getWidth());
587 an.setGraph(true); // aa[i].graph);
589 an.setLabel(aa[i].label);
590 an.setProvenance(dummyProvenance());
591 if (aa[i].graph != AlignmentAnnotation.NO_GRAPH)
593 an.setGroup(Integer.toString(aa[i].graphGroup)); // // JBPNote
608 AnnotationElement ae;
610 for (int a = 0; a < aa[i].annotations.length; a++)
612 if ((aa[i] == null) || (aa[i].annotations[a] == null))
617 ae = new AnnotationElement();
618 ae.setDescription(aa[i].annotations[a].description);
619 ae.addGlyph(new Glyph());
620 ae.getGlyph(0).setContent(
621 aa[i].annotations[a].displayCharacter); // assume
630 ae.addValue(aa[i].annotations[a].value);
632 ae.setPosition(a + 1);
633 if (aa[i].annotations[a].secondaryStructure != ' ')
635 Glyph ss = new Glyph();
636 ss.setDict(uk.ac.vamsas.objects.utils.GlyphDictionary.PROTEIN_SS_3STATE);
638 .valueOf(aa[i].annotations[a].secondaryStructure));
641 an.addAnnotationElement(ae);
645 // an.addProperty(newProperty("jalview:editable", null,
647 // an.setModifiable(""); // TODO: This is not the way the
648 // modifiable flag is supposed to be used.
650 setAnnotationType(an, aa[i]);
652 if (aa[i].graph != jalview.datamodel.AlignmentAnnotation.NO_GRAPH)
655 an.setGroup(Integer.toString(aa[i].graphGroup));
656 if (aa[i].threshold != null && aa[i].threshold.displayed)
658 an.addProperty(Properties.newProperty(THRESHOLD,
659 Properties.FLOATTYPE, "" + aa[i].threshold.value));
660 if (aa[i].threshold.label != null)
662 an.addProperty(Properties.newProperty(THRESHOLD
663 + "Name", Properties.STRINGTYPE, ""
664 + aa[i].threshold.label));
673 if (an.getModifiable() == null) // TODO: USE VAMSAS LIBRARY OBJECT
676 // verify annotation - update (perhaps)
678 .info("update alignment sequence annotation. not yet implemented.");
682 // verify annotation - update (perhaps)
684 .info("updated alignment sequence annotation added.");
690 // /////////////////////////////////////////////////////
692 // //////////////////////////////////////////////
694 // /////////////////////////////////
695 // FIND ANY ASSOCIATED TREES
696 if (Desktop.desktop != null)
698 javax.swing.JInternalFrame[] frames = Desktop.instance
701 for (int t = 0; t < frames.length; t++)
703 if (frames[t] instanceof TreePanel)
705 TreePanel tp = (TreePanel) frames[t];
707 if (tp.getViewPort().getSequenceSetId()
708 .equals(av.getSequenceSetId()))
710 DatastoreItem vtree = new jalview.io.vamsas.Tree(this, tp,
716 // Store Jalview specific stuff in the Jalview appData
717 // not implemented in the SimpleDoc interface.
722 ex.printStackTrace();
729 * very quick test to see if the viewport would be stored in the vamsas
730 * document. Reasons for not storing include the unaligned flag being false
731 * (for all sequences, including the hidden ones!)
734 * @return true if alignment associated with this view will be stored in
737 public boolean alignmentWillBeSkipped(AlignViewport av)
739 return (!av.getAlignment().isAligned());
742 private void addToSkipList(AlignViewport av)
744 if (skipList == null)
746 skipList = new Hashtable();
748 skipList.put(av.getSequenceSetId(), av);
752 * remove docseqs from the given alignment marking provenance appropriately
753 * and removing any references to the sequences.
758 private void removeValignmentSequences(Alignment alignment, Vector docseqs)
760 // delete these from document. This really needs to be a generic document
761 // API function derived by CASTOR.
762 Enumeration en = docseqs.elements();
763 while (en.hasMoreElements())
765 alignment.removeAlignmentSequence((AlignmentSequence) en
768 Entry pe = addProvenance(alignment.getProvenance(), "Removed "
769 + docseqs.size() + " sequences");
770 en = alignment.enumerateAlignmentAnnotation();
771 Vector toremove = new Vector();
772 while (en.hasMoreElements())
774 uk.ac.vamsas.objects.core.AlignmentAnnotation alan = (uk.ac.vamsas.objects.core.AlignmentAnnotation) en
776 if (alan.getSeqrefsCount() > 0)
779 Vector storem = new Vector();
780 Enumeration sr = alan.enumerateSeqrefs();
781 while (sr.hasMoreElements())
783 Object alsr = sr.nextElement();
784 if (docseqs.contains(alsr))
786 storem.addElement(alsr);
789 // remove references to the deleted sequences
790 sr = storem.elements();
791 while (sr.hasMoreElements())
793 alan.removeSeqrefs(sr.nextElement());
796 if (alan.getSeqrefsCount() == 0)
798 // should then delete alan from dataset
799 toremove.addElement(alan);
803 // remove any annotation that used to be associated to a specific bunch of
805 en = toremove.elements();
806 while (en.hasMoreElements())
809 .removeAlignmentAnnotation((uk.ac.vamsas.objects.core.AlignmentAnnotation) en
812 // TODO: search through alignment annotations to remove any references to
813 // this alignment sequence
817 * sync a jalview alignment seuqence into a vamsas alignment assumes all lock
818 * transformation/bindings have been sorted out before hand. creates/syncs the
819 * vamsas alignment sequence for jvalsq and adds it to the alignment if
820 * necessary. unbounddocseq is a duplicate of the vamsas alignment sequences
821 * and these are removed after being processed w.r.t a bound jvalsq
824 private boolean syncToAlignmentSequence(SequenceI jvalsq,
825 Alignment alignment, Vector unbounddocseq)
827 boolean modal = false;
828 // todo: islocked method here
829 boolean up2doc = false;
830 AlignmentSequence alseq = (AlignmentSequence) getjv2vObj(jvalsq);
833 alseq = new AlignmentSequence();
838 if (unbounddocseq != null)
840 unbounddocseq.removeElement(alseq);
843 // boolean locked = (alignment.getModifiable()==null ||
844 // alignment.getModifiable().length()>0);
845 // TODO: VAMSAS: translate lowercase symbols to annotation ?
846 if (up2doc || !alseq.getSequence().equals(jvalsq.getSequenceAsString()))
848 alseq.setSequence(jvalsq.getSequenceAsString());
849 alseq.setStart(jvalsq.getStart());
850 alseq.setEnd(jvalsq.getEnd());
853 if (up2doc || !alseq.getName().equals(jvalsq.getName()))
856 alseq.setName(jvalsq.getName());
858 if (jvalsq.getDescription() != null
859 && (alseq.getDescription() == null || !jvalsq.getDescription()
860 .equals(alseq.getDescription())))
863 alseq.setDescription(jvalsq.getDescription());
865 if (getjv2vObj(jvalsq.getDatasetSequence()) == null)
868 .warn("Serious Implementation error - Unbound dataset sequence in alignment: "
869 + jvalsq.getDatasetSequence());
871 alseq.setRefid(getjv2vObj(jvalsq.getDatasetSequence()));
875 alignment.addAlignmentSequence(alseq);
876 bindjvvobj(jvalsq, alseq);
878 return up2doc || modal;
882 * locally sync a jalview alignment seuqence from a vamsas alignment assumes
883 * all lock transformation/bindings have been sorted out before hand.
884 * creates/syncs the jvalsq from the alignment sequence
886 private boolean syncFromAlignmentSequence(AlignmentSequence valseq,
887 char valGapchar, char gapChar, Vector dsseqs)
890 boolean modal = false;
891 // todo: islocked method here
892 boolean upFromdoc = false;
893 jalview.datamodel.SequenceI alseq = (SequenceI) getvObj2jv(valseq);
901 // boolean locked = (alignment.getModifiable()==null ||
902 // alignment.getModifiable().length()>0);
903 // TODO: VAMSAS: translate lowercase symbols to annotation ?
905 || !valseq.getSequence().equals(alseq.getSequenceAsString()))
907 // this might go *horribly* wrong
908 alseq.setSequence(new String(valseq.getSequence()).replace(
909 valGapchar, gapChar));
910 alseq.setStart((int) valseq.getStart());
911 alseq.setEnd((int) valseq.getEnd());
914 if (!valseq.getName().equals(alseq.getName()))
917 alseq.setName(valseq.getName());
919 if (alseq.getDescription() == null
920 || (valseq.getDescription() != null && !alseq
921 .getDescription().equals(valseq.getDescription())))
923 alseq.setDescription(valseq.getDescription());
926 if (modal && Cache.log.isDebugEnabled())
928 Cache.log.debug("Updating apparently edited sequence "
934 alseq = new jalview.datamodel.Sequence(valseq.getName(), valseq
935 .getSequence().replace(valGapchar, gapChar),
936 (int) valseq.getStart(), (int) valseq.getEnd());
938 Vobject datsetseq = (Vobject) valseq.getRefid();
939 if (datsetseq != null)
941 alseq.setDatasetSequence((SequenceI) getvObj2jv(datsetseq)); // exceptions
942 if (valseq.getDescription() != null)
944 alseq.setDescription(valseq.getDescription());
948 // inherit description line from dataset.
949 if (alseq.getDatasetSequence().getDescription() != null)
951 alseq.setDescription(alseq.getDatasetSequence()
966 .error("Invalid dataset sequence id (null) for alignment sequence "
967 + valseq.getVorbaId());
969 bindjvvobj(alseq, valseq);
970 alseq.setVamsasId(valseq.getVorbaId().getId());
973 Vobject datsetseq = (Vobject) valseq.getRefid();
974 if (datsetseq != null)
976 if (datsetseq != alseq.getDatasetSequence())
980 alseq.setDatasetSequence((SequenceI) getvObj2jv(datsetseq)); // exceptions
982 return upFromdoc || modal;
985 private void initRangeAnnotationType(RangeAnnotation an,
986 AlignmentAnnotation alan, int[] gapMap)
988 Seg vSeg = new Seg();
990 vSeg.setInclusive(true);
991 vSeg.setEnd(gapMap.length);
994 // LATER: much of this is verbatim from the alignmentAnnotation
995 // method below. suggests refactoring to make rangeAnnotation the
997 an.setDescription(alan.description);
998 an.setLabel(alan.label);
999 an.setGroup(Integer.toString(alan.graphGroup));
1008 AnnotationElement ae;
1009 for (int a = 0; a < alan.annotations.length; a++)
1011 if (alan.annotations[a] == null)
1016 ae = new AnnotationElement();
1017 ae.setDescription(alan.annotations[a].description);
1018 ae.addGlyph(new Glyph());
1019 ae.getGlyph(0).setContent(alan.annotations[a].displayCharacter); // assume
1026 if (alan.graph != jalview.datamodel.AlignmentAnnotation.NO_GRAPH)
1028 ae.addValue(alan.annotations[a].value);
1030 ae.setPosition(gapMap[a] + 1); // position w.r.t. AlignmentSequence
1032 if (alan.annotations[a].secondaryStructure != ' ')
1034 // we only write an annotation where it really exists.
1035 Glyph ss = new Glyph();
1036 ss.setDict(uk.ac.vamsas.objects.utils.GlyphDictionary.PROTEIN_SS_3STATE);
1037 ss.setContent(String
1038 .valueOf(alan.annotations[a].secondaryStructure));
1041 an.addAnnotationElement(ae);
1046 private void saveDatasetSequenceAnnotation(HashMap AlSeqMaps,
1047 uk.ac.vamsas.objects.core.Sequence sref, AlignmentAnnotation alan)
1051 // objects.core.AlignmentSequence alsref = (uk.ac.vamsas.
1052 // objects.core.AlignmentSequence) sref;
1053 uk.ac.vamsas.objects.core.DataSetAnnotations an = (uk.ac.vamsas.objects.core.DataSetAnnotations) getjv2vObj(alan);
1054 int[] gapMap = getGapMap(AlSeqMaps, alan);
1057 an = new uk.ac.vamsas.objects.core.DataSetAnnotations();
1058 initRangeAnnotationType(an, alan, gapMap);
1060 an.setProvenance(dummyProvenance()); // get provenance as user
1061 // created, or jnet, or
1063 setAnnotationType(an, alan);
1064 an.setGroup(Integer.toString(alan.graphGroup)); // // JBPNote -
1072 if (alan.getThreshold() != null && alan.getThreshold().displayed)
1074 an.addProperty(Properties.newProperty(THRESHOLD,
1075 Properties.FLOATTYPE, "" + alan.getThreshold().value));
1076 if (alan.getThreshold().label != null)
1077 an.addProperty(Properties.newProperty(THRESHOLD + "Name",
1078 Properties.STRINGTYPE, "" + alan.getThreshold().label));
1080 ((DataSet) sref.getV_parent()).addDataSetAnnotations(an);
1081 bindjvvobj(alan, an);
1085 // update reference sequence Annotation
1086 if (an.getModifiable() == null) // TODO: USE VAMSAS LIBRARY OBJECT LOCK
1089 // verify existing alignment sequence annotation is up to date
1090 System.out.println("update dataset sequence annotation.");
1094 // verify existing alignment sequence annotation is up to date
1096 .println("make new alignment dataset sequence annotation if modification has happened.");
1102 private int[] getGapMap(HashMap AlSeqMaps, AlignmentAnnotation alan)
1105 if (AlSeqMaps.containsKey(alan.sequenceRef))
1107 gapMap = (int[]) AlSeqMaps.get(alan.sequenceRef);
1111 gapMap = new int[alan.sequenceRef.getLength()];
1112 // map from alignment position to sequence position.
1113 int[] sgapMap = alan.sequenceRef.gapMap();
1114 for (int a = 0; a < sgapMap.length; a++)
1116 gapMap[sgapMap[a]] = a;
1122 private void saveAlignmentSequenceAnnotation(HashMap AlSeqMaps,
1123 AlignmentSequence alsref, AlignmentAnnotation alan)
1127 // objects.core.AlignmentSequence alsref = (uk.ac.vamsas.
1128 // objects.core.AlignmentSequence) sref;
1129 uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation an = (uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation) getjv2vObj(alan);
1130 int[] gapMap = getGapMap(AlSeqMaps, alan);
1133 an = new uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation();
1134 initRangeAnnotationType(an, alan, gapMap);
1136 * I mean here that we don't actually have a semantic 'type' for the
1137 * annotation (this might be - score, intrinsic property, measurement,
1138 * something extracted from another program, etc)
1140 an.setType(JALVIEW_ANNOTATION_ROW); // TODO: better fix
1141 // this rough guess ;)
1142 alsref.addAlignmentSequenceAnnotation(an);
1143 bindjvvobj(alan, an);
1144 // These properties are directly supported by the
1145 // AlignmentSequenceAnnotation type.
1146 setAnnotationType(an, alan);
1147 an.setProvenance(dummyProvenance()); // get provenance as user
1148 // created, or jnet, or
1153 // update reference sequence Annotation
1154 if (an.getModifiable() == null) // TODO: USE VAMSAS LIBRARY OBJECT LOCK
1157 // verify existing alignment sequence annotation is up to date
1158 System.out.println("update alignment sequence annotation.");
1162 // verify existing alignment sequence annotation is up to date
1164 .println("make new alignment sequence annotation if modification has happened.");
1170 * set vamsas annotation object type from jalview annotation
1175 private void setAnnotationType(RangeAnnotation an,
1176 AlignmentAnnotation alan)
1178 if (an instanceof AlignmentSequenceAnnotation)
1180 if (alan.graph != AlignmentAnnotation.NO_GRAPH)
1182 ((AlignmentSequenceAnnotation) an).setGraph(true);
1186 ((AlignmentSequenceAnnotation) an).setGraph(false);
1189 if (an instanceof uk.ac.vamsas.objects.core.AlignmentAnnotation)
1191 if (alan.graph != AlignmentAnnotation.NO_GRAPH)
1193 ((uk.ac.vamsas.objects.core.AlignmentAnnotation) an).setGraph(true);
1197 ((uk.ac.vamsas.objects.core.AlignmentAnnotation) an)
1203 case AlignmentAnnotation.BAR_GRAPH:
1204 an.addProperty(Properties.newProperty(DISCRETE_ANNOTATION,
1205 Properties.BOOLEANTYPE, "true"));
1207 case AlignmentAnnotation.LINE_GRAPH:
1208 an.addProperty(Properties.newProperty(CONTINUOUS_ANNOTATION,
1209 Properties.BOOLEANTYPE, "true"));
1212 // don't add any kind of discrete or continous property info.
1217 * get start<end range of segment, adjusting for inclusivity flag and
1221 * @param ensureDirection
1222 * when true - always ensure start is less than end.
1223 * @return int[] { start, end, direction} where direction==1 for range running
1224 * from end to start.
1226 private int[] getSegRange(Seg visSeg, boolean ensureDirection)
1228 boolean incl = visSeg.getInclusive();
1229 // adjust for inclusive flag.
1230 int pol = (visSeg.getStart() <= visSeg.getEnd()) ? 1 : -1; // polarity of
1232 int start = visSeg.getStart() + (incl ? 0 : pol);
1233 int end = visSeg.getEnd() + (incl ? 0 : -pol);
1234 if (ensureDirection && pol == -1)
1236 // jalview doesn't deal with inverted ranges, yet.
1242 { start, end, pol < 0 ? 1 : 0 };
1248 * @return true if annotation is not to be stored in document
1250 private boolean isJalviewOnly(AlignmentAnnotation annotation)
1252 return annotation.autoCalculated || annotation.label.equals("Quality")
1253 || annotation.label.equals("Conservation")
1254 || annotation.label.equals("Consensus");
1257 boolean dojvsync = true;
1259 // boolean dojvsync = false; // disables Jalview AppData IO
1261 * list of alignment views created when updating Jalview from document.
1263 private Vector newAlignmentViews = new Vector();
1266 * update local jalview view settings from the stored appdata (if any)
1268 public void updateJalviewFromAppdata()
1270 // recover any existing Jalview data from appdata
1271 // TODO: recover any PDB files stored as attachments in the vamsas session
1272 // and initialise the Jalview2XML.alreadyLoadedPDB hashtable with mappings
1275 final IClientAppdata cappdata = cdoc.getClientAppdata();
1276 if (cappdata != null)
1278 if (cappdata.hasClientAppdata())
1280 // TODO: how to check version of Jalview client app data and whether
1281 // it has been modified
1282 // client data is shared over all app clients
1285 jalview.gui.Jalview2XML fromxml = new jalview.gui.Jalview2XML();
1286 fromxml.attemptversion1parse = false;
1287 fromxml.setUniqueSetSuffix("");
1288 fromxml.setObjectMappingTables(vobj2jv, jv2vobj); // mapKeysToString
1290 // mapValuesToString
1291 fromxml.setSkipList(skipList);
1292 jalview.util.jarInputStreamProvider jprovider = new jalview.util.jarInputStreamProvider()
1295 public String getFilename()
1298 // TODO Get the vamsas session ID here
1299 return "Jalview Vamsas Document Client Data";
1302 public JarInputStream getJarInputStream() throws IOException
1304 jalview.bin.Cache.log
1305 .debug("Returning client input stream for Jalview from Vamsas Document.");
1306 return new JarInputStream(cappdata.getClientInputStream());
1311 fromxml.LoadJalviewAlign(jprovider);
1313 } catch (Exception e)
1316 } catch (OutOfMemoryError e)
1325 if (cappdata.hasUserAppdata())
1327 // TODO: how to check version of Jalview user app data and whether it
1328 // has been modified
1329 // user data overrides data shared over all app clients ?
1332 jalview.gui.Jalview2XML fromxml = new jalview.gui.Jalview2XML();
1333 fromxml.attemptversion1parse = false;
1334 fromxml.setUniqueSetSuffix("");
1335 fromxml.setSkipList(skipList);
1336 fromxml.setObjectMappingTables(mapKeysToString(vobj2jv),
1337 mapValuesToString(jv2vobj));
1338 jalview.util.jarInputStreamProvider jarstream = new jalview.util.jarInputStreamProvider()
1341 public String getFilename()
1344 // TODO Get the vamsas session ID here
1345 return "Jalview Vamsas Document User Data";
1348 public JarInputStream getJarInputStream() throws IOException
1350 jalview.bin.Cache.log
1351 .debug("Returning user input stream for Jalview from Vamsas Document.");
1352 return new JarInputStream(cappdata.getUserInputStream());
1357 fromxml.LoadJalviewAlign(jarstream);
1359 } catch (Exception e)
1362 } catch (OutOfMemoryError e)
1372 flushAlignViewports();
1376 * remove any spurious views generated by document synchronization
1378 private void flushAlignViewports()
1380 // remove any additional viewports originally recovered from the vamsas
1382 // search for all alignframes containing viewports generated from document
1384 // and if any contain more than one view, then remove the one generated by
1386 AlignViewport views[], av = null;
1387 AlignFrame af = null;
1388 Iterator newviews = newAlignmentViews.iterator();
1389 while (newviews.hasNext())
1391 av = (AlignViewport) newviews.next();
1392 af = Desktop.getAlignFrameFor(av);
1393 // TODO implement this : af.getNumberOfViews
1394 String seqsetidobj = av.getSequenceSetId();
1395 views = Desktop.getViewports(seqsetidobj);
1396 Cache.log.debug("Found "
1397 + (views == null ? " no " : "" + views.length)
1398 + " views for '" + av.getSequenceSetId() + "'");
1399 if (views.length > 1)
1401 // we need to close the original document view.
1403 // work out how to do this by seeing if the views are gathered.
1404 // pretty clunky but the only way to do this without adding more flags
1405 // to the align frames.
1406 boolean gathered = false;
1407 String newviewid = null;
1408 AlignedCodonFrame[] mappings = av.getAlignment().getCodonFrames();
1409 for (int i = 0; i < views.length; i++)
1413 AlignFrame viewframe = Desktop.getAlignFrameFor(views[i]);
1414 if (viewframe == af)
1418 newviewid = views[i].getSequenceSetId();
1422 // lose the reference to the vamsas document created view
1426 // close the view generated by the vamsas document synchronization
1433 af.closeMenuItem_actionPerformed(false);
1435 replaceJvObjMapping(seqsetidobj, newviewid);
1436 seqsetidobj = newviewid;
1437 // not sure if we need to do this:
1439 if (false) // mappings != null)
1441 // ensure sequence mappings from vamsas document view still
1443 if (mappings != null && mappings.length > 0)
1445 jalview.structure.StructureSelectionManager
1446 .getStructureSelectionManager(Desktop.instance).addMappings(mappings);
1450 // ensure vamsas object binds to the stored views retrieved from
1452 // jalview.structure.StructureSelectionManager
1453 // .getStructureSelectionManager()
1454 // .addStructureViewerListener(viewframe.alignPanel);
1459 newAlignmentViews.clear();
1463 * replaces oldjvobject with newjvobject in the Jalview Object <> VorbaID
1466 * @param oldjvobject
1467 * @param newjvobject
1470 private void replaceJvObjMapping(Object oldjvobject, Object newjvobject)
1472 Object vobject = jv2vobj.remove(oldjvobject);
1473 if (vobject == null)
1476 "IMPLEMENTATION ERROR: old jalview object is not bound ! ("
1477 + oldjvobject + ")");
1479 if (newjvobject != null)
1481 jv2vobj.put(newjvobject, vobject);
1482 vobj2jv.put(vobject, newjvobject);
1487 * Update the jalview client and user appdata from the local jalview settings
1489 public void updateJalviewClientAppdata()
1491 final IClientAppdata cappdata = cdoc.getClientAppdata();
1492 if (cappdata != null)
1496 jalview.gui.Jalview2XML jxml = new jalview.gui.Jalview2XML();
1497 jxml.setObjectMappingTables(mapKeysToString(vobj2jv),
1498 mapValuesToString(jv2vobj));
1499 jxml.setSkipList(skipList);
1502 jxml.SaveState(new JarOutputStream(cappdata
1503 .getClientOutputStream()));
1506 } catch (Exception e)
1508 // TODO raise GUI warning if user requests it.
1509 jalview.bin.Cache.log
1510 .error("Couldn't update jalview client application data. Giving up - local settings probably lost.",
1516 jalview.bin.Cache.log
1517 .error("Couldn't access client application data for vamsas session. This is probably a vamsas client bug.");
1522 * translate the Vobject keys to strings for use in Jalview2XML
1527 private IdentityHashMap mapValuesToString(IdentityHashMap jv2vobj2)
1529 IdentityHashMap mapped = new IdentityHashMap();
1530 Iterator keys = jv2vobj2.keySet().iterator();
1531 while (keys.hasNext())
1533 Object key = keys.next();
1534 mapped.put(key, jv2vobj2.get(key).toString());
1540 * translate the Vobject values to strings for use in Jalview2XML
1543 * @return hashtable with string values
1545 private Hashtable mapKeysToString(Hashtable vobj2jv2)
1547 Hashtable mapped = new Hashtable();
1548 Iterator keys = vobj2jv2.keySet().iterator();
1549 while (keys.hasNext())
1551 Object key = keys.next();
1552 mapped.put(key.toString(), vobj2jv2.get(key));
1558 * synchronize Jalview from the vamsas document
1560 * @return number of new views from document
1562 public int updateToJalview()
1564 VAMSAS _roots[] = cdoc.getVamsasRoots();
1566 for (int _root = 0; _root < _roots.length; _root++)
1568 VAMSAS root = _roots[_root];
1569 boolean newds = false;
1570 for (int _ds = 0, _nds = root.getDataSetCount(); _ds < _nds; _ds++)
1572 // ///////////////////////////////////
1574 DataSet dataset = root.getDataSet(_ds);
1575 int i, iSize = dataset.getSequenceCount();
1577 jalview.datamodel.Alignment jdataset = (jalview.datamodel.Alignment) getvObj2jv(dataset);
1579 if (jdataset == null)
1581 Cache.log.debug("Initialising new jalview dataset fields");
1583 dsseqs = new Vector();
1587 Cache.log.debug("Update jalview dataset from vamsas.");
1588 jremain = jdataset.getHeight();
1589 dsseqs = jdataset.getSequences();
1592 // TODO: test sequence merging - we preserve existing non vamsas
1593 // sequences but add in any new vamsas ones, and don't yet update any
1594 // sequence attributes
1595 for (i = 0; i < iSize; i++)
1597 Sequence vdseq = dataset.getSequence(i);
1598 jalview.io.vamsas.Datasetsequence dssync = new Datasetsequence(
1601 jalview.datamodel.SequenceI dsseq = (SequenceI) dssync.getJvobj();
1602 if (dssync.isAddfromdoc())
1606 if (vdseq.getDbRefCount() > 0)
1608 DbRef[] dbref = vdseq.getDbRef();
1609 for (int db = 0; db < dbref.length; db++)
1611 new jalview.io.vamsas.Dbref(this, dbref[db], vdseq, dsseq);
1614 dsseq.updatePDBIds();
1620 SequenceI[] seqs = new SequenceI[dsseqs.size()];
1621 for (i = 0, iSize = dsseqs.size(); i < iSize; i++)
1623 seqs[i] = (SequenceI) dsseqs.elementAt(i);
1624 dsseqs.setElementAt(null, i);
1626 jdataset = new jalview.datamodel.Alignment(seqs);
1627 Cache.log.debug("New vamsas dataset imported into jalview.");
1628 bindjvvobj(jdataset, dataset);
1631 // add any new dataset sequence feature annotations
1632 if (dataset.getDataSetAnnotations() != null)
1634 for (int dsa = 0; dsa < dataset.getDataSetAnnotationsCount(); dsa++)
1636 DataSetAnnotations dseta = dataset.getDataSetAnnotations(dsa);
1637 // TODO: deal with group annotation on datset sequences.
1638 if (dseta.getSeqRefCount() == 1)
1640 SequenceI dsSeq = (SequenceI) getvObj2jv((Vobject) dseta
1641 .getSeqRef(0)); // TODO: deal with group dataset
1645 jalview.bin.Cache.log
1646 .warn("Couldn't resolve jalview sequenceI for dataset object reference "
1647 + ((Vobject) dataset.getDataSetAnnotations(
1648 dsa).getSeqRef(0)).getVorbaId()
1653 if (dseta.getAnnotationElementCount() == 0)
1655 new jalview.io.vamsas.Sequencefeature(this, dseta, dsSeq);
1660 // TODO: deal with alignmentAnnotation style annotation
1661 // appearing on dataset sequences.
1662 // JBPNote: we could just add them to all alignments but
1663 // that may complicate cross references in the jalview
1666 .warn("Ignoring dataset annotation with annotationElements. Not yet supported in jalview.");
1673 .warn("Ignoring multiply referenced dataset sequence annotation for binding to datsaet sequence features.");
1677 if (dataset.getAlignmentCount() > 0)
1679 // LOAD ALIGNMENTS from DATASET
1681 for (int al = 0, nal = dataset.getAlignmentCount(); al < nal; al++)
1683 uk.ac.vamsas.objects.core.Alignment alignment = dataset
1685 // TODO check this handles multiple views properly
1686 AlignViewport av = findViewport(alignment);
1688 jalview.datamodel.AlignmentI jal = null;
1691 // TODO check that correct alignment object is retrieved when
1692 // hidden seqs exist.
1693 jal = (av.hasHiddenRows()) ? av.getAlignment()
1694 .getHiddenSequences().getFullAlignment() : av
1697 iSize = alignment.getAlignmentSequenceCount();
1698 boolean refreshal = false;
1699 Vector newasAnnots = new Vector();
1700 char gapChar = ' '; // default for new alignments read in from the
1704 dsseqs = jal.getSequences(); // for merge/update
1705 gapChar = jal.getGapCharacter();
1709 dsseqs = new Vector();
1711 char valGapchar = alignment.getGapChar().charAt(0);
1712 for (i = 0; i < iSize; i++)
1714 AlignmentSequence valseq = alignment.getAlignmentSequence(i);
1715 jalview.datamodel.Sequence alseq = (jalview.datamodel.Sequence) getvObj2jv(valseq);
1716 if (syncFromAlignmentSequence(valseq, valGapchar, gapChar,
1717 dsseqs) && alseq != null)
1720 // updated to sequence from the document
1724 if (valseq.getAlignmentSequenceAnnotationCount() > 0)
1726 AlignmentSequenceAnnotation[] vasannot = valseq
1727 .getAlignmentSequenceAnnotation();
1728 for (int a = 0; a < vasannot.length; a++)
1730 jalview.datamodel.AlignmentAnnotation asa = (jalview.datamodel.AlignmentAnnotation) getvObj2jv(vasannot[a]); // TODO:
1738 int se[] = getBounds(vasannot[a]);
1739 asa = getjAlignmentAnnotation(jal, vasannot[a]);
1740 asa.setSequenceRef(alseq);
1741 asa.createSequenceMapping(alseq, se[0], false); // TODO:
1752 alseq.addAlignmentAnnotation(asa);
1753 bindjvvobj(asa, vasannot[a]);
1755 newasAnnots.add(asa);
1759 // update existing annotation - can do this in place
1760 if (vasannot[a].getModifiable() == null) // TODO: USE
1766 .info("UNIMPLEMENTED: not recovering user modifiable sequence alignment annotation");
1767 // TODO: should at least replace with new one - otherwise
1768 // things will break
1769 // basically do this:
1770 // int se[] = getBounds(vasannot[a]);
1771 // asa.update(getjAlignmentAnnotation(jal, vasannot[a]));
1772 // // update from another annotation object in place.
1773 // asa.createSequenceMapping(alseq, se[0], false);
1782 SequenceI[] seqs = new SequenceI[dsseqs.size()];
1783 for (i = 0, iSize = dsseqs.size(); i < iSize; i++)
1785 seqs[i] = (SequenceI) dsseqs.elementAt(i);
1786 dsseqs.setElementAt(null, i);
1788 jal = new jalview.datamodel.Alignment(seqs);
1789 Cache.log.debug("New vamsas alignment imported into jalview "
1790 + alignment.getVorbaId().getId());
1791 jal.setDataset(jdataset);
1793 if (newasAnnots != null && newasAnnots.size() > 0)
1795 // Add the new sequence annotations in to the alignment.
1796 for (int an = 0, anSize = newasAnnots.size(); an < anSize; an++)
1798 jal.addAnnotation((AlignmentAnnotation) newasAnnots
1800 // TODO: check if anything has to be done - like calling
1801 // adjustForAlignment or something.
1802 newasAnnots.setElementAt(null, an);
1806 // //////////////////////////////////////////
1807 // //LOAD ANNOTATIONS FOR THE ALIGNMENT
1808 // ////////////////////////////////////
1809 if (alignment.getAlignmentAnnotationCount() > 0)
1811 uk.ac.vamsas.objects.core.AlignmentAnnotation[] an = alignment
1812 .getAlignmentAnnotation();
1814 for (int j = 0; j < an.length; j++)
1816 jalview.datamodel.AlignmentAnnotation jan = (jalview.datamodel.AlignmentAnnotation) getvObj2jv(an[j]);
1819 // update or stay the same.
1820 // TODO: should at least replace with a new one - otherwise
1821 // things will break
1822 // basically do this:
1823 // jan.update(getjAlignmentAnnotation(jal, an[a])); // update
1824 // from another annotation object in place.
1827 .debug("update from vamsas alignment annotation to existing jalview alignment annotation.");
1828 if (an[j].getModifiable() == null) // TODO: USE VAMSAS
1829 // LIBRARY OBJECT LOCK
1832 // TODO: user defined annotation is totally mutable... - so
1833 // load it up or throw away if locally edited.
1835 .info("NOT IMPLEMENTED - Recovering user-modifiable annotation - yet...");
1837 // TODO: compare annotation element rows
1838 // TODO: compare props.
1842 jan = getjAlignmentAnnotation(jal, an[j]);
1843 // TODO: ensure we add the alignment annotation before the
1844 // automatic annotation rows
1845 jal.addAnnotation(jan);
1846 bindjvvobj(jan, an[j]);
1851 AlignFrame alignFrame;
1854 Cache.log.debug("New alignframe for alignment "
1855 + alignment.getVorbaId());
1856 // ///////////////////////////////
1857 // construct alignment view
1858 alignFrame = new AlignFrame(jal, AlignFrame.DEFAULT_WIDTH,
1859 AlignFrame.DEFAULT_HEIGHT, alignment.getVorbaId()
1861 av = alignFrame.getViewport();
1862 newAlignmentViews.addElement(av);
1863 String title = alignment
1866 alignment.getProvenance().getEntryCount() - 1)
1868 if (alignment.getPropertyCount() > 0)
1870 for (int p = 0, pe = alignment.getPropertyCount(); p < pe; p++)
1872 if (alignment.getProperty(p).getName().equals("title"))
1874 title = alignment.getProperty(p).getContent();
1878 // TODO: automatically create meaningful title for a vamsas
1879 // alignment using its provenance.
1880 if (Cache.log.isDebugEnabled())
1882 title = title + "(" + alignment.getVorbaId() + ")";
1885 jalview.gui.Desktop.addInternalFrame(alignFrame, title,
1886 AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
1887 bindjvvobj(av.getSequenceSetId(), alignment);
1891 // find the alignFrame for jal.
1892 // TODO: fix this so we retrieve the alignFrame handing av
1893 // *directly* (JBPNote - don't understand this now)
1894 // TODO: make sure all associated views are refreshed
1895 alignFrame = Desktop.getAlignFrameFor(av);
1898 av.alignmentChanged(alignFrame.alignPanel);
1899 alignFrame.alignPanel.adjustAnnotationHeight();
1903 // /////////////////////////////////////
1904 if (alignment.getTreeCount() > 0)
1907 for (int t = 0; t < alignment.getTreeCount(); t++)
1909 jalview.io.vamsas.Tree vstree = new jalview.io.vamsas.Tree(
1910 this, alignFrame, alignment.getTree(t));
1911 TreePanel tp = null;
1912 if (vstree.isValidTree())
1914 tp = alignFrame.ShowNewickTree(vstree.getNewickTree(),
1915 vstree.getTitle(), vstree.getInputData(), 600,
1916 500, t * 20 + 50, t * 20 + 50);
1921 bindjvvobj(tp, alignment.getTree(t));
1924 vstree.UpdateSequenceTreeMap(tp);
1925 } catch (RuntimeException e)
1927 Cache.log.warn("update of labels failed.", e);
1932 Cache.log.warn("Cannot create tree for tree " + t
1934 + alignment.getTree(t).getVorbaId());
1942 // we do sequenceMappings last because they span all datasets in a vamsas
1944 for (int _ds = 0, _nds = root.getDataSetCount(); _ds < _nds; _ds++)
1946 DataSet dataset = root.getDataSet(_ds);
1947 if (dataset.getSequenceMappingCount() > 0)
1949 for (int sm = 0, smCount = dataset.getSequenceMappingCount(); sm < smCount; sm++)
1951 Rangetype seqmap = new jalview.io.vamsas.Sequencemapping(this,
1952 dataset.getSequenceMapping(sm));
1957 return newAlignmentViews.size();
1960 public AlignViewport findViewport(Alignment alignment)
1962 AlignViewport av = null;
1963 AlignViewport[] avs = Desktop
1964 .getViewports((String) getvObj2jv(alignment));
1972 // bitfields - should be a template in j1.5
1973 private static int HASSECSTR = 0;
1975 private static int HASVALS = 1;
1977 private static int HASHPHOB = 2;
1979 private static int HASDC = 3;
1981 private static int HASDESCSTR = 4;
1983 private static int HASTWOSTATE = 5; // not used yet.
1986 * parses the AnnotationElements - if they exist - into
1987 * jalview.datamodel.Annotation[] rows Two annotation rows are made if there
1988 * are distinct annotation for both at 'pos' and 'after pos' at any particular
1992 * @return { boolean[static int constants ], int[ae.length] - map to annotated
1993 * object frame, jalview.datamodel.Annotation[],
1994 * jalview.datamodel.Annotation[] (after)}
1996 private Object[] parseRangeAnnotation(
1997 uk.ac.vamsas.objects.core.RangeAnnotation annotation)
1999 // set these attributes by looking in the annotation to decide what kind of
2000 // alignment annotation rows will be made
2001 // TODO: potentially we might make several annotation rows from one vamsas
2002 // alignment annotation. the jv2Vobj binding mechanism
2003 // may not quite cope with this (without binding an array of annotations to
2004 // a vamsas alignment annotation)
2005 // summary flags saying what we found over the set of annotation rows.
2006 boolean[] AeContent = new boolean[]
2007 { false, false, false, false, false };
2008 int[] rangeMap = getMapping(annotation);
2009 jalview.datamodel.Annotation[][] anot = new jalview.datamodel.Annotation[][]
2010 { new jalview.datamodel.Annotation[rangeMap.length],
2011 new jalview.datamodel.Annotation[rangeMap.length] };
2012 boolean mergeable = true; // false if 'after positions cant be placed on
2013 // same annotation row as positions.
2015 if (annotation.getAnnotationElementCount() > 0)
2017 AnnotationElement ae[] = annotation.getAnnotationElement();
2018 for (int aa = 0; aa < ae.length; aa++)
2020 int pos = (int) ae[aa].getPosition() - 1; // pos counts from 1 to
2021 // (|seg.start-seg.end|+1)
2022 if (pos >= 0 && pos < rangeMap.length)
2024 int row = ae[aa].getAfter() ? 1 : 0;
2025 if (anot[row][pos] != null)
2027 // only time this should happen is if the After flag is set.
2028 Cache.log.debug("Ignoring duplicate annotation site at " + pos);
2031 if (anot[1 - row][pos] != null)
2036 if (ae[aa].getDescription() != null)
2038 desc = ae[aa].getDescription();
2039 if (desc.length() > 0)
2041 // have imported valid description string
2042 AeContent[HASDESCSTR] = true;
2045 String dc = null; // ae[aa].getDisplayCharacter()==null ? "dc" :
2046 // ae[aa].getDisplayCharacter();
2047 String ss = null; // ae[aa].getSecondaryStructure()==null ? "ss" :
2048 // ae[aa].getSecondaryStructure();
2049 java.awt.Color colour = null;
2050 if (ae[aa].getGlyphCount() > 0)
2052 Glyph[] glyphs = ae[aa].getGlyph();
2053 for (int g = 0; g < glyphs.length; g++)
2057 .equals(uk.ac.vamsas.objects.utils.GlyphDictionary.PROTEIN_SS_3STATE))
2059 ss = glyphs[g].getContent();
2060 AeContent[HASSECSTR] = true;
2064 .equals(uk.ac.vamsas.objects.utils.GlyphDictionary.PROTEIN_HD_HYDRO))
2066 Cache.log.debug("ignoring hydrophobicity glyph marker.");
2067 AeContent[HASHPHOB] = true;
2068 char c = (dc = glyphs[g].getContent()).charAt(0);
2069 // dc may get overwritten - but we still set the colour.
2070 colour = new java.awt.Color(c == '+' ? 255 : 0,
2071 c == '.' ? 255 : 0, c == '-' ? 255 : 0);
2074 else if (glyphs[g].getDict().equals(
2075 uk.ac.vamsas.objects.utils.GlyphDictionary.DEFAULT))
2077 dc = glyphs[g].getContent();
2078 AeContent[HASDC] = true;
2083 .debug("IMPLEMENTATION TODO: Ignoring unknown glyph type "
2084 + glyphs[g].getDict());
2089 if (ae[aa].getValueCount() > 0)
2091 AeContent[HASVALS] = true;
2092 if (ae[aa].getValueCount() > 1)
2094 Cache.log.warn("ignoring additional "
2095 + (ae[aa].getValueCount() - 1)
2096 + " values in annotation element.");
2098 val = ae[aa].getValue(0);
2102 anot[row][pos] = new jalview.datamodel.Annotation(
2103 (dc != null) ? dc : "", desc,
2104 (ss != null) ? ss.charAt(0) : ' ', val);
2108 anot[row][pos] = new jalview.datamodel.Annotation(
2109 (dc != null) ? dc : "", desc,
2110 (ss != null) ? ss.charAt(0) : ' ', val, colour);
2115 Cache.log.warn("Ignoring out of bound annotation element " + aa
2116 + " in " + annotation.getVorbaId().getId());
2119 // decide on how many annotation rows are needed.
2122 for (int i = 0; i < anot[0].length; i++)
2124 if (anot[1][i] != null)
2126 anot[0][i] = anot[1][i];
2127 anot[0][i].description = anot[0][i].description + " (after)";
2128 AeContent[HASDESCSTR] = true; // we have valid description string
2137 for (int i = 0; i < anot[0].length; i++)
2139 anot[1][i].description = anot[1][i].description + " (after)";
2143 { AeContent, rangeMap, anot[0], anot[1] };
2147 // no annotations to parse. Just return an empty annotationElement[]
2150 { AeContent, rangeMap, anot[0], anot[1] };
2157 * the jalview alignment to which the annotation will be attached
2158 * (ideally - freshly updated from corresponding vamsas alignment)
2160 * @return unbound jalview alignment annotation object.
2162 private jalview.datamodel.AlignmentAnnotation getjAlignmentAnnotation(
2163 jalview.datamodel.AlignmentI jal,
2164 uk.ac.vamsas.objects.core.RangeAnnotation annotation)
2166 if (annotation == null)
2171 // hasSequenceRef=annotation.getClass().equals(uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation.class);
2172 // boolean hasProvenance=hasSequenceRef ||
2173 // (annotation.getClass().equals(uk.ac.vamsas.objects.core.AlignmentAnnotation.class));
2175 * int se[] = getBounds(annotation); if (se==null) se=new int[]
2176 * {0,jal.getWidth()-1};
2178 Object[] parsedRangeAnnotation = parseRangeAnnotation(annotation);
2179 String a_label = annotation.getLabel();
2180 String a_descr = annotation.getDescription();
2181 GraphLine gl = null;
2183 boolean interp = true; // cleared if annotation is DISCRETE
2184 // set type and other attributes from properties
2185 if (annotation.getPropertyCount() > 0)
2187 // look for special jalview properties
2188 uk.ac.vamsas.objects.core.Property[] props = annotation.getProperty();
2189 for (int p = 0; p < props.length; p++)
2191 if (props[p].getName().equalsIgnoreCase(DISCRETE_ANNOTATION))
2193 type = AlignmentAnnotation.BAR_GRAPH;
2196 else if (props[p].getName().equalsIgnoreCase(CONTINUOUS_ANNOTATION))
2198 type = AlignmentAnnotation.LINE_GRAPH;
2200 else if (props[p].getName().equalsIgnoreCase(THRESHOLD))
2205 val = new Float(props[p].getContent());
2206 } catch (Exception e)
2208 Cache.log.warn("Failed to parse threshold property");
2213 gl = new GraphLine(val.floatValue(), "", java.awt.Color.black);
2217 gl.value = val.floatValue();
2220 else if (props[p].getName().equalsIgnoreCase(THRESHOLD + "Name"))
2223 gl = new GraphLine(0, "", java.awt.Color.black);
2224 gl.label = props[p].getContent();
2228 jalview.datamodel.AlignmentAnnotation jan = null;
2229 if (a_label == null || a_label.length() == 0)
2231 a_label = annotation.getType();
2232 if (a_label.length() == 0)
2234 a_label = "Unamed annotation";
2237 if (a_descr == null || a_descr.length() == 0)
2239 a_descr = "Annotation of type '" + annotation.getType() + "'";
2241 if (parsedRangeAnnotation == null)
2244 .debug("Inserting empty annotation row elements for a whole-alignment annotation.");
2248 if (parsedRangeAnnotation[3] != null)
2250 Cache.log.warn("Ignoring 'After' annotation row in "
2251 + annotation.getVorbaId());
2253 jalview.datamodel.Annotation[] arow = (jalview.datamodel.Annotation[]) parsedRangeAnnotation[2];
2254 boolean[] has = (boolean[]) parsedRangeAnnotation[0];
2255 // VAMSAS: getGraph is only on derived annotation for alignments - in this
2256 // way its 'odd' - there is already an existing TODO about removing this
2257 // flag as being redundant
2259 * if((annotation.getClass().equals(uk.ac.vamsas.objects.core.
2260 * AlignmentAnnotation.class) &&
2261 * ((uk.ac.vamsas.objects.core.AlignmentAnnotation)annotation).getGraph())
2262 * || (hasSequenceRef=true &&
2263 * ((uk.ac.vamsas.objects.core.AlignmentSequenceAnnotation
2264 * )annotation).getGraph())) {
2270 type = jalview.datamodel.AlignmentAnnotation.BAR_GRAPH; // default
2276 // no hints - so we ensure HPHOB display is like this.
2277 type = jalview.datamodel.AlignmentAnnotation.BAR_GRAPH;
2280 // make bounds and automatic description strings for jalview user's
2281 // benefit (these shouldn't be written back to vamsas document)
2282 boolean first = true;
2283 float min = 0, max = 1;
2285 for (int i = 0; i < arow.length; i++)
2287 if (arow[i] != null)
2289 if (i - lastval > 1 && interp)
2291 // do some interpolation *between* points
2292 if (arow[lastval] != null)
2294 float interval = arow[i].value - arow[lastval].value;
2295 interval /= i - lastval;
2296 float base = arow[lastval].value;
2297 for (int ip = lastval + 1, np = 0; ip < i; np++, ip++)
2299 arow[ip] = new jalview.datamodel.Annotation("", "", ' ',
2300 interval * np + base);
2301 // NB - Interpolated points don't get a tooltip and
2307 // check range - shouldn't we have a min and max property in the
2308 // annotation object ?
2311 min = max = arow[i].value;
2316 if (arow[i].value < min)
2318 min = arow[i].value;
2320 else if (arow[i].value > max)
2322 max = arow[i].value;
2325 // make tooltip and display char value
2326 if (!has[HASDESCSTR])
2328 arow[i].description = arow[i].value + "";
2334 if (arow[i].description != null
2335 && arow[i].description.length() < 3)
2337 // copy over the description as the display char.
2338 arow[i].displayCharacter = new String(arow[i].description);
2343 // mark the position as a point used for the interpolation.
2344 arow[i].displayCharacter = arow[i].value + "";
2349 jan = new jalview.datamodel.AlignmentAnnotation(a_label, a_descr,
2350 arow, min, max, type);
2354 if (annotation.getAnnotationElementCount() == 0)
2356 // empty annotation array
2357 // TODO: alignment 'features' compare rangeType spec to alignment
2358 // width - if it is not complete, then mark regions on the annotation
2361 jan = new jalview.datamodel.AlignmentAnnotation(a_label, a_descr,
2363 jan.setThreshold(null);
2364 jan.annotationId = annotation.getVorbaId().toString(); // keep all the
2367 if (annotation.getLinkCount() > 0)
2369 Cache.log.warn("Ignoring " + annotation.getLinkCount()
2370 + "links added to AlignmentAnnotation.");
2372 if (annotation.getModifiable() == null
2373 || annotation.getModifiable().length() == 0) // TODO: USE VAMSAS
2377 jan.editable = true;
2381 if (annotation.getGroup() != null
2382 && annotation.getGroup().length() > 0)
2384 jan.graphGroup = Integer.parseInt(annotation.getGroup()); // TODO:
2392 } catch (Exception e)
2395 .info("UNIMPLEMENTED : Couldn't parse non-integer group value for setting graphGroup correctly.");
2405 * get real bounds of a RangeType's specification. start and end are an
2406 * inclusive range within which all segments and positions lie. TODO: refactor
2410 * @return int[] { start, end}
2412 private int[] getBounds(RangeType dseta)
2417 if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)
2420 "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");
2422 if (dseta.getSegCount() > 0)
2424 se = getSegRange(dseta.getSeg(0), true);
2425 for (int s = 1, sSize = dseta.getSegCount(); s < sSize; s++)
2427 int nse[] = getSegRange(dseta.getSeg(s), true);
2438 if (dseta.getPosCount() > 0)
2440 // could do a polarity for pos range too. and pass back indication of
2442 int pos = dseta.getPos(0).getI();
2445 for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)
2447 pos = dseta.getPos(p).getI();
2464 * map from a rangeType's internal frame to the referenced object's coordinate
2468 * @return int [] { ref(pos)...} for all pos in rangeType's frame.
2470 private int[] getMapping(RangeType dseta)
2472 Vector posList = new Vector();
2476 if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0)
2479 "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");
2481 if (dseta.getSegCount() > 0)
2483 for (int s = 0, sSize = dseta.getSegCount(); s < sSize; s++)
2485 se = getSegRange(dseta.getSeg(s), false);
2486 int se_end = se[1 - se[2]] + (se[2] == 0 ? 1 : -1);
2487 for (int p = se[se[2]]; p != se_end; p += se[2] == 0 ? 1 : -1)
2489 posList.add(new Integer(p));
2493 else if (dseta.getPosCount() > 0)
2495 int pos = dseta.getPos(0).getI();
2497 for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)
2499 pos = dseta.getPos(p).getI();
2500 posList.add(new Integer(pos));
2504 if (posList != null && posList.size() > 0)
2506 int[] range = new int[posList.size()];
2507 for (int i = 0; i < range.length; i++)
2509 range[i] = ((Integer) posList.elementAt(i)).intValue();
2520 * where the from range is the local mapped range, and the to range
2521 * is the 'mapped' range in the MapRangeType
2522 * @param default unit for local
2523 * @param default unit for mapped
2526 private jalview.util.MapList parsemapType(MapType maprange, int localu,
2529 jalview.util.MapList ml = null;
2530 int[] localRange = getMapping(maprange.getLocal());
2531 int[] mappedRange = getMapping(maprange.getMapped());
2532 long lu = maprange.getLocal().hasUnit() ? maprange.getLocal().getUnit()
2534 long mu = maprange.getMapped().hasUnit() ? maprange.getMapped()
2535 .getUnit() : mappedu;
2536 ml = new jalview.util.MapList(localRange, mappedRange, (int) lu,
2542 * initialise a range type object from a set of start/end inclusive intervals
2547 private void initRangeType(RangeType mrt, int[] range)
2549 for (int i = 0; i < range.length; i += 2)
2551 Seg vSeg = new Seg();
2552 vSeg.setStart(range[i]);
2553 vSeg.setEnd(range[i + 1]);
2559 * initialise a MapType object from a MapList object.
2565 private void initMapType(MapType maprange, jalview.util.MapList ml,
2568 maprange.setLocal(new Local());
2569 maprange.setMapped(new Mapped());
2570 initRangeType(maprange.getLocal(), ml.getFromRanges());
2571 initRangeType(maprange.getMapped(), ml.getToRanges());
2574 maprange.getLocal().setUnit(ml.getFromRatio());
2575 maprange.getLocal().setUnit(ml.getToRatio());
2580 * not needed now. Provenance getVamsasProvenance(jalview.datamodel.Provenance
2581 * jprov) { jalview.datamodel.ProvenanceEntry[] entries = null; // TODO: fix
2582 * App and Action here. Provenance prov = new Provenance();
2583 * org.exolab.castor.types.Date date = new org.exolab.castor.types.Date( new
2584 * java.util.Date()); Entry provEntry;
2586 * if (jprov != null) { entries = jprov.getEntries(); for (int i = 0; i <
2587 * entries.length; i++) { provEntry = new Entry(); try { date = new
2588 * org.exolab.castor.types.Date(entries[i].getDate()); } catch (Exception ex)
2589 * { ex.printStackTrace();
2591 * date = new org.exolab.castor.types.Date(entries[i].getDate()); }
2592 * provEntry.setDate(date); provEntry.setUser(entries[i].getUser());
2593 * provEntry.setAction(entries[i].getAction()); prov.addEntry(provEntry); } }
2594 * else { provEntry = new Entry(); provEntry.setDate(date);
2595 * provEntry.setUser(System.getProperty("user.name")); // TODO: ext string
2596 * provEntry.setApp("JVAPP"); // TODO: ext string provEntry.setAction(action);
2597 * prov.addEntry(provEntry); }
2601 jalview.datamodel.Provenance getJalviewProvenance(Provenance prov)
2603 // TODO: fix App and Action entries and check use of provenance in jalview.
2604 jalview.datamodel.Provenance jprov = new jalview.datamodel.Provenance();
2605 for (int i = 0; i < prov.getEntryCount(); i++)
2607 jprov.addEntry(prov.getEntry(i).getUser(), prov.getEntry(i)
2608 .getAction(), prov.getEntry(i).getDate(), prov.getEntry(i)
2617 * @return default initial provenance list for a Jalview created vamsas
2620 Provenance dummyProvenance()
2622 return dummyProvenance(null);
2625 Entry dummyPEntry(String action)
2627 Entry entry = new Entry();
2628 entry.setApp(this.provEntry.getApp());
2631 entry.setAction(action);
2635 entry.setAction("created.");
2637 entry.setDate(new java.util.Date());
2638 entry.setUser(this.provEntry.getUser());
2642 Provenance dummyProvenance(String action)
2644 Provenance prov = new Provenance();
2645 prov.addEntry(dummyPEntry(action));
2649 Entry addProvenance(Provenance p, String action)
2651 Entry dentry = dummyPEntry(action);
2656 public Entry getProvEntry()
2661 public IClientDocument getClientDocument()
2666 public IdentityHashMap getJvObjectBinding()
2671 public Hashtable getVamsasObjectBinding()
2676 public void storeSequenceMappings(AlignViewport viewport, String title)
2679 AlignViewport av = viewport;
2682 jalview.datamodel.AlignmentI jal = av.getAlignment();
2683 // /////////////////////////////////////////
2685 DataSet dataset = null;
2686 if (jal.getDataset() == null)
2688 Cache.log.warn("Creating new dataset for an alignment.");
2689 jal.setDataset(null);
2691 dataset = (DataSet) ((Alignment) getjv2vObj(viewport
2692 .getSequenceSetId())).getV_parent(); // jal.getDataset());
2693 if (dataset == null)
2695 dataset = (DataSet) getjv2vObj(jal.getDataset());
2697 .error("Can't find the correct dataset for the alignment in this view. Creating new one.");
2700 // Store any sequence mappings.
2701 if (av.getAlignment().getCodonFrames() != null
2702 && av.getAlignment().getCodonFrames().length > 0)
2704 jalview.datamodel.AlignedCodonFrame[] cframes = av.getAlignment()
2706 for (int cf = 0; cf < cframes.length; cf++)
2708 if (cframes[cf].getdnaSeqs() != null
2709 && cframes[cf].getdnaSeqs().length > 0)
2711 jalview.datamodel.SequenceI[] dmps = cframes[cf].getdnaSeqs();
2712 jalview.datamodel.Mapping[] mps = cframes[cf].getProtMappings();
2713 for (int smp = 0; smp < mps.length; smp++)
2715 uk.ac.vamsas.objects.core.SequenceType mfrom = (SequenceType) getjv2vObj(dmps[smp]);
2718 new jalview.io.vamsas.Sequencemapping(this, mps[smp],
2724 .warn("NO Vamsas Binding for local sequence! NOT CREATING MAPPING FOR "
2725 + dmps[smp].getDisplayId(true)
2727 + mps[smp].getTo().getName());
2733 } catch (Exception e)
2735 throw new Exception("Couldn't store sequence mappings for " + title,
2740 public void clearSkipList()
2742 if (skipList != null)
2749 * @return the skipList
2751 public Hashtable getSkipList()
2758 * the skipList to set
2760 public void setSkipList(Hashtable skipList)
2762 this.skipList = skipList;
2766 * registry for datastoreItems
2768 DatastoreRegistry dsReg = new DatastoreRegistry();
2770 public DatastoreRegistry getDatastoreRegisty()
2774 dsReg = new DatastoreRegistry();