import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.GeneLociI;
+import jalview.datamodel.HiddenColumns;
import jalview.datamodel.IncompleteCodonException;
import jalview.datamodel.Mapping;
import jalview.datamodel.Sequence;
}
return true;
}
+
+ /**
+ * Creates a deep copy of an alignment along with a dataset alignment,
+ * alignment annotations, representative sequence and hidden columns.
+ */
+ public static AlignmentI deepCopyAlignment(AlignmentI alignment)
+ {
+ var alnCpy = new Alignment(alignment);
+ alnCpy.setGapCharacter(alignment.getGapCharacter());
+ alnCpy.setDataset(alignment.getDataset());
+ for (AlignmentAnnotation annotation : alignment.getAlignmentAnnotation())
+ alnCpy.addAnnotation(new AlignmentAnnotation(annotation));
+ if (alignment.hasSeqrep())
+ {
+ int idx = alignment.findIndex(alignment.getSeqrep());
+ if (idx >= 0)
+ alnCpy.setSeqrep(alnCpy.getSequenceAt(idx));
+ }
+ if (alignment.getHiddenColumns() != null)
+ alnCpy.setHiddenColumns(new HiddenColumns(alignment.getHiddenColumns()));
+ return alnCpy;
+ }
}