*/
public Sequence(SequenceI seq)
{
+ this(seq, seq.getAnnotation());
+ }
+ /**
+ * Create a new sequence object with new features, DBRefEntries, and PDBIds
+ * but inherits any existing dataset sequence reference, and duplicate of
+ * any annotation that is present in the given annotation array.
+ * @param seq the sequence to be copied
+ * @param alAnnotation an array of annotation including some associated with seq
+ */
+ public Sequence(SequenceI seq, AlignmentAnnotation[] alAnnotation)
+ {
this(seq.getName(),
- seq.getSequence(),
- seq.getStart(),
- seq.getEnd());
+ seq.getSequence(),
+ seq.getStart(),
+ seq.getEnd());
description = seq.getDescription();
if (seq.getSequenceFeatures()!=null) {
SequenceFeature[] sf = seq.getSequenceFeatures();
}
}
setDatasetSequence(seq.getDatasetSequence());
- if (seq.getAnnotation()!=null) {
+ if (seq.getAnnotation()!=null && alAnnotation!=null) {
AlignmentAnnotation[] sqann = seq.getAnnotation();
for (int i=0;i<sqann.length; i++)
{
+ boolean found = sqann == alAnnotation;
+ if (!found)
+ {
+ for (int apos = 0; !found && apos<alAnnotation.length; apos++)
+ {
+ found = (alAnnotation[apos] == sqann[i]);
+ }
+ }
AlignmentAnnotation newann = new AlignmentAnnotation(sqann[i]);
addAlignmentAnnotation(newann);
}
}
}
-
/**
* DOCUMENT ME!
*
*/
public char [] getSequence(int start, int end)
{
+ if (start<0)
+ start=0;
// JBPNote - left to user to pad the result here (TODO:Decide on this policy)
if (start >= sequence.length)
{