jal = av.getAlignment();
}
// SAVE MAPPINGS
- if (jal.getCodonFrames() != null)
+ // FOR DATASET
+ if (storeDS && jal.getCodonFrames() != null)
{
List<AlignedCodonFrame> jac = jal.getCodonFrames();
for (AlignedCodonFrame acf : jac)
if (jds.getDatasetSequence() != null)
{
vamsasSeq.setDsseqid(seqHash(jds.getDatasetSequence()));
- if (jds.getDatasetSequence().getDBRefs() != null)
- {
- dbrefs = jds.getDatasetSequence().getDBRefs();
- }
}
else
{
- vamsasSeq.setDsseqid(id); // so we can tell which sequences really are
+ // seqId==dsseqid so we can tell which sequences really are
// dataset sequences only
+ vamsasSeq.setDsseqid(id);
dbrefs = jds.getDBRefs();
+ if (parentseq == null)
+ {
+ parentseq = jds;
+ }
}
if (dbrefs != null)
{
if (jmp.getTo() != null)
{
MappingChoice mpc = new MappingChoice();
- if (recurse
- && (parentseq != jmp.getTo() || parentseq
- .getDatasetSequence() != jmp.getTo()))
+
+ // check/create ID for the sequence referenced by getTo()
+
+ String jmpid = "";
+ SequenceI ps = null;
+ if (parentseq != jmp.getTo()
+ && parentseq.getDatasetSequence() != jmp.getTo())
{
- mpc.setSequence(createVamsasSequence(false, seqHash(jmp.getTo()),
- jmp.getTo(), jds));
+ // chaining dbref rather than a handshaking one
+ jmpid = seqHash(ps = jmp.getTo());
}
else
{
- String jmpid = "";
- SequenceI ps = null;
- if (parentseq != jmp.getTo()
- && parentseq.getDatasetSequence() != jmp.getTo())
- {
- // chaining dbref rather than a handshaking one
- jmpid = seqHash(ps = jmp.getTo());
- }
- else
- {
- jmpid = seqHash(ps = parentseq);
- }
- mpc.setDseqFor(jmpid);
- if (!seqRefIds.containsKey(mpc.getDseqFor()))
- {
- jalview.bin.Cache.log.debug("creatign new DseqFor ID");
- seqRefIds.put(mpc.getDseqFor(), ps);
- }
- else
- {
- jalview.bin.Cache.log.debug("reusing DseqFor ID");
- }
+ jmpid = seqHash(ps = parentseq);
+ }
+ mpc.setDseqFor(jmpid);
+ if (!seqRefIds.containsKey(mpc.getDseqFor()))
+ {
+ jalview.bin.Cache.log.debug("creatign new DseqFor ID");
+ seqRefIds.put(mpc.getDseqFor(), ps);
}
+ else
+ {
+ jalview.bin.Cache.log.debug("reusing DseqFor ID");
+ }
+
mp.setMappingChoice(mpc);
}
}
SequenceI[] orderedSeqs = tmpseqs
.toArray(new SequenceI[tmpseqs.size()]);
- AlignmentI al = new Alignment(orderedSeqs);
+ AlignmentI al = null;
+ // so we must create or recover the dataset alignment before going further
+ // ///////////////////////////////
+ if (vamsasSet.getDatasetId() == null || vamsasSet.getDatasetId() == "")
+ {
+ // older jalview projects do not have a dataset - so creat alignment and
+ // dataset
+ al = new Alignment(orderedSeqs);
+ al.setDataset(null);
+ }
+ else
+ {
+ boolean isdsal = object.getJalviewModelSequence().getViewportCount() == 0;
+ if (isdsal)
+ {
+ // we are importing a dataset record, so
+ // recover reference to an alignment already materialsed as dataset
+ al = getDatasetFor(vamsasSet.getDatasetId());
+ }
+ if (al == null)
+ {
+ // materialse the alignment
+ al = new Alignment(orderedSeqs);
+ }
+ if (isdsal)
+ {
+ addDatasetRef(vamsasSet.getDatasetId(), al);
+ }
+
+ // finally, verify all data in vamsasSet is actually present in al
+ // passing on flag indicating if it is actually a stored dataset
+ recoverDatasetFor(vamsasSet, al, isdsal);
+ }
if (referenceseqForView != null)
{
al.setProperty(ssp.getKey(), ssp.getValue());
}
- // /
- // SequenceFeatures are added to the DatasetSequence,
- // so we must create or recover the dataset before loading features
- // ///////////////////////////////
- if (vamsasSet.getDatasetId() == null || vamsasSet.getDatasetId() == "")
- {
- // older jalview projects do not have a dataset id.
- al.setDataset(null);
- }
- else
- {
- // recover dataset - passing on flag indicating if this a 'viewless'
- // sequence set (a.k.a. a stored dataset for the project)
- recoverDatasetFor(vamsasSet, al, object.getJalviewModelSequence()
- .getViewportCount() == 0);
- }
// ///////////////////////////////
Hashtable pdbloaded = new Hashtable(); // TODO nothing writes to this??