import org.testng.annotations.Test;
import jalview.analysis.AlignmentGenerator;
+import jalview.analysis.AlignmentUtils;
+import jalview.analysis.CrossRef;
import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping;
import jalview.gui.JvOptionPane;
import jalview.io.DataSourceType;
+import jalview.io.FastaFile;
import jalview.io.FileFormat;
import jalview.io.FileFormatI;
import jalview.io.FormatAdapter;
}
/**
+ * test mapping between a protein and 3di sequence alignment. Assumes 1:1
+ * @throws IOException
+ */
+ @Test(groups={"Functional"},enabled=true)
+ public void testAlignAs_3di() throws IOException
+ {
+ String protAl = ">1ji5_A\n"
+ + "-----------------------------DQPVLLLLLLQLLLLLVLLLQQLVVCLVQAD\n"
+ + "DPCNVVSNVVSVVSSVVSVVSNVVSQVVCVVVVHHHDDDVSSVVRYPQDHHDPP--DYPL\n"
+ + "RSLVSLLVSLVVVLVSLVVSLVSCVVVVNVVSNVSSVVVSVVSVVSNVVSCVVVVD----\n"
+ + "---------------------------------------------------\n"
+ + ">1jig_A\n"
+ + "---------------------------DALLVVLLLLLLQLLLALVLLLQQLVLCLVLAD\n"
+ + "DPCNVVSNVVSVVVSVVSVVSNVVSQVVCVVSVHHHDDDVSSVVRYPQDHDDSP--DYPL\n"
+ + "RSLVSLLVSLVVLLVSLVVSLVSCVVNVNPVSNVSSVVSSVVSVVSNVVSVVVND-----\n"
+ + "---------------------------------------------------\n"
+ + "\n";
+ String tdiAl = ">1ji5_A\n"
+ + "-----------------------------MNKQVIEVLNKQVADWSVLFTKLHNFHWYVK\n"
+ + "GPQFFTLHEKFEELYTESATHIDEIAERILAIGGKPVATKEYLEISSIQEAAYG--ETAE\n"
+ + "GMVEAIMKDYEMMLVELKKGMEIAQNSDDEMTSDLLLGIYTELEKHAWMLRAFLNQ----\n"
+ + "---------------------------------------------------\n"
+ + ">1jig_A\n"
+ + "---------------------------MSTKTNVVEVLNKQVANWNVLYVKLHNYHWYVT\n"
+ + "GPHFFTLHEKFEEFYNEAGTYIDELAERILALEGKPLATKEYLATSSVNEGTSK--ESAE\n"
+ + "EMVQTLVNDYSALIQELKEGMEVAGEAGDATSADMLLAIHTTLEQHVWMLSAFLK-----\n"
+ + "---------------------------------------------------\n" + "";
+ AlignmentI prot = loadAlignment(protAl, FileFormat.Fasta);
+ ((Alignment) prot).createDatasetAlignment();
+
+ AlignmentI tdi = loadAlignment(tdiAl, FileFormat.Fasta);
+ assertTrue(AlignmentUtils.map3diPeptideToProteinAligment(prot, tdi));
+
+ AlignmentI newProt = new Alignment(
+ new SequenceI[]
+ { prot.getSequenceAt(0).getSubSequence(25, 35),
+ prot.getSequenceAt(1).getSubSequence(35, 45) });
+ newProt.setDataset(prot.getDataset());
+
+ // TODO Find matching tdi sequence and construct alignment mirroring
+ // the protein alignment
+ // Alignment newTdi = new CrossRef(newProt.getSequencesArray(),
+ // newProt.getDataset()).findXrefSequences("", false);
+ //
+ // newTdi.alignAs(newProt);
+ //
+ // System.out.println("newProt - aa\n"+new
+ // FastaFile().print(newProt.getSequencesArray(), true));
+ // System.out.println("newProt - 3di\n"+new
+ // FastaFile().print(newTdi.getSequencesArray(), true));
+
+ }
+ /**
* Helper method that makes mappings and then aligns the first alignment as
* the second
*
/**
* Helper method to make mappings between sequences, and add the mappings to
- * the 'mapped from' alignment
+ * the 'mapped from' alignment. If alFrom.isNucleotide() == alTo.isNucleotide() then ratio is always 1:1
*
* @param alFrom
* @param alTo