+ * Check if any added sequence could be the object of a mapping or
+ * cross-reference; if so, make the mapping explicit. Returns the count of
+ * mappings updated.
+ *
+ * @param al
+ * @param toAdd
+ */
+ protected int realiseMappings(AlignmentI al, AlignmentI toAdd)
+ {
+ // TODO this is proof of concept
+ // we might want to give the user some choice here
+ int count = 0;
+ for (SequenceI seq : toAdd.getSequences())
+ {
+ count += realiseMappingsTo(al, seq);
+ }
+ return count;
+ }
+
+ /**
+ * If the alignment holds any mappings to a dummy (placeholder) sequence that
+ * matches the given sequence, then update the mapping to point to the
+ * sequence. Returns the number of mappings updated.
+ *
+ * @param al
+ * @param seq
+ * @return
+ */
+ protected int realiseMappingsTo(AlignmentI al, SequenceI seq)
+ {
+ int count = 0;
+ Set<AlignedCodonFrame> mappings = al.getDataset().getCodonFrames();
+ // TODO are mappings on alignment or alignment dataset?!?
+ for (AlignedCodonFrame mapping : mappings)
+ {
+ /*
+ * TODO could just go straight to realiseWith() here unless we want
+ * to give the user some choice before going ahead
+ */
+ if (mapping.isRealisableWith(seq))
+ {
+ count += mapping.realiseWith(seq);
+ }
+ }
+ return count;
+ }
+
+ /**