From cd3f71819a7f5277e4f34f1c062c9c9db45a58af Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 2 May 2007 12:21:26 +0000 Subject: [PATCH] subsequence bound checks and constructor for selectively duplicating sequence associated alignment annotation in copy constructor --- src/jalview/datamodel/Sequence.java | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 673177c..d64e133 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -136,10 +136,21 @@ public class Sequence */ 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(); @@ -154,10 +165,18 @@ public class Sequence } } setDatasetSequence(seq.getDatasetSequence()); - if (seq.getAnnotation()!=null) { + if (seq.getAnnotation()!=null && alAnnotation!=null) { AlignmentAnnotation[] sqann = seq.getAnnotation(); for (int i=0;i= sequence.length) { -- 1.7.10.2