JAL-845 linked protein/dna 'slave' further PoC functionality
[jalview.git] / src / jalview / datamodel / Alignment.java
index cea5956..5c2bc22 100755 (executable)
@@ -90,6 +90,20 @@ public class Alignment implements AlignmentI
   }
 
   /**
+   * Make a 'copy' alignment - sequences have new copies of features and
+   * annotations, but share the original dataset sequences.
+   */
+  public Alignment(AlignmentI al)
+  {
+    SequenceI[] seqs = al.getSequencesArray();
+    for (int i = 0; i < seqs.length; i++)
+    {
+      seqs[i] = new Sequence(seqs[i]);
+    }
+    initAlignment(seqs);
+  }
+
+  /**
    * Make an alignment from an array of Sequences.
    * 
    * @param sequences
@@ -1610,10 +1624,17 @@ public class Alignment implements AlignmentI
     return dataset;
   }
 
+  /**
+   * Align this alignment like the given (mapped) one.
+   */
   @Override
   public int alignAs(AlignmentI al)
   {
-    return alignAs(al, true, true);
+    /*
+     * Currently retains unmapped gaps (in introns), regaps mapped regions
+     * (exons)
+     */
+    return alignAs(al, false, true);
   }
 
   /**
@@ -1625,7 +1646,16 @@ public class Alignment implements AlignmentI
    * nucleotide bases. Does nothing if alignment of protein from cDNA is
    * requested (not yet implemented).
    * 
+   * Parameters control whether gaps in exon (mapped) and intron (unmapped)
+   * regions are preserved. Gaps that connect introns to exons are treated
+   * conservatively, i.e. only preserved if both intron and exon gaps are
+   * preserved.
+   * 
    * @param al
+   * @param preserveMappedGaps
+   *          if true, gaps within and between mapped codons are preserved
+   * @param preserveUnmappedGaps
+   *          if true, gaps within and between unmapped codons are preserved
    */
 //  @Override
   public int alignAs(AlignmentI al, boolean preserveMappedGaps,