- sequence = new Sequence();
- bindjvvobj(sq, sequence);
- sq.setVamsasId(sequence.getVorbaId().getId());
- sequence.setSequence(sq.getSequenceAsString());
- sequence.setDictionary(dict);
- sequence.setName(sq.getName());
- sequence.setStart(sq.getStart());
- sequence.setEnd(sq.getEnd());
- sequence.setDescription(sq.getDescription());
- dataset.addSequence(sequence);
- dssmods.addElement(dssmods);
- }
- else
- {
- boolean dsmod = false;
- // verify and update principal attributes.
- 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.getStart() != sq.getStart()
- || sequence.getEnd() != sq.getEnd())
- {
- // update modified sequence.
- sequence.setSequence(sq.getSequenceAsString());
- sequence.setStart(sq.getStart());
- sequence.setEnd(sq.getEnd());
- dsmod = true;
- }
- }
- if (!dict.equals(sequence.getDictionary()))
- {
- sequence.setDictionary(dict);
- dsmod = true;
- }
- if (!sequence.getName().equals(sq.getName()))
- {
- sequence.setName(sq.getName());
- dsmod = true;
- }
- if (dsmod)
- {
- dssmods.addElement(sequence);
- }
- }
- // add or update any new features/references on dataset sequence
- if (sq.getSequenceFeatures() != null)
- {
- int sfSize = sq.getSequenceFeatures().length;
-
- for (int sf = 0; sf < sfSize; sf++)
- {
- // TODO: update/modifiable synchronizer
- jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) sq
- .getSequenceFeatures()[sf];
-
- DataSetAnnotations dsa = (DataSetAnnotations) getjv2vObj(feature);
- if (dsa == null)
- {
- dsa = (DataSetAnnotations) getDSAnnotationFromJalview(
- new DataSetAnnotations(), feature);
- if (dsa.getProvenance() == null)
- {
- dsa.setProvenance(new Provenance());
- }
- addProvenance(dsa.getProvenance(), "created"); // JBPNote - need
- // to update
- dsa.addSeqRef(sequence); // we have just created this annotation
- // - so safe to use this
- bindjvvobj(feature, dsa);
- dataset.addDataSetAnnotations(dsa);
- }
- else
- {
- // todo: verify and update dataset annotations for sequence
- System.out.println("update dataset sequence annotations.");
- }
- }
- }
-
- if (sq.getDBRef() != null)
- {
- DBRefEntry[] entries = sq.getDBRef();
- jalview.datamodel.DBRefEntry dbentry;
- for (int db = 0; db < entries.length; db++)
- {
- Rangetype dbr = new jalview.io.vamsas.Dbref(this,
- dbentry = entries[db], sq, sequence);
- }
-