? new Alignment(getAlignment())
: getAlignment();
- // always create dataset for imported alignment before doing anything else..
- al.setDataset(null);
if (!al.isNucleotide() && !thisAlignment.isNucleotide())
{
// link AA to 3di or other kind of 'alternative' 1:1 mapping alignment
+ if (al.getDataset()==null)
+ {
+ al.setDataset(thisAlignment.getDataset());
+ }
AlignmentUtils.map3diPeptideToProteinAligment(thisAlignment,al);
+ if (thisAlignment.getCodonFrames().isEmpty()) {thisAlignment.getCodonFrames().addAll(al.getCodonFrames()); }
+ else {al.getCodonFrames().addAll(thisAlignment.getCodonFrames()); };
+
}
else
{
- // link CODON triplets to Protein
+ // shouldn't we be merging dataset here ?
+ // always create dataset for imported alignment before doing anything else..
+ al.setDataset(null);
+ // link CODON triplets to Protein
AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
private static final String AA_SEQS_2 =
">Seq1Name/5-8\n" +
- "K-QY--L\n" +
+ "K-QY-L\n" +
">Seq2Name/12-15\n" +
- "-R-FP-W-\n";
+ "-R-FPW\n";
private static final String AA_SEQS_2_DS =
">Seq1Name/5-8\n" +
"KQYL\n" +
AlignmentI al1 = loadAlignment(TD_SEQS_2, FileFormat.Fasta);
AlignmentI al2 = loadAlignment(AA_SEQS_2_DS, FileFormat.Fasta);
al1.setDataset(null);
- al2.setDataset(null);
+ al2.setDataset(al1.getDataset());
AlignmentI al1copy = new Alignment(al1);
AlignmentI al2copy = new Alignment(al2);
AlignmentUtils.map3diPeptideToProteinAligment(al2, al1);
}
/**
+ * Recover TdI MSA from protein msa
+ *
+ * @throws IOException
+ */
+ @Test(groups = { "Functional" })
+ public void testAlignAs_tdi_prot() throws Exception
+ {
+ // see also AlignmentUtilsTests
+ AlignmentI al1 = loadAlignment(AA_SEQS_2, FileFormat.Fasta);
+ AlignmentI al2 = loadAlignment(TD_SEQS_2_DS, FileFormat.Fasta);
+ al1.setDataset(null);
+ al2.setDataset(al1.getDataset());
+ AlignmentI al1copy = new Alignment(al1);
+ AlignmentI al2copy = new Alignment(al2);
+ AlignmentUtils.map3diPeptideToProteinAligment(al1, al2);
+ if (al2.getCodonFrames().isEmpty()) {al2.getCodonFrames().addAll(al1.getCodonFrames()); }
+ else {al1.getCodonFrames().addAll(al2.getCodonFrames()); };
+
+ ((Alignment) al2).alignAs(al1);
+ assertEquals("K-QY-L", al1.getSequenceAt(0).getSequenceAsString());
+ assertEquals("-R-FPW", al1.getSequenceAt(1).getSequenceAsString());
+ assertEquals("N-MP-R", al2.getSequenceAt(0).getSequenceAsString());
+ assertEquals("-V-XYA", al2.getSequenceAt(1).getSequenceAsString());
+
+ }
+ /**
* Test aligning cdna as per protein alignment.
*
* @throws IOException