}
else
{
+ vamsasSeq.setDsseqid(id + ""); // so we can tell which sequences really are dataset sequences only
dbrefs = jds.getDBRef();
}
- if (jds.getDBRef() != null)
+ if (dbrefs != null)
{
for (int d = 0; d < dbrefs.length; d++)
{
ds.addSequence(dsq);
}
} else {
- // make this dataset sequence sq's dataset sequence
- sq.setDatasetSequence(dsq);
+ if (sq!=dsq)
+ { // make this dataset sequence sq's dataset sequence
+ sq.setDatasetSequence(dsq);
+ }
}
}
// TODO: refactor this as a merge dataset sequence function
// now check that sq (the dataset sequence) sequence really is the union of all references to it
- boolean pre = sq.getStart() < dsq.getStart();
- boolean post = sq.getEnd() > dsq.getEnd();
- if (pre || post)
+ //boolean pre = sq.getStart() < dsq.getStart();
+ //boolean post = sq.getEnd() > dsq.getEnd();
+ //if (pre || post)
+ if (sq!=dsq)
{
StringBuffer sb = new StringBuffer();
String newres = jalview.analysis.AlignSeq.extractGaps(
jalview.util.Comparison.GapChars, sq.getSequenceAsString());
- synchronized (dsq)
+ if (!newres.equalsIgnoreCase(dsq.getSequenceAsString()) && newres.length()>dsq.getLength())
{
- sb.append(dsq.getSequence());
- if (pre)
+ // Update with the longer sequence.
+ synchronized (dsq)
+ {
+ /*if (pre)
{
sb.insert(0, newres
.substring(0, dsq.getStart() - sq.getStart()));
- dsq.getEnd()));
dsq.setEnd(sq.getEnd());
}
+ */
dsq.setSequence(sb.toString());
+ }
+ //TODO: merges will never happen if we 'know' we have the real dataset sequence - this should be detected when id==dssid
+ System.err
+ .println("DEBUG Notice: Merged dataset sequence"); // ("
+ // + (pre ? "prepended" : "") + " "
+ //+ (post ? "appended" : ""));
}
- System.err
- .println("DEBUG Notice: Merged dataset sequence ("
- + (pre ? "prepended" : "") + " "
- + (post ? "appended" : ""));
}
}