*
* @param seqs
* @param xrefs
+ * @param dataset
+ * the alignment dataset shared by the new copy
* @return
*/
public static AlignmentI makeCopyAlignment(SequenceI[] seqs,
- SequenceI[] xrefs)
+ SequenceI[] xrefs, AlignmentI dataset)
{
AlignmentI copy = new Alignment(new Alignment(seqs));
-
- /*
- * add mappings between sequences to the new alignment
- */
- AlignedCodonFrame mappings = new AlignedCodonFrame();
- copy.addCodonFrame(mappings);
- for (int i = 0; i < copy.getHeight(); i++)
- {
- SequenceI from = seqs[i];
- SequenceI to = copy.getSequenceAt(i);
- if (to.getDatasetSequence() != null)
- {
- to = to.getDatasetSequence();
- }
- int start = from.getStart();
- int end = from.getEnd();
- MapList map = new MapList(new int[] { start, end }, new int[] {
- start, end }, 1, 1);
- mappings.addMap(to, from, map);
- }
+ copy.setDataset(dataset);
SequenceIdMatcher matcher = new SequenceIdMatcher(seqs);
if (xrefs != null)
else
{
copyAlignment = AlignmentUtils.makeCopyAlignment(
- sequenceSelection, xrefs.getSequencesArray());
+ sequenceSelection, xrefs.getSequencesArray(), dataset);
}
copyAlignment.setGapCharacter(AlignFrame.this.viewport
.getGapCharacter());