JSeq jseq;
Set<String> calcIdSet = new HashSet<String>();
-
+ // record the set of vamsas sequence XML POJO we create.
+ HashMap<String,Sequence> vamsasSetIds = new HashMap<String,Sequence>();
// SAVE SEQUENCES
for (final SequenceI jds : rjal.getSequences())
{
final SequenceI jdatasq = jds.getDatasetSequence() == null ? jds
: jds.getDatasetSequence();
String id = seqHash(jds);
-
- if (seqRefIds.get(id) != null)
- {
- // This happens for two reasons: 1. multiple views are being serialised.
- // 2. the hashCode has collided with another sequence's code. This DOES
- // HAPPEN! (PF00072.15.stk does this)
- // JBPNote: Uncomment to debug writing out of files that do not read
- // back in due to ArrayOutOfBoundExceptions.
- // System.err.println("vamsasSeq backref: "+id+"");
- // System.err.println(jds.getName()+"
- // "+jds.getStart()+"-"+jds.getEnd()+" "+jds.getSequenceAsString());
- // System.err.println("Hashcode: "+seqHash(jds));
- // SequenceI rsq = (SequenceI) seqRefIds.get(id + "");
- // System.err.println(rsq.getName()+"
- // "+rsq.getStart()+"-"+rsq.getEnd()+" "+rsq.getSequenceAsString());
- // System.err.println("Hashcode: "+seqHash(rsq));
- }
- else
- {
- vamsasSeq = createVamsasSequence(id, jds);
- vamsasSet.addSequence(vamsasSeq);
- seqRefIds.put(id, jds);
+ if (vamsasSetIds.get(id) == null)
+ {
+ if (seqRefIds.get(id) != null && !storeDS)
+ {
+ // This happens for two reasons: 1. multiple views are being
+ // serialised.
+ // 2. the hashCode has collided with another sequence's code. This
+ // DOES
+ // HAPPEN! (PF00072.15.stk does this)
+ // JBPNote: Uncomment to debug writing out of files that do not read
+ // back in due to ArrayOutOfBoundExceptions.
+ // System.err.println("vamsasSeq backref: "+id+"");
+ // System.err.println(jds.getName()+"
+ // "+jds.getStart()+"-"+jds.getEnd()+" "+jds.getSequenceAsString());
+ // System.err.println("Hashcode: "+seqHash(jds));
+ // SequenceI rsq = (SequenceI) seqRefIds.get(id + "");
+ // System.err.println(rsq.getName()+"
+ // "+rsq.getStart()+"-"+rsq.getEnd()+" "+rsq.getSequenceAsString());
+ // System.err.println("Hashcode: "+seqHash(rsq));
+ }
+ else
+ {
+ vamsasSeq = createVamsasSequence(id, jds);
+ vamsasSet.addSequence(vamsasSeq);
+ vamsasSetIds.put(id, vamsasSeq);
+ seqRefIds.put(id, jds);
+ }
}
-
jseq = new JSeq();
jseq.setStart(jds.getStart());
jseq.setEnd(jds.getEnd());
{
System.err
.println("Warning JAL-2154 regression: updating start/end for sequence "
- + tmpSeq.toString());
+ + tmpSeq.toString() + " to " + jseqs[i]);
}
} else {
incompleteSeqs.remove(seqId);
}
+ if (vamsasSeq[vi].getId().equals(seqId))
+ {
+ // most likely we are reading a dataset XML document so
+ // update from vamsasSeq section of XML for this sequence
+ tmpSeq.setName(vamsasSeq[vi].getName());
+ tmpSeq.setDescription(vamsasSeq[vi].getDescription());
+ tmpSeq.setSequence(vamsasSeq[vi].getSequence());
+ vi++;
+ }
+ else
+ {
+ // reading multiple views, so vamsasSeq set is a subset of JSeq
+ multipleView = true;
+ }
tmpSeq.setStart(jseqs[i].getStart());
tmpSeq.setEnd(jseqs[i].getEnd());
tmpseqs.add(tmpSeq);
- multipleView = true;
}
else
{
{
// load sequence features, database references and any associated PDB
// structures for the alignment
+ //
+ // prior to 2.10, this part would only be executed the first time a
+ // sequence was encountered, but not afterwards.
+ // now, for 2.10 projects, this is also done if the xml doc includes
+ // dataset sequences not actually present in any particular view.
+ //
for (int i = 0; i < vamsasSeq.length; i++)
{
if (jseqs[i].getFeaturesCount() > 0)
}
}
-
- al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf);
+ // adds feature to datasequence's feature set (since Jalview 2.10)
+ al.getSequenceAt(i).addSequenceFeature(sf);
}
}
if (vamsasSeq[i].getDBRefCount() > 0)
{
- addDBRefs(al.getSequenceAt(i).getDatasetSequence(), vamsasSeq[i]);
+ // adds dbrefs to datasequence's set (since Jalview 2.10)
+ addDBRefs(
+ al.getSequenceAt(i).getDatasetSequence() == null ? al.getSequenceAt(i)
+ : al.getSequenceAt(i).getDatasetSequence(),
+ vamsasSeq[i]);
}
if (jseqs[i].getPdbidsCount() > 0)
{
}
StructureSelectionManager.getStructureSelectionManager(
Desktop.instance).registerPDBEntry(entry);
- al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);
+ // adds PDBEntry to datasequence's set (since Jalview 2.10)
+ if (al.getSequenceAt(i).getDatasetSequence() != null)
+ {
+ al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);
+ }
+ else
+ {
+ al.getSequenceAt(i).addPDBId(entry);
+ }
}
}
}
if (maps[m].getMapping() != null)
{
mapping = addMapping(maps[m].getMapping());
- }
- if (dnaseq != null && mapping.getTo() != null)
- {
- cf.addMap(dnaseq, mapping.getTo(), mapping.getMap());
- }
- else
- {
- // defer to later
- frefedSequence.add(newAlcodMapRef(maps[m].getDnasq(), cf,
- mapping));
+ if (dnaseq != null && mapping.getTo() != null)
+ {
+ cf.addMap(dnaseq, mapping.getTo(), mapping.getMap());
+ }
+ else
+ {
+ // defer to later
+ frefedSequence.add(newAlcodMapRef(maps[m].getDnasq(), cf,
+ mapping));
+ }
}
}
al.addCodonFrame(cf);