+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b1)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.analysis;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
import jalview.api.AlignViewportI;
import jalview.datamodel.AlignedCodon;
import jalview.datamodel.Alignment;
import java.io.IOException;
-import org.junit.Test;
+import org.testng.annotations.Test;
public class DnaTest
{
*
* @throws IOException
*/
- @Test
+ @Test(groups = { "Functional" })
public void testTranslateCdna_withUntranslatableCodons()
throws IOException
{
"FASTA");
ColumnSelection cs = new ColumnSelection();
AlignViewportI av = new AlignViewport(alf, cs);
- Dna dna = new Dna(av, new int[]
- { 0, alf.getWidth() - 1 });
+ Dna dna = new Dna(av, new int[] { 0, alf.getWidth() - 1 });
AlignmentI translated = dna.translateCdna();
assertNotNull("Couldn't do a full width translation of test data.",
translated);
*
* @throws IOException
*/
- @Test
+ @Test(groups = { "Functional" })
public void testTranslateCdna_withUntranslatableCodonsAndHiddenColumns()
throws IOException
{
}
/**
- * Test simple translation to Amino Acids (with STOP codons translated to X).
+ * Test simple translation to Amino Acids (with STOP codons translated to *).
*
* @throws IOException
*/
- @Test
+ @Test(groups = { "Functional" })
public void testTranslateCdna_simple() throws IOException
{
AlignmentI alf = new FormatAdapter().readFile(fasta,
FormatAdapter.PASTE, "FASTA");
ColumnSelection cs = new ColumnSelection();
AlignViewportI av = new AlignViewport(alf, cs);
- Dna dna = new Dna(av, new int[]
- { 0, alf.getWidth() - 1 });
+ Dna dna = new Dna(av, new int[] { 0, alf.getWidth() - 1 });
AlignmentI translated = dna.translateCdna();
String aa = translated.getSequenceAt(0).getSequenceAsString();
assertEquals(
- "AAAACCDDEEFFGGGGHHIIIKKLLLLLLMNNPPPPQQRRRRRRSSSSSSTTTTVVVVWYYXXX",
+ "AAAACCDDEEFFGGGGHHIIIKKLLLLLLMNNPPPPQQRRRRRRSSSSSSTTTTVVVVWYY***",
aa);
}
*
* @throws IOException
*/
- @Test
+ @Test(groups = { "Functional" })
public void testTranslateCdna_hiddenColumns() throws IOException
{
AlignmentI alf = new FormatAdapter().readFile(fasta,
cs.hideColumns(24, 35); // hide codons 9-12
cs.hideColumns(177, 191); // hide codons 60-64
AlignViewportI av = new AlignViewport(alf, cs);
- Dna dna = new Dna(av, new int[]
- { 0, alf.getWidth() - 1 });
+ Dna dna = new Dna(av, new int[] { 0, alf.getWidth() - 1 });
AlignmentI translated = dna.translateCdna();
String aa = translated.getSequenceAt(0).getSequenceAsString();
assertEquals("AACDDGGGGHHIIIKKLLLLLLMNNPPPPQQRRRRRRSSSSSSTTTTVVVVW", aa);
/**
* Use this test to help debug into any cases of interest.
*/
- @Test
+ @Test(groups = { "Functional" })
public void testCompareCodonPos_oneOnly()
{
assertFollows("-AA--A", "G--GG"); // 2 shifted seq2, 3 shifted seq1
/**
* Tests for method that compares 'alignment' of two codon position triplets.
*/
- @Test
+ @Test(groups = { "Functional" })
public void testCompareCodonPos()
{
/*
* reorders the cDNA and retranslates, and verifies that the translations are
* the same (apart from ordering).
*/
- @Test
+ @Test(groups = { "Functional" })
public void testTranslateCdna_sequenceOrderIndependent()
{
/*
AlignmentI cdna = new DnaAlignmentGenerator().generate(12, 8, 97, 5, 5);
ColumnSelection cs = new ColumnSelection();
AlignViewportI av = new AlignViewport(cdna, cs);
- Dna dna = new Dna(av, new int[]
- { 0, cdna.getWidth() - 1 });
+ Dna dna = new Dna(av, new int[] { 0, cdna.getWidth() - 1 });
AlignmentI translated = dna.translateCdna();
/*
* Jumble the cDNA sequences and translate.
*/
SequenceI[] sorted = new SequenceI[cdna.getHeight()];
- final int[] jumbler = new int[]
- { 6, 7, 3, 4, 2, 0, 1, 5 };
+ final int[] jumbler = new int[] { 6, 7, 3, 4, 2, 0, 1, 5 };
int seqNo = 0;
for (int i : jumbler)
{
}
AlignmentI cdnaReordered = new Alignment(sorted);
av = new AlignViewport(cdnaReordered, cs);
- dna = new Dna(av, new int[]
- { 0, cdna.getWidth() - 1 });
+ dna = new Dna(av, new int[] { 0, cdna.getWidth() - 1 });
AlignmentI translated2 = dna.translateCdna();
/*
{
final String translation1 = translated.getSequenceAt(
originalSequenceIndex).getSequenceAsString();
- final String translation2 = translated2.getSequenceAt(sortedSequenceIndex)
- .getSequenceAsString();
+ final String translation2 = translated2.getSequenceAt(
+ sortedSequenceIndex).getSequenceAsString();
assertEquals(translation2, translation1);
sortedSequenceIndex++;
}
* Test that all the cases in testCompareCodonPos have a 'symmetric'
* comparison (without checking the actual comparison result).
*/
- @Test
+ @Test(groups = { "Functional" })
public void testCompareCodonPos_isSymmetric()
{
assertSymmetric("AAA", "GGG");
/**
* Weirdly, maybe worth a test to prove the helper method of this test class.
*/
- @Test
+ @Test(groups = { "Functional" })
public void testConvertCodon()
{
assertEquals("[0, 1, 2]", convertCodon("AAA").toString());