{
List<SequenceI> cdsSeqs = new ArrayList<SequenceI>();
+ /*
+ * construct CDS sequences from the (cds-to-protein) mappings made earlier;
+ * this makes it possible to model multiple products from dna (e.g. EMBL);
+ * however it does mean we don't have the EMBL protein_id (a property on
+ * the CDS features) in order to make the CDS sequence name :-(
+ */
for (SequenceI seq : dna)
{
AlignedCodonFrame cdsMappings = new AlignedCodonFrame();
* sort to get sequence features in start position order
* - would be better to store in Sequence as a TreeSet or NCList?
*/
- Arrays.sort(peptide.getSequenceFeatures(),
- new Comparator<SequenceFeature>()
- {
- @Override
- public int compare(SequenceFeature o1, SequenceFeature o2)
+ if (peptide.getSequenceFeatures() != null)
+ {
+ Arrays.sort(peptide.getSequenceFeatures(),
+ new Comparator<SequenceFeature>()
{
- int c = Integer.compare(o1.getBegin(), o2.getBegin());
- return c == 0 ? Integer.compare(o1.getEnd(), o2.getEnd())
- : c;
- }
- });
+ @Override
+ public int compare(SequenceFeature o1, SequenceFeature o2)
+ {
+ int c = Integer.compare(o1.getBegin(), o2.getBegin());
+ return c == 0 ? Integer.compare(o1.getEnd(), o2.getEnd())
+ : c;
+ }
+ });
+ }
return count;
}
{
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)
{