{
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);
+ }
+
SequenceIdMatcher matcher = new SequenceIdMatcher(seqs);
if (xrefs != null)
{
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
}
}
+ /**
+ * adds a set of mappings (while ignoring any duplicates)
+ */
+ @Override
+ public void addCodonFrames(Iterable<AlignedCodonFrame> codons)
+ {
+ if (codons != null)
+ {
+ Iterator<AlignedCodonFrame> it = codons.iterator();
+ while (it.hasNext())
+ {
+ addCodonFrame(it.next());
+ }
+ }
+ }
+
/*
* (non-Javadoc)
*
void addCodonFrame(AlignedCodonFrame codons);
/**
+ * add a set of aligned codons mappings for this alignment, apart from any
+ * duplicates which are ignored
+ *
+ * @param codons
+ */
+ void addCodonFrames(Iterable<AlignedCodonFrame> codons);
+
+ /**
* remove a particular codon frame reference from this alignment
*
* @param codons
return showp;
}
+ /**
+ * Finds and displays cross-references for the selected sequences (protein
+ * products for nucleotide sequences, dna coding sequences for peptides).
+ *
+ * @param sel
+ * the sequences to show cross-references for
+ * @param dna
+ * true if from a nucleotide alignment (so showing proteins)
+ * @param source
+ * the database to show cross-references for
+ */
protected void showProductsFor(final SequenceI[] sel, final boolean dna,
final String source)
{
System.err.println("Failed to make CDS alignment");
}
al.getCodonFrames().clear();
- al.getCodonFrames().addAll(copyAlignment.getCodonFrames());
+ al.addCodonFrames(copyAlignment.getCodonFrames());
+ al.addCodonFrames(cf);
/*
* pending getting Embl transcripts to 'align',
{
copyAlignment = AlignmentUtils.makeCopyAlignment(
sequenceSelection, xrefs.getSequencesArray());
- copyAlignment.getCodonFrames().addAll(cf);
+ copyAlignment.addCodonFrames(cf);
+ al.addCodonFrames(copyAlignment.getCodonFrames());
+ al.addCodonFrames(cf);
}
copyAlignment.setGapCharacter(AlignFrame.this.viewport
.getGapCharacter());