* Test the constructor that parses a PDB file format ATOM line. Fields are in
* fixed column positions
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testStringConstructor()
{
Atom a = new Atom(
* Test the case where occupancy and temp factor are blank - should default to
* 1
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testStringConstructor_blankOccupancyTempFactor()
{
Atom a = new Atom(
/**
* Parsing non-numeric data as Atom throws an exception
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testStringConstructor_malformed()
{
try
public class BondTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testTranslate()
{
Atom a1 = new Atom(1f, 2f, 3f);
c = new PDBChain("1GAQ", "A");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetNewlineString()
{
assertEquals(System.lineSeparator(), c.getNewlineString());
assertEquals("gaga", c.getNewlineString());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testPrint()
{
c.offset = 7;
* Test the method that constructs a Bond between two atoms and adds it to the
* chain's list of bonds
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeBond()
{
/*
assertEquals(3f, b2.end[2], 0.0001f);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSetChainColours_colour()
{
c.makeBond(a1, a2);
* Test setting bond start/end colours based on a colour scheme i.e. colour by
* residue
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSetChainColours_colourScheme()
{
Color alaColour = new Color(204, 255, 0);
assertEquals(Color.gray, b.endCol);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetChargeColour()
{
assertEquals(Color.red, PDBChain.getChargeColour("ASP"));
/**
* Test the method that sets bond start/end colours by residue charge property
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSetChargeColours()
{
a1.resName = "ASP"; // red
/**
* Test the method that converts the raw list of atoms to a list of residues
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeResidueList_noAnnotation()
{
Vector<Atom> atoms = new Vector<Atom>();
* Test the method that converts the raw list of atoms to a list of residues,
* including parsing of tempFactor to an alignment annotation
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeResidueList_withTempFactor()
{
Vector<Atom> atoms = new Vector<Atom>();
c.atoms = atoms;
atoms.add(makeAtom(4, "N", "MET"));
- atoms.get(atoms.size()-1).tfactor = 1f;
+ atoms.get(atoms.size() - 1).tfactor = 1f;
atoms.add(makeAtom(4, "CA", "MET"));
- atoms.get(atoms.size()-1).tfactor = 2f;
+ atoms.get(atoms.size() - 1).tfactor = 2f;
atoms.add(makeAtom(4, "C", "MET"));
- atoms.get(atoms.size()-1).tfactor = 3f;
+ atoms.get(atoms.size() - 1).tfactor = 3f;
atoms.add(makeAtom(5, "O", "LYS"));
- atoms.get(atoms.size()-1).tfactor = 7f;
+ atoms.get(atoms.size() - 1).tfactor = 7f;
atoms.add(makeAtom(5, "N", "LYS"));
- atoms.get(atoms.size()-1).tfactor = 8f;
+ atoms.get(atoms.size() - 1).tfactor = 8f;
atoms.add(makeAtom(5, "CA", "LYS"));
- atoms.get(atoms.size()-1).tfactor = 9f;
+ atoms.get(atoms.size() - 1).tfactor = 9f;
atoms.add(makeAtom(6, "O", "LEU"));
- atoms.get(atoms.size()-1).tfactor = 4f;
+ atoms.get(atoms.size() - 1).tfactor = 4f;
atoms.add(makeAtom(6, "N", "LEU"));
- atoms.get(atoms.size()-1).tfactor = 5f;
+ atoms.get(atoms.size() - 1).tfactor = 5f;
atoms.add(makeAtom(6, "CA", "LEU"));
- atoms.get(atoms.size()-1).tfactor = 6f;
-
+ atoms.get(atoms.size() - 1).tfactor = 6f;
+
/*
* make residues including temp factor annotation
*/
c.makeResidueList(true);
-
+
/*
* Verify annotations; note the tempFactor is read from the first atom in
* each residue i.e. we expect values 1, 7, 4 for the residues
* Test the method that constructs bonds between successive residues' CA or P
* atoms
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeCaBondList()
{
c.isNa = true;
assertTrue(c.isNa);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeCaBondList_nucleotide()
{
c.isNa = false;
/**
* Test the method that updates atoms with their alignment positions
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeExactMapping()
{
Vector<Atom> atoms = new Vector<Atom>();
public class PDBfileTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testIsRna()
{
SequenceI seq = new Sequence("Seq1", "CGAU");
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testParse() throws IOException
{
/*
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testParse_withAnnotations_noSS() throws IOException
{
PDBfile pf = new PDBfile(true, false, false, "examples/3W5V.pdb",
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testParse_withJmol_noAnnotations() throws IOException
{
PDBfile pf = new PDBfile(false, true, false, "examples/3W5V.pdb",
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testParse_withJmolAddAlignmentAnnotations()
throws IOException
{
* @throws IOException
*/
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void testParse_withAnnotate3D() throws IOException
{
// TODO requires a mock for Annotate3D processing
PDBfile pf = new PDBfile(true, true, true, "examples/2GIS.pdb",
AppletFormatAdapter.FILE);
}
+
/**
* Helper method to extract parsed annotations from the PDBfile
*
pf.addAnnotations(al);
return al.getAlignmentAnnotation();
}
- }
+}
public class ResidueTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindAtom()
{
Atom a1 = new Atom(1f, 2f, 3f);
* @throws Exception
*/
- @Test(groups =
- { "Functional" }, dataProvider = "testWriteParam")
+ @Test(groups = { "Functional" }, dataProvider = "testWriteParam")
void test(String re, String inp) throws IOException
{
StringWriter sw = new StringWriter();
@DataProvider(name = "testWriteParam")
public Object[][] regexTestParams()
{
- return new Object[][]
- {
- { "s/x/y/", "-----x123456789" },
- { "s/x/y/", "x123456789" },
- { "s/x/y/", "-----x" },
- { "s/x.*?x/y/", ".xx..x..x...x...x....x....x" },
- { "s/x.*x/[$&]/", "--x........x--xx" },
- { "s/x.*x/[$&]/", "--x........x------" },
- { "s/.$/a/m", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbbbbbbbbbbbb" },
- { "s/.$/a/", "123" },
- { "s/.$/a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" },
- { "s/^./a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" },
- { "s/$/a/", "bbb" },
- { "s/^/a/", "bbb" },
- { "s/^/a/", "" },
- { "s{.*}{N}", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" },
- { "s/.{0,7}/y/", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" },
- { "s/x/$&/", "xxx" } };
+ return new Object[][] { { "s/x/y/", "-----x123456789" },
+ { "s/x/y/", "x123456789" }, { "s/x/y/", "-----x" },
+ { "s/x.*?x/y/", ".xx..x..x...x...x....x....x" },
+ { "s/x.*x/[$&]/", "--x........x--xx" },
+ { "s/x.*x/[$&]/", "--x........x------" },
+ { "s/.$/a/m", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbbbbbbbbbbbb" },
+ { "s/.$/a/", "123" },
+ { "s/.$/a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" },
+ { "s/^./a/", "bb\nbbb\nbbbb\nbbbbb\nbbbbbb\nbb" },
+ { "s/$/a/", "bbb" }, { "s/^/a/", "bbb" }, { "s/^/a/", "" },
+ { "s{.*}{N}", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" },
+ { "s/.{0,7}/y/", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" },
+ { "s/x/$&/", "xxx" } };
}
}
-
package jalview.analysis;
+
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
private static final String P = AAFrequency.PROFILE;
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCalculate_noProfile()
{
SequenceI seq1 = new Sequence("Seq1", "CAGT");
SequenceI seq2 = new Sequence("Seq2", "CACT");
SequenceI seq3 = new Sequence("Seq3", "C--G");
SequenceI seq4 = new Sequence("Seq4", "CA-t");
- SequenceI[] seqs = new SequenceI[]
- { seq1, seq2, seq3, seq4 };
+ SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 };
Hashtable[] result = new Hashtable[seq1.getLength()];
-
+
AAFrequency.calculate(seqs, 0, seq1.getLength(), result, false);
// col 0 is 100% C
assertEquals("T", col.get(R));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCalculate_withProfile()
{
SequenceI seq1 = new Sequence("Seq1", "CAGT");
SequenceI seq2 = new Sequence("Seq2", "CACT");
SequenceI seq3 = new Sequence("Seq3", "C--G");
SequenceI seq4 = new Sequence("Seq4", "CA-t");
- SequenceI[] seqs = new SequenceI[]
- { seq1, seq2, seq3, seq4 };
+ SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 };
Hashtable[] result = new Hashtable[seq1.getLength()];
AAFrequency.calculate(seqs, 0, seq1.getLength(), result, true);
assertEquals(4, profile[1][1]);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCalculate_withProfileTiming()
{
SequenceI seq1 = new Sequence("Seq1", "CAGT");
SequenceI seq2 = new Sequence("Seq2", "CACT");
SequenceI seq3 = new Sequence("Seq3", "C--G");
SequenceI seq4 = new Sequence("Seq4", "CA-t");
- SequenceI[] seqs = new SequenceI[]
- { seq1, seq2, seq3, seq4 };
+ SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3, seq4 };
Hashtable[] result = new Hashtable[seq1.getLength()];
// ensure class loaded and initialized
System.out.println(System.currentTimeMillis() - start);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetPercentageFormat()
{
assertNull(AAFrequency.getPercentageFormat(0));
public class AlignSeqTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testExtractGaps()
{
assertNull(AlignSeq.extractGaps(null, null));
/**
* Test method that converts a (possibly null) array to a list.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAsList()
{
// null array
Collection<AlignmentAnnotation> c1 = AlignmentAnnotationUtils
.asList(null);
assertTrue(c1.isEmpty());
-
+
// empty array
AlignmentAnnotation[] anns = new AlignmentAnnotation[0];
c1 = AlignmentAnnotationUtils.asList(anns);
*
* @throws IOException
*/
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws IOException
{
alignment = new jalview.io.FormatAdapter().readFile(TEST_DATA,
AppletFormatAdapter.PASTE, "FASTA");
-
+
AlignmentAnnotation[] anns = new AlignmentAnnotation[SEQ_ANN_COUNT];
for (int i = 0; i < anns.length; i++)
{
* array)
*/
anns[i] = new AlignmentAnnotation("Label" + i, "Desc " + i,
- new Annotation[]
- {});
+ new Annotation[] {});
anns[i].setCalcId("CalcId" + i);
anns[i].visible = true;
alignment.addAnnotation(anns[i]);
/**
* Test a mixture of show/hidden annotations in/outside selection group.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetShownHiddenTypes_forSelectionGroup()
{
Map<String, List<List<String>>> shownTypes = new HashMap<String, List<List<String>>>();
Map<String, List<List<String>>> hiddenTypes = new HashMap<String, List<List<String>>>();
AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation();
SequenceI[] seqs = alignment.getSequencesArray();
-
+
/*
* Configure annotation properties for test
*/
anns[4].visible = false;
anns[7].sequenceRef = seqs[1];
anns[7].visible = true;
-
+
/*
* in selection group, hidden:
*/
anns[6].visible = true;
anns[9].sequenceRef = seqs[3]; // CalcId9/Label9
anns[9].visible = true;
-
+
List<SequenceI> selected = selectSequences(0, 3);
AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes,
- AlignmentAnnotationUtils.asList(anns),
- selected);
-
+ AlignmentAnnotationUtils.asList(anns), selected);
+
// check results; note CalcId9/Label9 is both hidden and shown (for
// different sequences) so should be in both
// shown: CalcId6/Label6 and CalcId9/Label9
assertEquals(1, shownTypes.get("CalcId9").size());
assertEquals(1, shownTypes.get("CalcId9").get(0).size());
assertEquals("Label9", shownTypes.get("CalcId9").get(0).get(0));
-
+
// hidden: CalcId2/Label2, CalcId2/Label3, CalcId3/Label2, CalcId9/Label9
assertEquals(3, hiddenTypes.size());
assertEquals(2, hiddenTypes.get("CalcId2").size());
assertEquals(1, hiddenTypes.get("CalcId9").size());
assertEquals(1, hiddenTypes.get("CalcId9").get(0).size());
assertEquals("Label9", hiddenTypes.get("CalcId9").get(0).get(0));
-
+
consoleDebug(shownTypes, hiddenTypes);
}
* Test case where there are 'grouped' annotations, visible and hidden, within
* and without the selection group.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetShownHiddenTypes_withGraphGroups()
{
final int GROUP_3 = 3;
final int GROUP_4 = 4;
final int GROUP_5 = 5;
final int GROUP_6 = 6;
-
+
Map<String, List<List<String>>> shownTypes = new HashMap<String, List<List<String>>>();
Map<String, List<List<String>>> hiddenTypes = new HashMap<String, List<List<String>>>();
AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation();
SequenceI[] seqs = alignment.getSequencesArray();
-
+
/*
* Annotations for selection group and graph group
*
anns[11].graphGroup = GROUP_3;
anns[11].label = "Label2";
anns[11].setCalcId("CalcId2");
-
+
// annotations Label1 (hidden), Label5 (visible) in group 6 (visible)
anns[1].sequenceRef = seqs[3];
// being in a visible group should take precedence over this visibility
anns[0].graphGroup = GROUP_4;
anns[0].label = "Label5";
anns[0].setCalcId("CalcId1");
-
+
/*
* Annotations outwith selection group - should be ignored.
*/
anns[9].visible = true;
anns[9].graph = AlignmentAnnotation.LINE_GRAPH;
anns[9].graphGroup = GROUP_4;
-
+
/*
* Generate annotations[] arrays to match aligned columns
*/
List<SequenceI> selected = selectSequences(0, 3);
AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes,
- AlignmentAnnotationUtils.asList(anns),
- selected);
-
+ AlignmentAnnotationUtils.asList(anns), selected);
+
consoleDebug(shownTypes, hiddenTypes);
-
+
// CalcId1 / Label1, Label5 (only) should be 'shown', once, as a compound
// type
assertEquals(1, shownTypes.size());
assertEquals(2, shownTypes.get("CalcId1").get(0).size());
assertEquals("Label1", shownTypes.get("CalcId1").get(0).get(0));
assertEquals("Label5", shownTypes.get("CalcId1").get(0).get(1));
-
+
// CalcId2 / Label2, Label3 (only) should be 'hidden'
assertEquals(1, hiddenTypes.size());
assertEquals(1, hiddenTypes.get("CalcId2").size());
/**
* Test method that determines visible graph groups.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetVisibleGraphGroups()
{
AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation();
anns[0].graph = AlignmentAnnotation.BAR_GRAPH;
anns[0].graphGroup = 1;
anns[0].visible = true;
-
+
/*
* a line graph group is included as long as one of its members is visible
*/
anns[2].graph = AlignmentAnnotation.LINE_GRAPH;
anns[2].graphGroup = 5;
anns[2].visible = true;
-
+
/*
* a line graph group with no visible rows is not included
*/
anns[3].graph = AlignmentAnnotation.LINE_GRAPH;
anns[3].graphGroup = 3;
anns[3].visible = false;
-
+
// a visible line graph with no graph group is not included
anns[4].graph = AlignmentAnnotation.LINE_GRAPH;
anns[4].graphGroup = -1;
anns[4].visible = true;
-
+
BitSet result = AlignmentAnnotationUtils
.getVisibleLineGraphGroups(AlignmentAnnotationUtils
.asList(anns));
* Test for case where no sequence is selected. Shouldn't normally arise but
* check it handles it gracefully.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetShownHiddenTypes_noSequenceSelected()
{
Map<String, List<List<String>>> shownTypes = new HashMap<String, List<List<String>>>();
*/
package jalview.analysis;
-
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertNull;
public static Sequence ts = new Sequence("short",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm");
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testExpandContext()
{
AlignmentI al = new Alignment(new Sequence[] {});
for (int i = 4; i < 14; i += 2)
{
- SequenceI s1=ts.deriveSequence().getSubSequence(i, i+7);
+ SequenceI s1 = ts.deriveSequence().getSubSequence(i, i + 7);
al.addSequence(s1);
}
- System.out.println(new AppletFormatAdapter().formatSequences("Clustal", al, true));
- for (int flnk=-1;flnk<25; flnk++)
+ System.out.println(new AppletFormatAdapter().formatSequences("Clustal",
+ al, true));
+ for (int flnk = -1; flnk < 25; flnk++)
{
AlignmentI exp = AlignmentUtils.expandContext(al, flnk);
System.out.println("\nFlank size: " + flnk);
/**
* Test that annotations are correctly adjusted by expandContext
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testExpandContext_annotation()
{
- AlignmentI al = new Alignment(new Sequence[]
- {});
+ AlignmentI al = new Alignment(new Sequence[] {});
SequenceI ds = new Sequence("Seq1", "ABCDEFGHI");
// subsequence DEF:
SequenceI seq1 = ds.deriveSequence().getSubSequence(3, 6);
/*
* Annotate DEF with 4/5/6 respectively
*/
- Annotation[] anns = new Annotation[]
- { new Annotation(4), new Annotation(5), new Annotation(6) };
+ Annotation[] anns = new Annotation[] { new Annotation(4),
+ new Annotation(5), new Annotation(6) };
AlignmentAnnotation ann = new AlignmentAnnotation("SS",
"secondary structure", anns);
seq1.addAlignmentAnnotation(ann);
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetSequencesByName() throws IOException
{
final String data = ">Seq1Name\nKQYL\n" + ">Seq2Name\nRFPW\n"
assertEquals(1, map.get("Seq2Name").size());
assertEquals("RFPW", map.get("Seq2Name").get(0).getSequenceAsString());
}
+
/**
* Helper method to load an alignment and ensure dataset sequences are set up.
*
* @param data
- * @param format TODO
+ * @param format
+ * TODO
* @return
* @throws IOException
*/
- protected AlignmentI loadAlignment(final String data, String format) throws IOException
+ protected AlignmentI loadAlignment(final String data, String format)
+ throws IOException
{
AlignmentI a = new FormatAdapter().readFile(data,
AppletFormatAdapter.PASTE, format);
a.setDataset(null);
return a;
}
-
+
/**
* Test mapping of protein to cDNA, for the case where we have no sequence
* cross-references, so mappings are made first-served 1-1 where sequences
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapProteinToCdna_noXrefs() throws IOException
{
List<SequenceI> protseqs = new ArrayList<SequenceI>();
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(2)).size());
// V12345 mapped to A22222
- AlignedCodonFrame acf = protein.getCodonFrame(
- protein.getSequenceAt(0)).get(0);
+ AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0))
+ .get(0);
assertEquals(1, acf.getdnaSeqs().length);
assertEquals(cdna.getSequenceAt(1).getDatasetSequence(),
acf.getdnaSeqs()[0]);
MapList mapList = protMappings[0].getMap();
assertEquals(3, mapList.getFromRatio());
assertEquals(1, mapList.getToRatio());
- assertTrue(Arrays.equals(new int[]
- { 1, 9 }, mapList.getFromRanges().get(0)));
+ assertTrue(Arrays.equals(new int[] { 1, 9 }, mapList.getFromRanges()
+ .get(0)));
assertEquals(1, mapList.getFromRanges().size());
- assertTrue(Arrays.equals(new int[]
- { 1, 3 }, mapList.getToRanges().get(0)));
+ assertTrue(Arrays.equals(new int[] { 1, 3 },
+ mapList.getToRanges().get(0)));
assertEquals(1, mapList.getToRanges().size());
// V12346 mapped to A33333
/**
* Test for the alignSequenceAs method that takes two sequences and a mapping.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignSequenceAs_withMapping_noIntrons()
{
- MapList map = new MapList(new int[]
- { 1, 6 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1);
/*
* No existing gaps in dna:
/**
* Test for the alignSequenceAs method that takes two sequences and a mapping.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignSequenceAs_withMapping_withIntrons()
{
/*
* Exons at codon 2 (AAA) and 4 (TTT)
*/
- MapList map = new MapList(new int[]
- { 4, 6, 10, 12 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 4, 6, 10, 12 },
+ new int[] { 1, 2 }, 3, 1);
/*
* Simple case: no gaps in dna
/**
* Test for the case where not all of the protein sequence is mapped to cDNA.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignSequenceAs_withMapping_withUnmappedProtein()
{
-
+
/*
* Exons at codon 2 (AAA) and 4 (TTT) mapped to A and P
*/
- final MapList map = new MapList(new int[]
- { 4, 6, 10, 12 }, new int[]
- { 1, 1, 3, 3 }, 3, 1);
-
+ final MapList map = new MapList(new int[] { 4, 6, 10, 12 }, new int[] {
+ 1, 1, 3, 3 }, 3, 1);
/*
* Expect alignment does nothing (aborts realignment). Change this test
* first if different behaviour wanted.
*/
- checkAlignSequenceAs("GGGAAACCCTTTGGG", "-A-L-P-", false,
- false, map, "GGGAAACCCTTTGGG");
+ checkAlignSequenceAs("GGGAAACCCTTTGGG", "-A-L-P-", false, false, map,
+ "GGGAAACCCTTTGGG");
}
/**
/**
* Test for the alignSequenceAs method where we preserve gaps in introns only.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignSequenceAs_keepIntronGapsOnly()
{
/*
* Intron GGGAAA followed by exon CCCTTT
*/
- MapList map = new MapList(new int[]
- { 7, 12 }, new int[]
- { 1, 2 }, 3, 1);
-
- checkAlignSequenceAs("GG-G-AA-A-C-CC-T-TT", "AL",
- false, true, map, "GG-G-AA-ACCCTTT");
+ MapList map = new MapList(new int[] { 7, 12 }, new int[] { 1, 2 }, 3, 1);
+
+ checkAlignSequenceAs("GG-G-AA-A-C-CC-T-TT", "AL", false, true, map,
+ "GG-G-AA-ACCCTTT");
}
/**
* Test for the method that generates an aligned translated sequence from one
* mapping.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetAlignedTranslation_dnaLikeProtein()
{
// dna alignment will be replaced
// protein alignment will be 'applied' to dna
SequenceI protein = new Sequence("Seq1", "-CH-Y--Q-");
protein.createDatasetSequence();
- MapList map = new MapList(new int[]
- { 1, 12 }, new int[]
- { 1, 4 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1);
AlignedCodonFrame acf = new AlignedCodonFrame();
acf.addMap(dna.getDatasetSequence(), protein.getDatasetSequence(), map);
- final SequenceI aligned = AlignmentUtils
- .getAlignedTranslation(protein, '-', acf);
- assertEquals("---TGCCAT---TAC------CAG---", aligned.getSequenceAsString());
+ final SequenceI aligned = AlignmentUtils.getAlignedTranslation(protein,
+ '-', acf);
+ assertEquals("---TGCCAT---TAC------CAG---",
+ aligned.getSequenceAsString());
assertSame(aligned.getDatasetSequence(), dna.getDatasetSequence());
}
/**
* Test the method that realigns protein to match mapped codon alignment.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignProteinAsDna()
{
// seq1 codons are [1,2,3] [4,5,6] [7,8,9] [10,11,12]
SequenceI dna2 = new Sequence("Seq2", "T-GCCATTACCAG");
// seq3 codons are [1,2,3] [4,5,7] [8,9,10] [11,12,13]
SequenceI dna3 = new Sequence("Seq3", "TGCCA-TTACCAG");
- AlignmentI dna = new Alignment(new SequenceI[]
- { dna1, dna2, dna3 });
+ AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2, dna3 });
dna.setDataset(null);
// protein alignment will be realigned like dna
SequenceI prot2 = new Sequence("Seq2", "CHYQ");
SequenceI prot3 = new Sequence("Seq3", "CHYQ");
SequenceI prot4 = new Sequence("Seq4", "R-QSV"); // unmapped, unchanged
- AlignmentI protein = new Alignment(new SequenceI[]
- { prot1, prot2,
+ AlignmentI protein = new Alignment(new SequenceI[] { prot1, prot2,
prot3, prot4 });
protein.setDataset(null);
- MapList map = new MapList(new int[]
- { 1, 12 }, new int[]
- { 1, 4 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1);
AlignedCodonFrame acf = new AlignedCodonFrame();
acf.addMap(dna1.getDatasetSequence(), prot1.getDatasetSequence(), map);
acf.addMap(dna2.getDatasetSequence(), prot2.getDatasetSequence(), map);
* Test the method that tests whether a CDNA sequence translates to a protein
* sequence
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testTranslatesAs()
{
assertTrue(AlignmentUtils.translatesAs("tttcccaaaggg".toCharArray(), 0,
// wrong protein
assertFalse(AlignmentUtils.translatesAs("tttcccaaaggg".toCharArray(),
- 0,
- "FPMG".toCharArray()));
+ 0, "FPMG".toCharArray()));
}
/**
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapProteinToCdna_withStartAndStopCodons()
throws IOException
{
protseqs.add(new Sequence("UNIPROT|V12347", "SAR"));
AlignmentI protein = new Alignment(protseqs.toArray(new SequenceI[3]));
protein.setDataset(null);
-
+
List<SequenceI> dnaseqs = new ArrayList<SequenceI>();
// start + SAR:
dnaseqs.add(new Sequence("EMBL|A11111", "ATGTCAGCACGC"));
dnaseqs.add(new Sequence("EMBL|A44444", "GAAATTCAG"));
AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[4]));
cdna.setDataset(null);
-
+
assertTrue(AlignmentUtils.mapProteinToCdna(protein, cdna));
// 3 mappings made, each from 1 to 1 sequence
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(0)).size());
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(1)).size());
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(2)).size());
-
+
// V12345 mapped from A22222
- AlignedCodonFrame acf = protein.getCodonFrame(
- protein.getSequenceAt(0)).get(0);
+ AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0))
+ .get(0);
assertEquals(1, acf.getdnaSeqs().length);
assertEquals(cdna.getSequenceAt(1).getDatasetSequence(),
acf.getdnaSeqs()[0]);
MapList mapList = protMappings[0].getMap();
assertEquals(3, mapList.getFromRatio());
assertEquals(1, mapList.getToRatio());
- assertTrue(Arrays.equals(new int[]
- { 1, 9 }, mapList.getFromRanges().get(0)));
+ assertTrue(Arrays.equals(new int[] { 1, 9 }, mapList.getFromRanges()
+ .get(0)));
assertEquals(1, mapList.getFromRanges().size());
- assertTrue(Arrays.equals(new int[]
- { 1, 3 }, mapList.getToRanges().get(0)));
+ assertTrue(Arrays.equals(new int[] { 1, 3 },
+ mapList.getToRanges().get(0)));
assertEquals(1, mapList.getToRanges().size());
// V12346 mapped from A33333 starting position 4
mapList = protMappings[0].getMap();
assertEquals(3, mapList.getFromRatio());
assertEquals(1, mapList.getToRatio());
- assertTrue(Arrays.equals(new int[]
- { 4, 12 }, mapList.getFromRanges().get(0)));
+ assertTrue(Arrays.equals(new int[] { 4, 12 }, mapList.getFromRanges()
+ .get(0)));
assertEquals(1, mapList.getFromRanges().size());
- assertTrue(Arrays.equals(new int[]
- { 1, 3 }, mapList.getToRanges().get(0)));
+ assertTrue(Arrays.equals(new int[] { 1, 3 },
+ mapList.getToRanges().get(0)));
assertEquals(1, mapList.getToRanges().size());
-
+
// V12347 mapped to A11111 starting position 4
acf = protein.getCodonFrame(protein.getSequenceAt(2)).get(0);
assertEquals(1, acf.getdnaSeqs().length);
mapList = protMappings[0].getMap();
assertEquals(3, mapList.getFromRatio());
assertEquals(1, mapList.getToRatio());
- assertTrue(Arrays.equals(new int[]
- { 4, 12 }, mapList.getFromRanges().get(0)));
+ assertTrue(Arrays.equals(new int[] { 4, 12 }, mapList.getFromRanges()
+ .get(0)));
assertEquals(1, mapList.getFromRanges().size());
- assertTrue(Arrays.equals(new int[]
- { 1, 3 }, mapList.getToRanges().get(0)));
+ assertTrue(Arrays.equals(new int[] { 1, 3 },
+ mapList.getToRanges().get(0)));
assertEquals(1, mapList.getToRanges().size());
-
+
// no mapping involving the 'extra' A44444
assertTrue(protein.getCodonFrame(cdna.getSequenceAt(3)).isEmpty());
}
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapProteinToCdna_withXrefs() throws IOException
{
List<SequenceI> protseqs = new ArrayList<SequenceI>();
protseqs.add(new Sequence("UNIPROT|V12347", "SAR"));
AlignmentI protein = new Alignment(protseqs.toArray(new SequenceI[3]));
protein.setDataset(null);
-
+
List<SequenceI> dnaseqs = new ArrayList<SequenceI>();
dnaseqs.add(new Sequence("EMBL|A11111", "TCAGCACGC")); // = SAR
dnaseqs.add(new Sequence("EMBL|A22222", "ATGGAGATACAA")); // = start + EIQ
dnaseqs.add(new Sequence("EMBL|A55555", "GAGATTCAG")); // = EIQ
AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[5]));
cdna.setDataset(null);
-
+
// Xref A22222 to V12345 (should get mapped)
dnaseqs.get(1).addDBRef(new DBRefEntry("UNIPROT", "1", "V12345"));
// Xref V12345 to A44444 (should get mapped)
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(1)).size());
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(2)).size());
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(3)).size());
-
+
// V12345 mapped to A22222 and A44444
- AlignedCodonFrame acf = protein.getCodonFrame(
- protein.getSequenceAt(0)).get(0);
+ AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0))
+ .get(0);
assertEquals(2, acf.getdnaSeqs().length);
assertEquals(cdna.getSequenceAt(1).getDatasetSequence(),
acf.getdnaSeqs()[0]);
assertEquals(cdna.getSequenceAt(3).getDatasetSequence(),
acf.getdnaSeqs()[1]);
-
+
// V12346 mapped to A33333
acf = protein.getCodonFrame(protein.getSequenceAt(1)).get(0);
assertEquals(1, acf.getdnaSeqs().length);
assertEquals(cdna.getSequenceAt(2).getDatasetSequence(),
acf.getdnaSeqs()[0]);
-
+
// V12347 mapped to A11111
acf = protein.getCodonFrame(protein.getSequenceAt(2)).get(0);
assertEquals(1, acf.getdnaSeqs().length);
assertEquals(cdna.getSequenceAt(0).getDatasetSequence(),
acf.getdnaSeqs()[0]);
-
+
// no mapping involving the 'extra' A55555
assertTrue(protein.getCodonFrame(cdna.getSequenceAt(4)).isEmpty());
}
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapProteinToCdna_prioritiseXrefs() throws IOException
{
List<SequenceI> protseqs = new ArrayList<SequenceI>();
AlignmentI protein = new Alignment(
protseqs.toArray(new SequenceI[protseqs.size()]));
protein.setDataset(null);
-
+
List<SequenceI> dnaseqs = new ArrayList<SequenceI>();
dnaseqs.add(new Sequence("EMBL|A11111", "GAAATCCAG")); // = EIQ
dnaseqs.add(new Sequence("EMBL|A22222", "GAAATTCAG")); // = EIQ
AlignmentI cdna = new Alignment(dnaseqs.toArray(new SequenceI[dnaseqs
.size()]));
cdna.setDataset(null);
-
+
// Xref A22222 to V12345 (should get mapped)
// A11111 should then be mapped to the unmapped V12346
dnaseqs.get(1).addDBRef(new DBRefEntry("UNIPROT", "1", "V12345"));
-
+
assertTrue(AlignmentUtils.mapProteinToCdna(protein, cdna));
-
+
// 2 protein mappings made
assertEquals(2, protein.getCodonFrames().size());
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(0)).size());
assertEquals(1, protein.getCodonFrame(protein.getSequenceAt(1)).size());
-
+
// one mapping for each of the cDNA sequences
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(0)).size());
assertEquals(1, protein.getCodonFrame(cdna.getSequenceAt(1)).size());
-
+
// V12345 mapped to A22222
AlignedCodonFrame acf = protein.getCodonFrame(protein.getSequenceAt(0))
.get(0);
assertEquals(1, acf.getdnaSeqs().length);
assertEquals(cdna.getSequenceAt(1).getDatasetSequence(),
acf.getdnaSeqs()[0]);
-
+
// V12346 mapped to A11111
acf = protein.getCodonFrame(protein.getSequenceAt(1)).get(0);
assertEquals(1, acf.getdnaSeqs().length);
* Test the method that shows or hides sequence annotations by type(s) and
* selection group.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testShowOrHideSequenceAnnotations()
{
SequenceI seq1 = new Sequence("Seq1", "AAA");
SequenceI seq2 = new Sequence("Seq2", "BBB");
SequenceI seq3 = new Sequence("Seq3", "CCC");
- Annotation[] anns = new Annotation[]
- { new Annotation(2f) };
+ Annotation[] anns = new Annotation[] { new Annotation(2f) };
AlignmentAnnotation ann1 = new AlignmentAnnotation("Structure", "ann1",
anns);
ann1.setSequenceRef(seq1);
AlignmentAnnotation ann5 = new AlignmentAnnotation("Temp", "ann5", anns);
ann5.setSequenceRef(seq2);
AlignmentAnnotation ann6 = new AlignmentAnnotation("Temp", "ann6", anns);
- AlignmentI al = new Alignment(new SequenceI[] {seq1, seq2, seq3});
+ AlignmentI al = new Alignment(new SequenceI[] { seq1, seq2, seq3 });
al.addAnnotation(ann1); // Structure for Seq1
al.addAnnotation(ann2); // Structure for Seq2
al.addAnnotation(ann3); // Structure for no sequence
/**
* Tests for the method that checks if one sequence cross-references another
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testHasCrossRef()
{
assertFalse(AlignmentUtils.hasCrossRef(null, null));
assertFalse(AlignmentUtils.hasCrossRef(null, seq1));
SequenceI seq2 = new Sequence("UNIPROT|V20192", "ABCDEF");
assertFalse(AlignmentUtils.hasCrossRef(seq1, seq2));
-
+
// different ref
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "v20193"));
assertFalse(AlignmentUtils.hasCrossRef(seq1, seq2));
-
+
// case-insensitive; version number is ignored
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "v20192"));
assertTrue(AlignmentUtils.hasCrossRef(seq1, seq2));
-
+
// right case!
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "V20192"));
assertTrue(AlignmentUtils.hasCrossRef(seq1, seq2));
* Tests for the method that checks if either sequence cross-references the
* other
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testHaveCrossRef()
{
assertFalse(AlignmentUtils.hasCrossRef(null, null));
assertFalse(AlignmentUtils.haveCrossRef(null, seq1));
SequenceI seq2 = new Sequence("UNIPROT|V20192", "ABCDEF");
assertFalse(AlignmentUtils.haveCrossRef(seq1, seq2));
-
+
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "V20192"));
assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2));
// next is true for haveCrossRef, false for hasCrossRef
assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1));
-
+
// now the other way round
seq1.setDBRef(null);
seq2.addDBRef(new DBRefEntry("EMBL", "1", "A12345"));
assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2));
assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1));
-
+
// now both ways
seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "V20192"));
assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2));
/**
* Test the method that extracts the exon-only part of a dna alignment.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeExonAlignment()
{
SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa");
pep2.createDatasetSequence();
Set<AlignedCodonFrame> mappings = new HashSet<AlignedCodonFrame>();
- MapList map = new MapList(new int[]
- { 4, 6, 10, 12 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 4, 6, 10, 12 },
+ new int[] { 1, 2 }, 3, 1);
AlignedCodonFrame acf = new AlignedCodonFrame();
acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map);
mappings.add(acf);
- map = new MapList(new int[]
- { 1, 3, 7, 9, 13, 15 }, new int[]
- { 1, 3 }, 3, 1);
+ map = new MapList(new int[] { 1, 3, 7, 9, 13, 15 }, new int[] { 1, 3 },
+ 3, 1);
acf = new AlignedCodonFrame();
acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), map);
mappings.add(acf);
-
- AlignmentI exons = AlignmentUtils.makeExonAlignment(new SequenceI[]
- { dna1, dna2 }, mappings);
+
+ AlignmentI exons = AlignmentUtils.makeExonAlignment(new SequenceI[] {
+ dna1, dna2 }, mappings);
assertEquals(2, exons.getSequences().size());
assertEquals("GGGTTT", exons.getSequenceAt(0).getSequenceAsString());
assertEquals("GGGTTTCCC", exons.getSequenceAt(1).getSequenceAsString());
* already has a protein product (Uniprot translation) which in turn has an
* x-ref to the EMBLCDS record.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeExonSequences()
{
SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa");
* EMBLCDS|A12345.
*/
Set<AlignedCodonFrame> mappings = new HashSet<AlignedCodonFrame>();
- MapList map = new MapList(new int[]
- { 4, 6, 10, 12 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 4, 6, 10, 12 },
+ new int[] { 1, 2 }, 3, 1);
AlignedCodonFrame acf = new AlignedCodonFrame();
acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map);
mappings.add(acf);
* its product mappings, for the case where there are multiple exon mappings
* to different protein products.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeExonAlignment_multipleProteins()
{
SequenceI dna1 = new Sequence("dna1", "aaaGGGcccTTTaaa");
*/
Set<AlignedCodonFrame> mappings = new LinkedHashSet<AlignedCodonFrame>();
// map ...GGG...TTT to GF
- MapList map = new MapList(new int[]
- { 4, 6, 10, 12 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 4, 6, 10, 12 },
+ new int[] { 1, 2 }, 3, 1);
AlignedCodonFrame acf = new AlignedCodonFrame();
acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map);
mappings.add(acf);
// map aaa...ccc to KP
- map = new MapList(new int[]
- { 1, 3, 7, 9 }, new int[]
- { 1, 2 }, 3, 1);
+ map = new MapList(new int[] { 1, 3, 7, 9 }, new int[] { 1, 2 }, 3, 1);
acf = new AlignedCodonFrame();
acf.addMap(dna1.getDatasetSequence(), pep2.getDatasetSequence(), map);
mappings.add(acf);
// map aaa......TTT to KF
- map = new MapList(new int[]
- { 1, 3, 10, 12 }, new int[]
- { 1, 2 }, 3, 1);
+ map = new MapList(new int[] { 1, 3, 10, 12 }, new int[] { 1, 2 }, 3, 1);
acf = new AlignedCodonFrame();
acf.addMap(dna1.getDatasetSequence(), pep3.getDatasetSequence(), map);
mappings.add(acf);
* Create the Exon alignment; also replaces the dna-to-protein mappings with
* exon-to-protein and exon-to-dna mappings
*/
- AlignmentI exal = AlignmentUtils.makeExonAlignment(new SequenceI[]
- { dna1 }, mappings);
+ AlignmentI exal = AlignmentUtils.makeExonAlignment(
+ new SequenceI[] { dna1 }, mappings);
/*
* Verify we have 3 exon sequences, mapped to pep1/2/3 respectively
/*
* Set up 6 sequences and 7 annotations.
*/
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp()
{
al = buildAlignment(NUM_SEQS);
* sequence ref</li>
* </ul>
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSortBySequenceAndType_autocalcLast()
{
// @formatter:off
/**
* Variant with autocalculated annotations sorting to front
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSortBySequenceAndType_autocalcFirst()
{
// @formatter:off
* sequence ref</li>
* </ul>
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSortByTypeAndSequence_autocalcLast()
{
// @formatter:off
/**
* Variant of test with autocalculated annotations sorted to front
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSortByTypeAndSequence_autocalcFirst()
{
// @formatter:off
* Variant of test with autocalculated annotations sorted to front but
* otherwise no change.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testNoSort_autocalcFirst()
{
// @formatter:off
assertEquals("Structure", anns[6].label);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSort_timingPresorted()
{
testTiming_presorted(50, 100);
long endTime = System.currentTimeMillis();
final long elapsed = endTime - startTime;
System.out.println("Timing test for presorted " + numSeqs
- + " sequences and "
- + numAnns + " annotations took " + elapsed + "ms");
+ + " sequences and " + numAnns + " annotations took " + elapsed
+ + "ms");
}
/**
* Timing tests for sorting randomly sorted annotations for various sizes.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSort_timingUnsorted()
{
testTiming_unsorted(50, 100);
long endTime = System.currentTimeMillis();
final long elapsed = endTime - startTime;
System.out.println("Timing test for unsorted " + numSeqs
- + " sequences and "
- + numAnns + " annotations took " + elapsed + "ms");
+ + " sequences and " + numAnns + " annotations took " + elapsed
+ + "ms");
}
/**
* Timing test for sorting annotations with a limited range of types (labels).
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSort_timingSemisorted()
{
testTiming_semiSorted(50, 100);
Alignment alignment = buildAlignment(numSeqs);
AlignmentAnnotation[] annotations = buildAnnotations(numAnns);
- String[] labels = new String[]
- { "label1", "label2", "label3", "label4", "label5", "label6" };
+ String[] labels = new String[] { "label1", "label2", "label3",
+ "label4", "label5", "label6" };
/*
* Set the annotations in sequence order with randomly assigned labels.
long endTime = System.currentTimeMillis();
long elapsed = endTime - startTime;
System.out.println("Sort by label for semisorted " + numSeqs
- + " sequences and "
- + numAnns + " annotations took " + elapsed + "ms");
+ + " sequences and " + numAnns + " annotations took " + elapsed
+ + "ms");
// now resort by sequence
startTime = System.currentTimeMillis();
public class CodingUtilsTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDecodeCodon()
{
- assertTrue(Arrays.equals(new char[]
- { 'A', 'A', 'A' }, CodingUtils.decodeCodon(0)));
- assertTrue(Arrays.equals(new char[]
- { 'A', 'A', 'C' }, CodingUtils.decodeCodon(1)));
- assertTrue(Arrays.equals(new char[]
- { 'A', 'A', 'G' }, CodingUtils.decodeCodon(2)));
- assertTrue(Arrays.equals(new char[]
- { 'A', 'A', 'T' }, CodingUtils.decodeCodon(3)));
- assertTrue(Arrays.equals(new char[]
- { 'A', 'C', 'A' }, CodingUtils.decodeCodon(4)));
- assertTrue(Arrays.equals(new char[]
- { 'C', 'A', 'A' }, CodingUtils.decodeCodon(16)));
- assertTrue(Arrays.equals(new char[]
- { 'G', 'G', 'G' }, CodingUtils.decodeCodon(42)));
- assertTrue(Arrays.equals(new char[]
- { 'T', 'T', 'T' }, CodingUtils.decodeCodon(63)));
+ assertTrue(Arrays.equals(new char[] { 'A', 'A', 'A' },
+ CodingUtils.decodeCodon(0)));
+ assertTrue(Arrays.equals(new char[] { 'A', 'A', 'C' },
+ CodingUtils.decodeCodon(1)));
+ assertTrue(Arrays.equals(new char[] { 'A', 'A', 'G' },
+ CodingUtils.decodeCodon(2)));
+ assertTrue(Arrays.equals(new char[] { 'A', 'A', 'T' },
+ CodingUtils.decodeCodon(3)));
+ assertTrue(Arrays.equals(new char[] { 'A', 'C', 'A' },
+ CodingUtils.decodeCodon(4)));
+ assertTrue(Arrays.equals(new char[] { 'C', 'A', 'A' },
+ CodingUtils.decodeCodon(16)));
+ assertTrue(Arrays.equals(new char[] { 'G', 'G', 'G' },
+ CodingUtils.decodeCodon(42)));
+ assertTrue(Arrays.equals(new char[] { 'T', 'T', 'T' },
+ CodingUtils.decodeCodon(63)));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDecodeNucleotide()
{
assertEquals('A', CodingUtils.decodeNucleotide(0));
assertEquals('0', CodingUtils.decodeNucleotide(4));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testEncodeCodon()
{
assertTrue(CodingUtils.encodeCodon('Z') < 0);
assertEquals(3, CodingUtils.encodeCodon('T'));
assertEquals(3, CodingUtils.encodeCodon('u'));
assertEquals(3, CodingUtils.encodeCodon('U'));
-
+
assertEquals(-1, CodingUtils.encodeCodon(null));
- assertEquals(0, CodingUtils.encodeCodon(new char[]
- { 'A', 'A', 'A' }));
- assertEquals(1, CodingUtils.encodeCodon(new char[]
- { 'A', 'A', 'C' }));
- assertEquals(2, CodingUtils.encodeCodon(new char[]
- { 'A', 'A', 'G' }));
- assertEquals(3, CodingUtils.encodeCodon(new char[]
- { 'A', 'A', 'T' }));
- assertEquals(4, CodingUtils.encodeCodon(new char[]
- { 'A', 'C', 'A' }));
- assertEquals(16, CodingUtils.encodeCodon(new char[]
- { 'C', 'A', 'A' }));
- assertEquals(42, CodingUtils.encodeCodon(new char[]
- { 'G', 'G', 'G' }));
- assertEquals(63, CodingUtils.encodeCodon(new char[]
- { 'T', 'T', 'T' }));
+ assertEquals(0, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'A' }));
+ assertEquals(1, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'C' }));
+ assertEquals(2, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'G' }));
+ assertEquals(3, CodingUtils.encodeCodon(new char[] { 'A', 'A', 'T' }));
+ assertEquals(4, CodingUtils.encodeCodon(new char[] { 'A', 'C', 'A' }));
+ assertEquals(16, CodingUtils.encodeCodon(new char[] { 'C', 'A', 'A' }));
+ assertEquals(42, CodingUtils.encodeCodon(new char[] { 'G', 'G', 'G' }));
+ assertEquals(63, CodingUtils.encodeCodon(new char[] { 'T', 'T', 'T' }));
}
}
public class CrossRefTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindXDbRefs()
{
DBRefEntry ref1 = new DBRefEntry("UNIPROT", "1", "A123");
DBRefEntry ref6 = new DBRefEntry("emblCDS", "1", "A123");
DBRefEntry ref7 = new DBRefEntry("GeneDB", "1", "A123");
DBRefEntry ref8 = new DBRefEntry("PFAM", "1", "A123");
- DBRefEntry[] refs = new DBRefEntry[]
- { ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8 };
+ DBRefEntry[] refs = new DBRefEntry[] { ref1, ref2, ref3, ref4, ref5,
+ ref6, ref7, ref8 };
/*
* Just the DNA refs:
private static final char ZERO = '0';
- private static final char[] BASES = new char[]
- { 'G', 'T', 'C', 'A' };
+ private static final char[] BASES = new char[] { 'G', 'T', 'C', 'A' };
private Random random;
-
+
/**
* Outputs a DNA 'alignment' where each position is a random choice from
* 'GTCA-'.
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @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(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testTranslateCdna_withUntranslatableCodonsAndHiddenColumns()
throws IOException
{
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @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(
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @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(groups ={ "Functional" })
+ @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(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCompareCodonPos()
{
/*
* reorders the cDNA and retranslates, and verifies that the translations are
* the same (apart from ordering).
*/
- @Test(groups ={ "Functional" })
+ @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(groups ={ "Functional" })
+ @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(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConvertCodon()
{
assertEquals("[0, 1, 2]", convertCodon("AAA").toString());
Sequence s5 = new Sequence("s5", "AAAADDEDTTEE");
- SequenceGroup sg1 = new SequenceGroup(Arrays.asList(new SequenceI[]
- { s1, s2 }), "Group1", null, false, false, false, 0, 5);
+ SequenceGroup sg1 = new SequenceGroup(Arrays.asList(new SequenceI[] { s1,
+ s2 }), "Group1", null, false, false, false, 0, 5);
- SequenceGroup sg2 = new SequenceGroup(Arrays.asList(new SequenceI[]
- { s3, s4, s5 }), "Group2", null, false, false, false, 0, 5);
+ SequenceGroup sg2 = new SequenceGroup(Arrays.asList(new SequenceI[] { s3,
+ s4, s5 }), "Group2", null, false, false, false, 0, 5);
- AlignmentI alignment = new Alignment(new SequenceI[]
- { s1, s2, s3, s4, s5 });
+ AlignmentI alignment = new Alignment(
+ new SequenceI[] { s1, s2, s3, s4, s5 });
- int[] positions = new int[]
- { 1, 7, 9 };
+ int[] positions = new int[] { 1, 7, 9 };
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMakeGroupsWithBoth()
{
ArrayList<String> str = new ArrayList<String>();
SequenceGroup[] seqgroupsString = Grouping.makeGroupsFrom(
alignment.getSequencesArray(),
str.toArray(new String[str.size()]),
- Arrays.asList(new SequenceGroup[]
- { sg1, sg2 }));
+ Arrays.asList(new SequenceGroup[] { sg1, sg2 }));
ColumnSelection cs = new ColumnSelection();
for (int p : positions)
{
}
SequenceGroup[] seqgroupsColSel = Grouping.makeGroupsFromCols(
alignment.getSequencesArray(), cs,
- Arrays.asList(new SequenceGroup[]
- { sg1, sg2 }));
- AssertJUnit.assertEquals(seqgroupsString.length, seqgroupsColSel.length);
+ Arrays.asList(new SequenceGroup[] { sg1, sg2 }));
+ AssertJUnit
+ .assertEquals(seqgroupsString.length, seqgroupsColSel.length);
for (int p = 0; p < seqgroupsString.length; p++)
{
AssertJUnit.assertEquals(seqgroupsString[p].getName(),
/**
* Construct an alignment with 4 sequences with varying description format
*/
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp()
{
- SequenceI[] seqs = new SequenceI[]
- { new Sequence("sq1", "THISISAPLACEHOLDER"),
+ SequenceI[] seqs = new SequenceI[] {
+ new Sequence("sq1", "THISISAPLACEHOLDER"),
new Sequence("sq2", "THISISAPLACEHOLDER"),
new Sequence("sq3", "THISISAPLACEHOLDER"),
new Sequence("sq4", "THISISAPLACEHOLDER") };
* more 'number characters' (0-9+.), i.e. greedily matches any trailing
* numeric part of the string
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetScoresFromDescription()
{
String regex = ".*([-0-9.+]+)";
* character, followed by at least one 'number character', then any trailing
* characters.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetScoresFromDescription_twoScores()
{
String regex = ".*([-0-9.+]+).+([-0-9.+]+).*";
*
* @see AlignFrame.extractScores_actionPerformed
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetScoresFromDescription_wordBoundaries()
{
String regex = "\\W*([-+eE0-9.]+)";
import java.util.Vector;
import org.testng.annotations.Test;
+
public class RnaTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetSimpleBPs() throws WUSSParseException
{
String rna = "([{})]"; // JAL-1081 example
assertEquals(5, bps.get(2).bp3); // ]
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetSimpleBPs_unmatchedOpener()
{
String rna = "(([{})]";
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetSimpleBPs_unmatchedCloser()
{
String rna = "([{})]]";
/**
* @throws java.lang.Exception
*/
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
s1 = new Sequence("Seq1", "ASDFAQQQRRRSSS");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
/**
* simple test that mapping from alignment corresponds identical positions.
*/
public void testGetMappingForS1()
{
- AlignSeq as = AlignSeq
- .doGlobalNWAlignment(s1, s2, AlignSeq.PEP);
+ AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s2, AlignSeq.PEP);
System.out.println("s1: " + as.getAStr1());
System.out.println("s2: " + as.getAStr2());
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testExtractGaps()
{
assertNull(AlignSeq.extractGaps(null, null));
assertEquals("ABCD", AlignSeq.extractGaps(" .-", ". -A-B.C D."));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testPrintAlignment()
{
AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s3, AlignSeq.PEP);
{
public static String alntestFile = "FER1_MESCR/72-76 DVYIL\nFER1_SPIOL/71-75 DVYIL\nFER3_RAPSA/21-25 DVYVL\nFER1_MAIZE/73-77 DVYIL\n";
- int[] sf1 = new int[]
- { 74, 74, 73, 73, 23, 23, -1, -1 };
+ int[] sf1 = new int[] { 74, 74, 73, 73, 23, 23, -1, -1 };
- int[] sf2 = new int[]
- { -1, -1, 74, 75, -1, -1, 76, 77 };
+ int[] sf2 = new int[] { -1, -1, 74, 75, -1, -1, 76, 77 };
- int[] sf3 = new int[]
- { -1, -1, -1, -1, -1, -1, 76, 77 };
+ int[] sf3 = new int[] { -1, -1, -1, -1, -1, -1, 76, 77 };
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFeatureScoreModel() throws Exception
{
- AlignFrame alf = new FileLoader(false).LoadFileWaitTillLoaded(alntestFile,
- FormatAdapter.PASTE);
+ AlignFrame alf = new FileLoader(false).LoadFileWaitTillLoaded(
+ alntestFile, FormatAdapter.PASTE);
AlignmentI al = alf.getViewport().getAlignment();
AssertJUnit.assertEquals(4, al.getHeight());
AssertJUnit.assertEquals(5, al.getWidth());
.getFeatureRenderer().getDisplayedFeatureTypes().length);
AssertJUnit.assertTrue(alf.getCurrentView().areFeaturesDisplayed());
FeatureScoreModel fsm = new FeatureScoreModel();
- AssertJUnit.assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView()
- .getAlignPanel()));
+ AssertJUnit.assertTrue(fsm.configureFromAlignmentView(alf
+ .getCurrentView().getAlignPanel()));
alf.selectAllSequenceMenuItem_actionPerformed(null);
float[][] dm = fsm.findDistances(alf.getViewport().getAlignmentView(
true));
AssertJUnit.assertTrue("FER1_MESCR should be identical with RAPSA (2)",
dm[0][2] == 0f);
- AssertJUnit.assertTrue(
- "FER1_MESCR should be further from SPIOL (1) than it is from RAPSA (2)",
- dm[0][1] > dm[0][2]);
+ AssertJUnit
+ .assertTrue(
+ "FER1_MESCR should be further from SPIOL (1) than it is from RAPSA (2)",
+ dm[0][1] > dm[0][2]);
}
}
private static class Worker extends Thread
{
private final Process process;
+
private BufferedReader outputReader;
+
private BufferedReader errorReader;
+
private Integer exit;
private Worker(Process process)
}
}
- @Test(groups =
- { "Functional" }, dataProvider = "allInputOpearationsData")
+ @Test(groups = { "Functional" }, dataProvider = "allInputOpearationsData")
public void testAllInputOperations(String expectedString,
String failureMsg)
{
Assert.assertTrue(successfulCMDs.contains(expectedString), failureMsg);
}
- @Test(groups =
- { "Functional" }, dataProvider = "headlessModeOutputOperationsData")
+ @Test(
+ groups = { "Functional" },
+ dataProvider = "headlessModeOutputOperationsData")
public void testHeadlessModeOutputOperations(String harg, String type,
String fileName, boolean withAWT, int expectedMinFileSize,
int timeout)
new File(fileName).delete();
}
-
@DataProvider(name = "allInputOpearationsData")
public Object[][] getHeadlessModeInputParams()
{
- return new Object[][]
- {
+ return new Object[][] {
// headless mode input operations
{ "CMD [-color zappo] executed successfully!",
"Failed command : -color zappo" },
{ "CMD [-nousagestats] executed successfully!",
"Failed command : -nousagestats" },
{ "CMD [-noquestionnaire] executed successfully!",
- "Failed command : -noquestionnaire nickname=www.test.com" }
- };
+ "Failed command : -noquestionnaire nickname=www.test.com" } };
}
-
+
@DataProvider(name = "headlessModeOutputOperationsData")
public static Object[][] getHeadlessModeOutputParams()
{
- return new Object[][]
- {
+ return new Object[][] {
{ "nodisplay -open examples/uniref50.fa", " -eps",
"test_uniref50_out.eps", true, 4096, 4000 },
{ "nodisplay -open examples/uniref50.fa", " -eps",
{ "headless -open examples/uniref50.fa", " -blc",
"test_uniref50_out.blc", true, 2096, 3000 },
{ "headless -open examples/uniref50.fa", " -jalview",
- "test_uniref50_out.jvp", true, 2096, 3000 },
- };
+ "test_uniref50_out.jvp", true, 2096, 3000 }, };
}
}
private Alignment al;
- @BeforeMethod(alwaysRun = true)
- public void setUp()
+ @BeforeMethod(alwaysRun = true)
+ public void setUp()
{
testee = new EditCommand();
seqs = new SequenceI[4];
/**
* Test inserting gap characters
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAppendEdit_insertGap()
{
// set a non-standard gap character to prove it is actually used
* Test deleting characters from sequences. Note the deleteGap() action does
* not check that only gap characters are being removed.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAppendEdit_deleteGap()
{
testee.appendEdit(Action.DELETE_GAP, seqs, 4, 3, al, true);
* Test a cut action. The command should store the cut characters to support
* undo.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCut()
{
Edit ec = testee.new Edit(Action.CUT, seqs, 4, 3, al);
- testee.cut(ec, new AlignmentI[]
- { al });
+ testee.cut(ec, new AlignmentI[] { al });
assertEquals("abcdhjk", seqs[0].getSequenceAsString());
assertEquals("fghjnopq", seqs[1].getSequenceAsString());
assertEquals("qrstxyz", seqs[2].getSequenceAsString());
/**
* Test a Paste action, where this adds sequences to an alignment.
*/
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
// TODO fix so it works
public void testPaste_addToAlignment()
{
newSeqs[1] = new Sequence("newseq1", "JWMPDH");
Edit ec = testee.new Edit(Action.PASTE, newSeqs, 0, al.getWidth(), al);
- testee.paste(ec, new AlignmentI[]
- { al });
+ testee.paste(ec, new AlignmentI[] { al });
assertEquals(6, al.getSequences().size());
assertEquals("1234567890", seqs[3].getSequenceAsString());
assertEquals("ACEFKL", seqs[4].getSequenceAsString());
/**
* Test insertGap followed by undo command
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testUndo_insertGap()
{
// Edit ec = testee.new Edit(Action.INSERT_GAP, seqs, 4, 3, '?');
testee.appendEdit(Action.INSERT_GAP, seqs, 4, 3, al, true);
// check something changed
assertEquals("abcd???efghjk", seqs[0].getSequenceAsString());
- testee.undoCommand(new AlignmentI[]
- { al });
+ testee.undoCommand(new AlignmentI[] { al });
assertEquals("abcdefghjk", seqs[0].getSequenceAsString());
assertEquals("fghjklmnopq", seqs[1].getSequenceAsString());
assertEquals("qrstuvwxyz", seqs[2].getSequenceAsString());
/**
* Test deleteGap followed by undo command
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testUndo_deleteGap()
{
testee.appendEdit(Action.DELETE_GAP, seqs, 4, 3, al, true);
// check something changed
assertEquals("abcdhjk", seqs[0].getSequenceAsString());
- testee.undoCommand(new AlignmentI[]
- { al });
+ testee.undoCommand(new AlignmentI[] { al });
// deleteGap doesn't 'remember' deleted characters, only gaps get put back
assertEquals("abcd???hjk", seqs[0].getSequenceAsString());
assertEquals("fghj???nopq", seqs[1].getSequenceAsString());
/**
* Test several commands followed by an undo command
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testUndo_multipleCommands()
{
// delete positions 3/4/5 (counting from 1)
assertEquals("12?890", seqs[3].getSequenceAsString());
// undo edit commands
- testee.undoCommand(new AlignmentI[]
- { al });
+ testee.undoCommand(new AlignmentI[] { al });
assertEquals("ab?????hjk", seqs[0].getSequenceAsString());
assertEquals("12?????890", seqs[3].getSequenceAsString());
}
* Unit test for JAL-1594 bug: click and drag sequence right to insert gaps -
* undo did not remove them all.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testUndo_multipleInsertGaps()
{
testee.appendEdit(Action.INSERT_GAP, seqs, 4, 1, al, true);
testee.appendEdit(Action.INSERT_GAP, seqs, 6, 1, al, true);
// undo edit commands
- testee.undoCommand(new AlignmentI[]
- { al });
+ testee.undoCommand(new AlignmentI[] { al });
assertEquals("abcdefghjk", seqs[0].getSequenceAsString());
assertEquals("1234567890", seqs[3].getSequenceAsString());
/**
* Test cut followed by undo command
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testUndo_cut()
{
testee.appendEdit(Action.CUT, seqs, 4, 3, al, true);
// check something changed
assertEquals("abcdhjk", seqs[0].getSequenceAsString());
- testee.undoCommand(new AlignmentI[]
- { al });
+ testee.undoCommand(new AlignmentI[] { al });
assertEquals("abcdefghjk", seqs[0].getSequenceAsString());
assertEquals("fghjklmnopq", seqs[1].getSequenceAsString());
assertEquals("qrstuvwxyz", seqs[2].getSequenceAsString());
/**
* Test the replace command (used to manually edit a sequence)
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testReplace()
{
// seem to need a dataset sequence on the edited sequence here
seqs[1].setDatasetSequence(seqs[1]);
- new EditCommand("", Action.REPLACE, "ZXY", new SequenceI[]
- { seqs[1] }, 4, 8, al);
+ new EditCommand("", Action.REPLACE, "ZXY", new SequenceI[] { seqs[1] },
+ 4, 8, al);
assertEquals("abcdefghjk", seqs[0].getSequenceAsString());
assertEquals("qrstuvwxyz", seqs[2].getSequenceAsString());
assertEquals("1234567890", seqs[3].getSequenceAsString());
* Test that the addEdit command correctly merges insert gap commands when
* possible.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAddEdit_multipleInsertGap()
{
/*
* 3 insert gap in a row (aka mouse drag right):
*/
- Edit e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[]
- { seqs[0] }, 1, 1, al);
+ Edit e = new EditCommand().new Edit(Action.INSERT_GAP,
+ new SequenceI[] { seqs[0] }, 1, 1, al);
testee.addEdit(e);
SequenceI edited = new Sequence("seq0", "a?bcdefghjk");
edited.setDatasetSequence(seqs[0].getDatasetSequence());
- e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[]
- { edited }, 2, 1, al);
+ e = new EditCommand().new Edit(Action.INSERT_GAP,
+ new SequenceI[] { edited }, 2, 1, al);
testee.addEdit(e);
edited = new Sequence("seq0", "a??bcdefghjk");
edited.setDatasetSequence(seqs[0].getDatasetSequence());
- e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[]
- { edited }, 3, 1, al);
+ e = new EditCommand().new Edit(Action.INSERT_GAP,
+ new SequenceI[] { edited }, 3, 1, al);
testee.addEdit(e);
assertEquals(1, testee.getSize());
assertEquals(Action.INSERT_GAP, testee.getEdit(0).getAction());
/*
* Add a non-contiguous edit - should not be merged.
*/
- e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[]
- { edited }, 5, 2, al);
+ e = new EditCommand().new Edit(Action.INSERT_GAP,
+ new SequenceI[] { edited }, 5, 2, al);
testee.addEdit(e);
assertEquals(2, testee.getSize());
assertEquals(5, testee.getEdit(1).getPosition());
/*
* Add a Delete after the Insert - should not be merged.
*/
- e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[]
- { edited }, 6, 2, al);
+ e = new EditCommand().new Edit(Action.DELETE_GAP,
+ new SequenceI[] { edited }, 6, 2, al);
testee.addEdit(e);
assertEquals(3, testee.getSize());
assertEquals(Action.DELETE_GAP, testee.getEdit(2).getAction());
* Test that the addEdit command correctly merges delete gap commands when
* possible.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAddEdit_multipleDeleteGap()
{
/*
* 3 delete gap in a row (aka mouse drag left):
*/
seqs[0].setSequence("a???bcdefghjk");
- Edit e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[]
- { seqs[0] }, 4, 1, al);
+ Edit e = new EditCommand().new Edit(Action.DELETE_GAP,
+ new SequenceI[] { seqs[0] }, 4, 1, al);
testee.addEdit(e);
assertEquals(1, testee.getSize());
SequenceI edited = new Sequence("seq0", "a??bcdefghjk");
edited.setDatasetSequence(seqs[0].getDatasetSequence());
- e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[]
- { edited }, 3, 1, al);
+ e = new EditCommand().new Edit(Action.DELETE_GAP,
+ new SequenceI[] { edited }, 3, 1, al);
testee.addEdit(e);
assertEquals(1, testee.getSize());
edited = new Sequence("seq0", "a?bcdefghjk");
edited.setDatasetSequence(seqs[0].getDatasetSequence());
- e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[]
- { edited }, 2, 1, al);
+ e = new EditCommand().new Edit(Action.DELETE_GAP,
+ new SequenceI[] { edited }, 2, 1, al);
testee.addEdit(e);
assertEquals(1, testee.getSize());
assertEquals(Action.DELETE_GAP, testee.getEdit(0).getAction());
/*
* Add a non-contiguous edit - should not be merged.
*/
- e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[]
- { edited }, 2, 1, al);
+ e = new EditCommand().new Edit(Action.DELETE_GAP,
+ new SequenceI[] { edited }, 2, 1, al);
testee.addEdit(e);
assertEquals(2, testee.getSize());
assertEquals(Action.DELETE_GAP, testee.getEdit(0).getAction());
/*
* Add an Insert after the Delete - should not be merged.
*/
- e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[]
- { edited }, 1, 1, al);
+ e = new EditCommand().new Edit(Action.INSERT_GAP,
+ new SequenceI[] { edited }, 1, 1, al);
testee.addEdit(e);
assertEquals(3, testee.getSize());
assertEquals(Action.INSERT_GAP, testee.getEdit(2).getAction());
* case when they appear contiguous but are acting on different sequences.
* They should not be merged.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAddEdit_removeAllGaps()
{
seqs[0].setSequence("a???bcdefghjk");
- Edit e = new EditCommand().new Edit(Action.DELETE_GAP, new SequenceI[]
- { seqs[0] }, 4, 1, al);
+ Edit e = new EditCommand().new Edit(Action.DELETE_GAP,
+ new SequenceI[] { seqs[0] }, 4, 1, al);
testee.addEdit(e);
seqs[1].setSequence("f??ghjklmnopq");
* Test that the addEdit command correctly merges insert gap commands acting
* on a multi-sequence selection.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAddEdit_groupInsertGaps()
{
/*
* 2 insert gap in a row (aka mouse drag right), on two sequences:
*/
- Edit e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[]
- { seqs[0], seqs[1] }, 1, 1, al);
+ Edit e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] {
+ seqs[0], seqs[1] }, 1, 1, al);
testee.addEdit(e);
SequenceI seq1edited = new Sequence("seq0", "a?bcdefghjk");
seq1edited.setDatasetSequence(seqs[0].getDatasetSequence());
SequenceI seq2edited = new Sequence("seq1", "f?ghjklmnopq");
seq2edited.setDatasetSequence(seqs[1].getDatasetSequence());
- e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[]
- { seq1edited, seq2edited }, 2, 1, al);
+ e = new EditCommand().new Edit(Action.INSERT_GAP, new SequenceI[] {
+ seq1edited, seq2edited }, 2, 1, al);
testee.addEdit(e);
assertEquals(1, testee.getSize());
* <li>last: --A--B-CDEF</li>
* </ul>
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testPriorState_multipleInserts()
{
EditCommand command = new EditCommand();
SequenceI seq = new Sequence("", "--A--B-CDEF");
SequenceI ds = new Sequence("", "ABCDEF");
seq.setDatasetSequence(ds);
- SequenceI[] seqs = new SequenceI[]
- { seq };
+ SequenceI[] seqs = new SequenceI[] { seq };
Edit e = command.new Edit(Action.INSERT_GAP, seqs, 1, 2, '-');
command.addEdit(e);
e = command.new Edit(Action.INSERT_GAP, seqs, 4, 1, '-');
* <li>End: ABC</li>
* </ul>
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testPriorState_removeAllGaps()
{
EditCommand command = new EditCommand();
SequenceI seq = new Sequence("", "ABC");
SequenceI ds = new Sequence("", "ABC");
seq.setDatasetSequence(ds);
- SequenceI[] seqs = new SequenceI[]
- { seq };
+ SequenceI[] seqs = new SequenceI[] { seq };
Edit e = command.new Edit(Action.DELETE_GAP, seqs, 1, 1, '-');
command.addEdit(e);
e = command.new Edit(Action.DELETE_GAP, seqs, 2, 1, '-');
/**
* Test for 'undoing' a single delete edit.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testPriorState_singleDelete()
{
EditCommand command = new EditCommand();
SequenceI seq = new Sequence("", "ABCDEF");
SequenceI ds = new Sequence("", "ABCDEF");
seq.setDatasetSequence(ds);
- SequenceI[] seqs = new SequenceI[]
- { seq };
+ SequenceI[] seqs = new SequenceI[] { seq };
Edit e = command.new Edit(Action.DELETE_GAP, seqs, 2, 2, '-');
command.addEdit(e);
-
+
Map<SequenceI, SequenceI> unwound = command.priorState(false);
assertEquals("AB--CDEF", unwound.get(ds).getSequenceAsString());
}
/**
* Test 'undoing' a single gap insertion edit command.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testPriorState_singleInsert()
{
EditCommand command = new EditCommand();
SequenceI seq = new Sequence("", "AB---CDEF");
SequenceI ds = new Sequence("", "ABCDEF");
seq.setDatasetSequence(ds);
- SequenceI[] seqs = new SequenceI[]
- { seq };
+ SequenceI[] seqs = new SequenceI[] { seq };
Edit e = command.new Edit(Action.INSERT_GAP, seqs, 2, 3, '-');
command.addEdit(e);
-
+
Map<SequenceI, SequenceI> unwound = command.priorState(false);
assertEquals("ABCDEF", unwound.get(ds).getSequenceAsString());
}
* Test that mimics 'remove all gaps' action. This generates delete gap edits
* for contiguous gaps in each sequence separately.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testPriorState_removeGapsMultipleSeqs()
{
EditCommand command = new EditCommand();
SequenceI seq = new Sequence("", "ABC-DEF");
SequenceI ds1 = new Sequence("", "ABCDEF");
seq.setDatasetSequence(ds1);
- SequenceI[] seqs = new SequenceI[]
- { seq };
+ SequenceI[] seqs = new SequenceI[] { seq };
Edit e = command.new Edit(Action.DELETE_GAP, seqs, 0, 2, '-');
command.addEdit(e);
seq = new Sequence("", "ABCDEF");
seq.setDatasetSequence(ds1);
- seqs = new SequenceI[]
- { seq };
+ seqs = new SequenceI[] { seq };
e = command.new Edit(Action.DELETE_GAP, seqs, 3, 1, '-');
command.addEdit(e);
-
+
/*
* Two edits for the second sequence
*/
seq = new Sequence("", "FGHI--J");
SequenceI ds2 = new Sequence("", "FGHIJ");
seq.setDatasetSequence(ds2);
- seqs = new SequenceI[]
- { seq };
+ seqs = new SequenceI[] { seq };
e = command.new Edit(Action.DELETE_GAP, seqs, 2, 1, '-');
command.addEdit(e);
seq = new Sequence("", "FGHIJ");
seq.setDatasetSequence(ds2);
- seqs = new SequenceI[]
- { seq };
+ seqs = new SequenceI[] { seq };
e = command.new Edit(Action.DELETE_GAP, seqs, 4, 2, '-');
command.addEdit(e);
seq = new Sequence("", "MNOPQ");
SequenceI ds3 = new Sequence("", "MNOPQ");
seq.setDatasetSequence(ds3);
- seqs = new SequenceI[]
- { seq };
+ seqs = new SequenceI[] { seq };
e = command.new Edit(Action.DELETE_GAP, seqs, 1, 1, '-');
command.addEdit(e);
* series Delete Gap edits that each act on all sequences that share a gapped
* column region.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testPriorState_removeGappedCols()
{
EditCommand command = new EditCommand();
SequenceI seq3 = new Sequence("", "M-NO--PQ");
SequenceI ds3 = new Sequence("", "MNOPQ");
seq3.setDatasetSequence(ds3);
- SequenceI[] seqs = new SequenceI[]
- { seq1, seq2, seq3 };
+ SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3 };
Edit e = command.new Edit(Action.DELETE_GAP, seqs, 0, 1, '-');
command.addEdit(e);
seq2.setDatasetSequence(ds2);
seq3 = new Sequence("", "M-NOPQ");
seq3.setDatasetSequence(ds3);
- seqs = new SequenceI[]
- { seq1, seq2, seq3 };
+ seqs = new SequenceI[] { seq1, seq2, seq3 };
e = command.new Edit(Action.DELETE_GAP, seqs, 4, 2, '-');
command.addEdit(e);
/**
* Test the method that locates the first aligned sequence that has a mapping.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindAlignedSequence()
{
- AlignmentI cdna = new Alignment(new SequenceI[]
- {});
+ AlignmentI cdna = new Alignment(new SequenceI[] {});
final Sequence seq1 = new Sequence("Seq1", "C-G-TA-GC");
seq1.createDatasetSequence();
cdna.addSequence(seq1);
seq2.createDatasetSequence();
cdna.addSequence(seq2);
- AlignmentI aa = new Alignment(new SequenceI[]
- {});
+ AlignmentI aa = new Alignment(new SequenceI[] {});
final Sequence aseq1 = new Sequence("Seq1", "-P-R");
aseq1.createDatasetSequence();
aa.addSequence(aseq1);
assertNull(acf.findAlignedSequence(seq1, aa));
- MapList map = new MapList(new int[]
- { 1, 6 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1);
acf.addMap(seq1.getDatasetSequence(), aseq2.getDatasetSequence(), map);
/*
* DNA seq1 maps to AA seq2
*/
- assertEquals(aa.getSequenceAt(1),
- acf.findAlignedSequence(cdna
+ assertEquals(aa.getSequenceAt(1), acf.findAlignedSequence(cdna
.getSequenceAt(0).getDatasetSequence(), aa));
- assertEquals(cdna.getSequenceAt(0),
- acf.findAlignedSequence(aa
+ assertEquals(cdna.getSequenceAt(0), acf.findAlignedSequence(aa
.getSequenceAt(1).getDatasetSequence(), cdna));
}
/**
* Test the method that locates the mapped codon for a protein position.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetMappedRegion()
{
// introns lower case, exons upper case
/*
* Set up the mappings for the exons (upper-case bases)
*/
- MapList map = new MapList(new int[]
- { 2, 4, 6, 6, 8, 9 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 2, 4, 6, 6, 8, 9 }, new int[] {
+ 1, 2 }, 3, 1);
acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map);
- map = new MapList(new int[]
- { 1, 2, 4, 5, 7, 8 }, new int[]
- { 1, 2 }, 3, 1);
+ map = new MapList(new int[] { 1, 2, 4, 5, 7, 8 }, new int[] { 1, 2 },
+ 3, 1);
acf.addMap(seq2.getDatasetSequence(), aseq2.getDatasetSequence(), map);
assertEquals("[2, 4]",
assertNull(acf.getMappedRegion(seq1, aseq2, 1));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetMappedCodon()
{
final Sequence seq1 = new Sequence("Seq1", "c-G-TA-gC-gT-T");
/*
* Set up the mappings for the exons (upper-case bases)
*/
- MapList map = new MapList(new int[]
- { 2, 4, 6, 6, 8, 9 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 2, 4, 6, 6, 8, 9 }, new int[] {
+ 1, 2 }, 3, 1);
acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map);
-
+
assertEquals("[G, T, A]", Arrays.toString(acf.getMappedCodon(
aseq1.getDatasetSequence(), 1)));
assertEquals("[C, T, T]", Arrays.toString(acf.getMappedCodon(
/**
* Test normal case for iterating over aligned codons.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testNext()
{
SequenceI from = new Sequence("Seq1", "-CgC-C-cCtAG-AtG-Gc");
from.createDatasetSequence();
SequenceI to = new Sequence("Seq1", "-PQ-R-");
to.createDatasetSequence();
- MapList map = new MapList(new int[]
- { 1, 1, 3, 4, 6, 6, 8, 10, 12, 13 }, new int[]
- { 1, 3 }, 3, 1);
+ MapList map = new MapList(
+ new int[] { 1, 1, 3, 4, 6, 6, 8, 10, 12, 13 },
+ new int[] { 1, 3 }, 3, 1);
Mapping m = new Mapping(to.getDatasetSequence(), map);
Iterator<AlignedCodon> codons = m.getCodonIterator(from, '-');
/**
* Test weird case where the mapping skips over a peptide.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testNext_unmappedPeptide()
{
SequenceI from = new Sequence("Seq1", "-CgC-C-cCtAG-AtG-Gc");
from.createDatasetSequence();
SequenceI to = new Sequence("Seq1", "-PQ-TR-");
to.createDatasetSequence();
- MapList map = new MapList(new int[]
- { 1, 1, 3, 4, 6, 6, 8, 10, 12, 13 }, new int[]
- { 1, 2, 4, 4 }, 3, 1);
+ MapList map = new MapList(
+ new int[] { 1, 1, 3, 4, 6, 6, 8, 10, 12, 13 }, new int[] { 1,
+ 2, 4, 4 }, 3, 1);
Mapping m = new Mapping(to.getDatasetSequence(), map);
Iterator<AlignedCodon> codons = m.getCodonIterator(from, '-');
assertEquals("R", codon.product);
assertFalse(codons.hasNext());
}
-
+
/**
* Test for exception thrown for an incomplete codon.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testNext_incompleteCodon()
{
SequenceI from = new Sequence("Seq1", "-CgC-C-cCgTt");
from.createDatasetSequence();
SequenceI to = new Sequence("Seq1", "-PQ-R-");
to.createDatasetSequence();
- MapList map = new MapList(new int[]
- { 1, 1, 3, 4, 6, 6, 8, 8 }, new int[]
- { 1, 3 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 1, 3, 4, 6, 6, 8, 8 },
+ new int[] { 1, 3 }, 3, 1);
Mapping m = new Mapping(to.getDatasetSequence(), map);
Iterator<AlignedCodon> codons = m.getCodonIterator(from, '-');
/**
* Test normal case for iterating over aligned codons.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAnother()
{
SequenceI from = new Sequence("Seq1", "TGCCATTACCAG-");
from.createDatasetSequence();
SequenceI to = new Sequence("Seq1", "CHYQ");
to.createDatasetSequence();
- MapList map = new MapList(new int[]
- { 1, 12 }, new int[]
- { 1, 4 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1);
Mapping m = new Mapping(to.getDatasetSequence(), map);
-
+
Iterator<AlignedCodon> codons = m.getCodonIterator(from, '-');
AlignedCodon codon = codons.next();
assertEquals("[0, 1, 2]", codon.toString());
public class AlignedCodonTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testEquals()
{
AlignedCodon ac = new AlignedCodon(1, 3, 4);
assertTrue(ac.equals(ac));
}
- @Test(groups ={ "Functional" })
- public void testToString() {
+ @Test(groups = { "Functional" })
+ public void testToString()
+ {
AlignedCodon ac = new AlignedCodon(1, 3, 4);
assertEquals("[1, 3, 4]", ac.toString());
}
public class AlignmentAnnotationTests
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCopyConstructor()
{
SequenceI sq = new Sequence("Foo", "ARAARARARAWEAWEAWRAWEAWE");
alc.getProperty(key));
}
}
+
/**
* create some dummy annotation derived from the sequence
*
* different dataset frames (annotation transferred by mapping between
* sequences)
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testLiftOver()
{
SequenceI sqFrom = new Sequence("fromLong", "QQQCDEWGH");
alSeq2.setStart(sqTo.getStart() + align.getSeq2Start() - 1);
alSeq2.setEnd(sqTo.getStart() + align.getSeq2End() - 1);
alSeq2.setDatasetSequence(sqTo);
- System.out.println(new AppletFormatAdapter().formatSequences("STH",
- new Alignment(new SequenceI[]
- { sqFrom, alSeq1, sqTo, alSeq2 }), true));
+ System.out.println(new AppletFormatAdapter()
+ .formatSequences("STH", new Alignment(new SequenceI[] { sqFrom,
+ alSeq1, sqTo, alSeq2 }), true));
Mapping mp = align.getMappingFromS1(false);
almap2.setSequenceRef(alSeq2);
almap2.adjustForAlignment();
- AlignmentI all = new Alignment(new SequenceI[]
- { alSeq1, alSeq2 });
+ AlignmentI all = new Alignment(new SequenceI[] { alSeq1, alSeq2 });
all.addAnnotation(almap1);
all.addAnnotation(almap2);
System.out.println(new AppletFormatAdapter().formatSequences("STH",
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAdjustForAlignment()
{
SequenceI seq = new Sequence("TestSeq", "ABCDEFG");
/*
* Annotate positions 3/4/5 (CDE) with values 1/2/3
*/
- Annotation[] anns = new Annotation[]
- { null, null, new Annotation(1), new Annotation(2), new Annotation(3) };
+ Annotation[] anns = new Annotation[] { null, null, new Annotation(1),
+ new Annotation(2), new Annotation(3) };
AlignmentAnnotation ann = new AlignmentAnnotation("SS",
"secondary structure", anns);
seq.addAlignmentAnnotation(ann);
* Read in Stockholm format test data including secondary structure
* annotations.
*/
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws IOException
{
al = loadAlignment(TEST_DATA, "STH");
/**
* Test method that returns annotations that match on calcId.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindAnnotation_byCalcId()
{
Iterable<AlignmentAnnotation> anns = al
assertFalse(iter.hasNext());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeleteAllAnnotations_includingAutocalculated()
{
AlignmentAnnotation aa = new AlignmentAnnotation("Consensus",
assertEquals("Not all deleted", 0, al.getAlignmentAnnotation().length);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeleteAllAnnotations_excludingAutocalculated()
{
AlignmentAnnotation aa = new AlignmentAnnotation("Consensus",
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignAs_dnaAsDna() throws IOException
{
// aligned cDNA:
* of what would normally be protein here.
*/
AlignedCodonFrame acf = new AlignedCodonFrame();
- MapList ml = new MapList(new int[]
- { 1, 12 }, new int[]
- { 1, 12 }, 1, 1);
+ MapList ml = new MapList(new int[] { 1, 12 }, new int[] { 1, 12 }, 1, 1);
acf.addMap(al2.getSequenceAt(0), al1.getSequenceAt(0), ml);
acf.addMap(al2.getSequenceAt(1), al1.getSequenceAt(1), ml);
al1.addCodonFrame(acf);
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignAs_proteinAsCdna() throws IOException
{
// see also AlignmentUtilsTests
AlignmentI al1 = loadAlignment(CDNA_SEQS_1, "FASTA");
AlignmentI al2 = loadAlignment(AA_SEQS_1, "FASTA");
AlignedCodonFrame acf = new AlignedCodonFrame();
- MapList ml = new MapList(new int[]
- { 1, 12 }, new int[]
- { 1, 4 }, 3, 1);
+ MapList ml = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1);
acf.addMap(al1.getSequenceAt(0), al2.getSequenceAt(0), ml);
acf.addMap(al1.getSequenceAt(1), al2.getSequenceAt(1), ml);
al2.addCodonFrame(acf);
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignAs_cdnaAsProtein() throws IOException
{
/*
AlignmentI al1 = loadAlignment(CDNA_SEQS_1, "FASTA");
AlignmentI al2 = loadAlignment(AA_SEQS_1, "FASTA");
AlignedCodonFrame acf = new AlignedCodonFrame();
- MapList ml = new MapList(new int[]
- { 1, 12 }, new int[]
- { 1, 4 }, 3, 1);
+ MapList ml = new MapList(new int[] { 1, 12 }, new int[] { 1, 4 }, 3, 1);
acf.addMap(al1.getSequenceAt(0), al2.getSequenceAt(0), ml);
acf.addMap(al1.getSequenceAt(1), al2.getSequenceAt(1), ml);
al2.addCodonFrame(acf);
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignAs_dnaAsProtein_withIntrons() throws IOException
{
/*
AlignedCodonFrame acf = new AlignedCodonFrame();
// Seq1 has intron at dna positions 3,4,9 so splice is AAG GCC TTT
// Seq2 has intron at dna positions 1,5,6 so splice is CCG TTT AAA
- MapList ml1 = new MapList(new int[]
- { 1, 2, 5, 8, 10, 12 }, new int[]
- { 1, 3 }, 3, 1);
+ MapList ml1 = new MapList(new int[] { 1, 2, 5, 8, 10, 12 }, new int[] {
+ 1, 3 }, 3, 1);
acf.addMap(al1.getSequenceAt(0), al2.getSequenceAt(0), ml1);
- MapList ml2 = new MapList(new int[]
- { 2, 4, 7, 12 }, new int[]
- { 1, 3 }, 3, 1);
+ MapList ml2 = new MapList(new int[] { 2, 4, 7, 12 },
+ new int[] { 1, 3 }, 3, 1);
acf.addMap(al1.getSequenceAt(1), al2.getSequenceAt(1), ml2);
al2.addCodonFrame(acf);
package jalview.datamodel;
+
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
public class ColumnSelectionTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAddElement()
{
ColumnSelection cs = new ColumnSelection();
* Test the remove method - in particular to verify that remove(int i) removes
* the element whose value is i, _NOT_ the i'th element.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRemoveElement()
{
ColumnSelection cs = new ColumnSelection();
* Test the method that finds the visible column position of an alignment
* column, allowing for hidden columns.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindColumnPosition()
{
ColumnSelection cs = new ColumnSelection();
/**
* Tests for the method that compares equality of reference (but not mapping)
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testEqualRef()
{
DBRefEntry ref1 = new DBRefEntry("UNIPROT", "1", "V71633");
assertFalse(ref1.equalRef(new DBRefEntry("UNIPROT", "1", "V71632")));
// presence of or differences in mappings are ignored
- ref1.setMap(new Mapping(new MapList(new int[]
- { 1, 3 }, new int[]
- { 1, 1 }, 3, 1)));
+ ref1.setMap(new Mapping(new MapList(new int[] { 1, 3 }, new int[] { 1,
+ 1 }, 3, 1)));
assertTrue(ref1.equalRef(ref2));
assertTrue(ref2.equalRef(ref1));
- ref1.setMap(new Mapping(new MapList(new int[]
- { 1, 6 }, new int[]
- { 1, 2 }, 3, 1)));
+ ref1.setMap(new Mapping(new MapList(new int[] { 1, 6 }, new int[] { 1,
+ 2 }, 3, 1)));
assertTrue(ref1.equalRef(ref2));
assertTrue(ref2.equalRef(ref1));
}
* trite test of the intersectVisContigs method for a simple DNA -> Protein
* exon map and a range of visContigs
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testIntersectVisContigs()
{
- MapList fk = new MapList(new int[]
- { 1, 6, 8, 13, 15, 23 }, new int[]
- { 1, 7 }, 3, 1);
+ MapList fk = new MapList(new int[] { 1, 6, 8, 13, 15, 23 }, new int[] {
+ 1, 7 }, 3, 1);
Mapping m = new Mapping(fk);
- Mapping m_1 = m.intersectVisContigs(new int[]
- { fk.getFromLowest(), fk.getFromHighest() });
- Mapping m_2 = m.intersectVisContigs(new int[]
- { 1, 7, 11, 20 });
+ Mapping m_1 = m.intersectVisContigs(new int[] { fk.getFromLowest(),
+ fk.getFromHighest() });
+ Mapping m_2 = m.intersectVisContigs(new int[] { 1, 7, 11, 20 });
// assertions from output values 'as is', not checked for correctness
- String result = Arrays.deepToString(m_1.map.getFromRanges()
- .toArray());
+ String result = Arrays.deepToString(m_1.map.getFromRanges().toArray());
System.out.println(result);
assertEquals("[[1, 6], [8, 13], [15, 23]]", result);
package jalview.datamodel;
+
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
public class PDBEntryTest
{
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
}
{
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void test()
{
try
{
- PDBEntry pdbEntry = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB,
- "x/y/z/File");
+ PDBEntry pdbEntry = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB,
+ "x/y/z/File");
- PDBEntry case1 = new PDBEntry("1XYZ", "A", PDBEntry.Type.PDB,
- "x/y/z/File");
- PDBEntry case2 = new PDBEntry("1xyz", "a", PDBEntry.Type.PDB,
- "x/y/z/File");
- PDBEntry case3 = new PDBEntry("1xyz", "A", PDBEntry.Type.FILE,
- "x/y/z/File");
- PDBEntry case4 = new PDBEntry(null, null, null, null);
- PDBEntry case5 = new PDBEntry(null, "A", PDBEntry.Type.PDB,
- "x/y/z/File");
- PDBEntry case6 = new PDBEntry("1xyz", null, PDBEntry.Type.PDB,
- "x/y/z/File");
- PDBEntry case7 = new PDBEntry("1xyz", "A", null, "x/y/z/File");
- PDBEntry case8 = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB, null);
+ PDBEntry case1 = new PDBEntry("1XYZ", "A", PDBEntry.Type.PDB,
+ "x/y/z/File");
+ PDBEntry case2 = new PDBEntry("1xyz", "a", PDBEntry.Type.PDB,
+ "x/y/z/File");
+ PDBEntry case3 = new PDBEntry("1xyz", "A", PDBEntry.Type.FILE,
+ "x/y/z/File");
+ PDBEntry case4 = new PDBEntry(null, null, null, null);
+ PDBEntry case5 = new PDBEntry(null, "A", PDBEntry.Type.PDB,
+ "x/y/z/File");
+ PDBEntry case6 = new PDBEntry("1xyz", null, PDBEntry.Type.PDB,
+ "x/y/z/File");
+ PDBEntry case7 = new PDBEntry("1xyz", "A", null, "x/y/z/File");
+ PDBEntry case8 = new PDBEntry("1xyz", "A", PDBEntry.Type.PDB, null);
PDBEntry case9 = new PDBEntry("1xyz", "A", null, "x/y/z/File");
-
// System.out.println(">>>> Testing case 1");
- assertTrue(pdbEntry.equals(case1));
+ assertTrue(pdbEntry.equals(case1));
// System.out.println(">>>> Testing case 2");
- assertTrue(pdbEntry.equals(case2));
+ assertTrue(pdbEntry.equals(case2));
// System.out.println(">>>> Testing case 3");
- assertTrue(!pdbEntry.equals(case3));
+ assertTrue(!pdbEntry.equals(case3));
// System.out.println(">>>> Testing case 4");
- assertTrue(!pdbEntry.equals(case4));
+ assertTrue(!pdbEntry.equals(case4));
// System.out.println(">>>> Testing case 5");
- assertTrue(!pdbEntry.equals(case5));
+ assertTrue(!pdbEntry.equals(case5));
// System.out.println(">>>> Testing case 6");
- assertTrue(!pdbEntry.equals(case6));
+ assertTrue(!pdbEntry.equals(case6));
// System.out.println(">>>> Testing case 7");
- assertTrue(!pdbEntry.equals(case7));
+ assertTrue(!pdbEntry.equals(case7));
// System.out.println(">>>> Testing case 8");
assertTrue(pdbEntry.equals(case8));
assertTrue(pdbEntry.equals(case8));
public class SearchResultsTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testToString()
{
SequenceI seq = new Sequence("", "abcdefghijklm");
*
* TODO: split into separate tests
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSomething() throws Exception
{
String o_seq = "asdfktryasdtqwrtsaslldddptyipqqwaslchvhttt";
*/
assertEquals("Failed getWidth", sub_gapped_s.length(),
sub_gapped.getWidth());
-
+
sub_gapped.getFullWidth();
assertFalse("hasDeletedRegions is incorrect",
sub_gapped.hasDeletedRegions());
}
}
- SeqCigar[] set = new SeqCigar[]
- { new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
- new SeqCigar(s_gapped) };
+ SeqCigar[] set = new SeqCigar[] { new SeqCigar(s),
+ new SeqCigar(s_subsequence_gapped, 8, 48), new SeqCigar(s_gapped) };
Alignment al = new Alignment(set);
for (int i = 0; i < al.getHeight(); i++)
{
}
System.out.println("Gapped.");
- set = new SeqCigar[]
- { new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
- new SeqCigar(s_gapped) };
+ set = new SeqCigar[] { new SeqCigar(s),
+ new SeqCigar(s_subsequence_gapped, 8, 48), new SeqCigar(s_gapped) };
set[0].deleteRange(20, 25);
al = new Alignment(set);
for (int i = 0; i < al.getHeight(); i++)
* @return String
*/
-
protected void testCigar_string(Sequence seq, String ex_cs_gapped)
{
SeqCigar c_sgapped = new SeqCigar(seq);
String cs_gapped = c_sgapped.getCigarstring();
- assertEquals("Failed getCigarstring", ex_cs_gapped,
- cs_gapped);
+ assertEquals("Failed getCigarstring", ex_cs_gapped, cs_gapped);
}
-
- protected void testSeqRecovery(SeqCigar gen_sgapped,
- SequenceI s_gapped)
+ protected void testSeqRecovery(SeqCigar gen_sgapped, SequenceI s_gapped)
{
// this is non-rigorous - start and end recovery is not tested.
SequenceI gen_sgapped_s = gen_sgapped.getSeq('-');
import org.testng.annotations.Test;
-
public class SequenceDummyTest
{
/**
* test for become method
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBecome()
{
SequenceI seq = new Sequence("OrigSeq", "ASEQUENCE");
SequenceFeature ofeat = new SequenceFeature("NewFeat", "somedesc", 3,
12, 2.3f, "none");
-
+
SequenceDummy dummySeq = new SequenceDummy("OrigSeq");
dummySeq.addSequenceFeature(ofeat);
dummySeq.become(seq);
{
SequenceI seq;
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp()
{
seq = new Sequence("FER1", "AKPNGVL");
}
- @Test(groups ={ "Functional" })
+
+ @Test(groups = { "Functional" })
public void testInsertGapsAndGapmaps()
{
SequenceI aseq = seq.deriveSequence();
assertEquals("Gap interval 2 end wrong", 8, gapInt.get(1)[1]);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetAnnotation()
{
// initial state returns null not an empty array
assertNull(seq.getAnnotation());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetAnnotation_forLabel()
{
- AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1", 1f);
- AlignmentAnnotation ann2 = addAnnotation("label2", "desc2", "calcId2", 1f);
- AlignmentAnnotation ann3 = addAnnotation("label1", "desc3", "calcId3", 1f);
+ AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1",
+ 1f);
+ AlignmentAnnotation ann2 = addAnnotation("label2", "desc2", "calcId2",
+ 1f);
+ AlignmentAnnotation ann3 = addAnnotation("label1", "desc3", "calcId3",
+ 1f);
AlignmentAnnotation[] anns = seq.getAnnotation("label1");
assertEquals(2, anns.length);
assertSame(ann1, anns[0]);
}
private AlignmentAnnotation addAnnotation(String label,
- String description, String calcId,
- float value)
+ String description, String calcId, float value)
{
- final AlignmentAnnotation annotation = new AlignmentAnnotation(label, description,
- value);
+ final AlignmentAnnotation annotation = new AlignmentAnnotation(label,
+ description, value);
annotation.setCalcId(calcId);
seq.addAlignmentAnnotation(annotation);
return annotation;
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetAlignmentAnnotations_forCalcIdAndLabel()
{
AlignmentAnnotation ann1 = addAnnotation("label1", "desc1", "calcId1",
1f);
AlignmentAnnotation ann4 = addAnnotation("label2", "desc3", "calcId2",
1f);
- AlignmentAnnotation ann5 = addAnnotation("label5", "desc3", null,
- 1f);
- AlignmentAnnotation ann6 = addAnnotation(null, "desc3", "calcId3",
- 1f);
+ AlignmentAnnotation ann5 = addAnnotation("label5", "desc3", null, 1f);
+ AlignmentAnnotation ann6 = addAnnotation(null, "desc3", "calcId3", 1f);
List<AlignmentAnnotation> anns = seq.getAlignmentAnnotations("calcId2",
"label2");
assertEquals(2, anns.size());
assertSame(ann2, anns.get(0));
assertSame(ann4, anns.get(1));
-
+
assertTrue(seq.getAlignmentAnnotations("calcId2", "label3").isEmpty());
assertTrue(seq.getAlignmentAnnotations("calcId3", "label5").isEmpty());
assertTrue(seq.getAlignmentAnnotations("calcId2", null).isEmpty());
* setting the sequenceRef on the annotation. Adding the same annotation twice
* should be ignored.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAddAlignmentAnnotation()
{
assertNull(seq.getAnnotation());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetStartGetEnd()
{
SequenceI seq = new Sequence("test", "ABCDEF");
* Tests for the method that returns an alignment column position (base 1) for
* a given sequence position (base 1).
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindIndex()
{
SequenceI seq = new Sequence("test", "ABCDEF");
* Tests for the method that returns a dataset sequence position (base 1) for
* an aligned column position (base 0).
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindPosition()
{
SequenceI seq = new Sequence("test", "ABCDEF");
assertEquals(7, seq.findPosition(11));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeleteChars()
{
SequenceI seq = new Sequence("test", "ABCDEF");
assertEquals(6, seq.getEnd());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testInsertCharAt()
{
// non-static methods:
* Test the method that returns an array of aligned sequence positions where
* the array index is the data sequence position (both base 0).
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGapMap()
{
SequenceI seq = new Sequence("test", "-A--B-CD-E--F-");
* Test the method that gets sequence features, either from the sequence or
* its dataset.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetSequenceFeatures()
{
SequenceI seq = new Sequence("test", "GATCAT");
* entries are the residue positions at the sequence position (or to the right
* if a gap)
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindPositionMap()
{
/*
*/
Sequence seq = new Sequence("TestSeq", "AB.C-D E.");
int[] map = seq.findPositionMap();
- assertEquals(Arrays.toString(new int[]
- { 1, 2, 3, 3, 4, 4, 5, 5, 6 }), Arrays.toString(map));
+ assertEquals(Arrays.toString(new int[] { 1, 2, 3, 3, 4, 4, 5, 5, 6 }),
+ Arrays.toString(map));
}
/**
* Test for getSubsequence
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetSubsequence()
{
SequenceI seq = new Sequence("TestSeq", "ABCDEFG");
/**
* Test for deriveSequence applied to a sequence with a dataset
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeriveSequence_existingDataset()
{
SequenceI seq = new Sequence("Seq1", "CD");
/**
* Test for deriveSequence applied to an ungapped sequence with no dataset
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeriveSequence_noDatasetUngapped()
{
SequenceI seq = new Sequence("Seq1", "ABCDEF");
/**
* Test for deriveSequence applied to a gapped sequence with no dataset
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeriveSequence_noDatasetGapped()
{
SequenceI seq = new Sequence("Seq1", "AB-C.D EF");
public class EmblFileTest
{
// adapted from http://www.ebi.ac.uk/Tools/dbfetch/dbfetch/embl/x53828/emblxml
- private static final String TESTDATA =
- "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
+ private static final String TESTDATA = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
+ "<EMBL_Services>"
+ "<entry accession=\"X53828\" version=\"3\" lastUpdated=\"2005-04-18\" releaseCreated=\"25\" releaseLastUpdated=\"83\">"
+ "<description>Chicken LDH-A mRNA for lactate dehydrogenase A chain (EC 1.1.1.27)</description>"
+ "<qualifier name=\"note\"><value>L-lactate dehydrogenase A-chain</value><value>pickle</value></qualifier>"
+ "<qualifier name=\"translation\"><value>MSLKDHLIHN</value><evidence>Keith</evidence></qualifier>"
+ "<location type=\"single\" complement=\"true\">"
- + "<locationElement type=\"range\" accession=\"X53828\" version=\"1\" complement=\"false\">"
+ + "<locationElement type=\"range\" accession=\"X53828\" version=\"1\" complement=\"false\">"
+ "<basePosition type=\"simple\">60</basePosition><basePosition type=\"join\">1058</basePosition>"
- + "</locationElement></location></feature>"
+ + "</locationElement></location></feature>"
+ "<sequence type=\"mRNA\" version=\"2\">GTGACG</sequence></entry></EMBL_Services>";
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetEmblFile()
{
Vector<EmblEntry> entries = EmblFile.getEmblFile(
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
- jalview.bin.Jalview.main(new String[]
- {
+ jalview.bin.Jalview.main(new String[] {
"-noquestionnaire -nonews -props",
"test/jalview/ext/rbvi/chimera/testProps.jvprops" });
}
jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSingleSeqViewJMol()
{
Cache.setProperty(Preferences.STRUCTURE_DISPLAY, ViewerType.JMOL.name());
{
dsq = dsq.getDatasetSequence();
}
- if (dsq.getAllPDBEntries() != null && dsq.getAllPDBEntries().size() > 0)
+ if (dsq.getAllPDBEntries() != null
+ && dsq.getAllPDBEntries().size() > 0)
{
for (int q = 0; q < dsq.getAllPDBEntries().size(); q++)
{
structureViewer.setViewerType(ViewerType.JMOL);
JalviewStructureDisplayI jmolViewer = structureViewer
.viewStructures(dsq.getAllPDBEntries().elementAt(q),
- new SequenceI[]
- { sq }, af.getCurrentView().getAlignPanel());
+ new SequenceI[] { sq }, af.getCurrentView()
+ .getAlignPanel());
/*
* Wait for viewer load thread to complete
*/
*/
public class PDBFileWithJmolTest
{
- String[] testFile = new String[]
- { "./examples/1GAQ.txt", "./test/jalview/ext/jmol/1QCF.pdb" }; // ,
+ String[] testFile = new String[] { "./examples/1GAQ.txt",
+ "./test/jalview/ext/jmol/1QCF.pdb" }; // ,
// "./examples/DNMT1_MOUSE.pdb"
// };
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp()
{
Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
Boolean.TRUE.toString());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAlignmentLoader() throws Exception
{
for (String f : testFile)
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFileParser() throws Exception
{
for (String pdbStr : testFile)
+ " to the same sequence as MCView",
sq.getSequenceAsString(), mcseqs.remove(0)
.getSequenceAsString());
- AlignmentI al = new Alignment(new SequenceI[]
- { sq });
+ AlignmentI al = new Alignment(new SequenceI[] { sq });
validateSecStrRows(al);
}
}
}
-
private void validateSecStrRows(AlignmentI al)
{
if (!al.isNucleotide())
public class TestAnnotate3D
{
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void test1GIDbyId() throws Exception
{
// use same ID as standard tests given at
testRNAMLcontent(ids, null);
}
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void testIdVsContent2GIS() throws Exception
{
Iterator<Reader> ids = Annotate3D.getRNAMLForPDBId("2GIS");
*
* @throws Exception
*/
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void testPDBfileVsRNAML() throws Exception
{
PDBfile pdbf = new PDBfile(true, false, true, "examples/2GIS.pdb",
testRNAMLcontent(readers, pdbf);
}
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
private void testRNAMLcontent(Iterator<Reader> readers, PDBfile pdbf)
throws Exception
{
String sq_ = new String(sq.getSequence()).toLowerCase();
for (SequenceI _struseq : pdbf.getSeqsAsArray())
{
- final String lowerCase = new String(_struseq.getSequence()).toLowerCase();
- if (lowerCase.equals(
- sq_))
+ final String lowerCase = new String(_struseq.getSequence())
+ .toLowerCase();
+ if (lowerCase.equals(sq_))
{
struseq = _struseq;
break;
}
if (struseq == null)
{
- AssertJUnit.fail("Couldn't find this sequence in original input:\n"
- + new FastaFile().print(new SequenceI[]
- { sq })
- + "\n\nOriginal input:\n"
- + new FastaFile().print(pdbf.getSeqsAsArray()) + "\n");
+ AssertJUnit
+ .fail("Couldn't find this sequence in original input:\n"
+ + new FastaFile()
+ .print(new SequenceI[] { sq })
+ + "\n\nOriginal input:\n"
+ + new FastaFile().print(pdbf.getSeqsAsArray())
+ + "\n");
}
}
}
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses(
-{})
+@SuiteClasses({})
public class AllTests
{
public class ChimeraCommandsTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAddColourRange()
{
Map<Color, Map<Integer, Map<String, List<int[]>>>> map = new LinkedHashMap<Color, Map<Integer, Map<String, List<int[]>>>>();
// inspect positions
List<int[]> posList = map.get(Color.pink).get(1).get("A");
assertEquals(2, posList.size());
- assertTrue(Arrays.equals(new int[]
- { 2, 4 }, posList.get(0)));
- assertTrue(Arrays.equals(new int[]
- { 8, 8 }, posList.get(1)));
+ assertTrue(Arrays.equals(new int[] { 2, 4 }, posList.get(0)));
+ assertTrue(Arrays.equals(new int[] { 8, 8 }, posList.get(1)));
posList = map.get(Color.pink).get(1).get("B");
assertEquals(1, posList.size());
- assertTrue(Arrays.equals(new int[]
- { 5, 7 }, posList.get(0)));
+ assertTrue(Arrays.equals(new int[] { 5, 7 }, posList.get(0)));
posList = map.get(Color.red).get(0).get("B");
assertEquals(1, posList.size());
- assertTrue(Arrays.equals(new int[]
- { 1, 4 }, posList.get(0)));
+ assertTrue(Arrays.equals(new int[] { 1, 4 }, posList.get(0)));
posList = map.get(Color.red).get(1).get("A");
assertEquals(1, posList.size());
- assertTrue(Arrays.equals(new int[]
- { 3, 5 }, posList.get(0)));
+ assertTrue(Arrays.equals(new int[] { 3, 5 }, posList.get(0)));
posList = map.get(Color.orange).get(0).get("C");
assertEquals(1, posList.size());
- assertTrue(Arrays.equals(new int[]
- { 5, 9 }, posList.get(0)));
+ assertTrue(Arrays.equals(new int[] { 5, 9 }, posList.get(0)));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildColourCommands()
{
public class ChimeraConnect
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testLaunchAndExit()
{
final StructureManager structureManager = new StructureManager(true);
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
- jalview.bin.Jalview.main(new String[]
- {
+ jalview.bin.Jalview.main(new String[] {
"-noquestionnaire -nonews -props",
"test/jalview/ext/rbvi/chimera/testProps.jvprops" });
}
jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSingleSeqViewChimera()
{
Cache.setProperty(Preferences.STRUCTURE_DISPLAY,
{
dsq = dsq.getDatasetSequence();
}
- if (dsq.getAllPDBEntries() != null && dsq.getAllPDBEntries().size() > 0)
+ if (dsq.getAllPDBEntries() != null
+ && dsq.getAllPDBEntries().size() > 0)
{
for (int q = 0; q < dsq.getAllPDBEntries().size(); q++)
{
structureViewer.setViewerType(ViewerType.CHIMERA);
JalviewStructureDisplayI chimeraViewer = structureViewer
.viewStructures(dsq.getAllPDBEntries().elementAt(q),
- new SequenceI[]
- { sq }, af.getCurrentView().getAlignPanel());
+ new SequenceI[] { sq }, af.getCurrentView()
+ .getAlignPanel());
/*
* Wait for viewer load thread to complete
*/
{
AlignmentI al;
+
AlignViewport testee;
@BeforeClass(alwaysRun = true)
"test/jalview/testProps.jvprops" });
}
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp()
{
SequenceI seq1 = new Sequence("Seq1", "ABC");
SequenceI seq2 = new Sequence("Seq2", "ABC");
SequenceI seq3 = new Sequence("Seq3", "ABC");
- SequenceI[] seqs = new SequenceI[]
- { seq1, seq2, seq3 };
+ SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3 };
al = new Alignment(seqs);
al.setDataset(null);
testee = new AlignViewport(al);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCollateForPdb()
{
/*
* seq1 and seq3 refer to 1ABC, seq2 to 2ABC, none to 3ABC
*/
al.getSequenceAt(0).getDatasetSequence()
- .addPDBId(
- new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb"));
+ .addPDBId(new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb"));
al.getSequenceAt(2).getDatasetSequence()
- .addPDBId(
- new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb"));
+ .addPDBId(new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb"));
al.getSequenceAt(1).getDatasetSequence()
- .addPDBId(
- new PDBEntry("2ABC", "C", Type.PDB, "2ABC.pdb"));
+ .addPDBId(new PDBEntry("2ABC", "C", Type.PDB, "2ABC.pdb"));
/*
* Add a second chain PDB xref to Seq2 - should not result in a duplicate in
* the results
/*
* run method under test
*/
- SequenceI[][] seqs = testee.collateForPDB(new PDBEntry[]
- { pdb1, pdb2, pdb3 });
+ SequenceI[][] seqs = testee.collateForPDB(new PDBEntry[] { pdb1, pdb2,
+ pdb3 });
// seq1 and seq3 refer to PDBEntry[0]
assertEquals(2, seqs[0].length);
* Test that a mapping is not deregistered when a second view is closed but
* the first still holds a reference to the mapping
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeregisterMapping_onCloseView()
{
/*
*/
AlignFrame af1 = new FileLoader().LoadFileWaitTillLoaded(
">Seq1\nCAGT\n", FormatAdapter.PASTE);
-
+
AlignedCodonFrame acf1 = new AlignedCodonFrame();
AlignedCodonFrame acf2 = new AlignedCodonFrame();
-
+
Set<AlignedCodonFrame> mappings = new LinkedHashSet<AlignedCodonFrame>();
mappings.add(acf1);
mappings.add(acf2);
af1.getViewport().getAlignment().setCodonFrames(mappings);
af1.newView_actionPerformed(null);
-
+
/*
* Verify that creating the alignment for the new View has registered the
* mappings
assertEquals(2, ssm.seqmappings.size());
assertTrue(ssm.seqmappings.contains(acf1));
assertTrue(ssm.seqmappings.contains(acf2));
-
+
/*
* Close the second view. Verify that mappings are not removed as the first
* view still holds a reference to them.
/**
* Test that a mapping is deregistered if no alignment holds a reference to it
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeregisterMapping_withNoReference()
{
Desktop d = Desktop.instance;
">Seq1\nRSVQ\n", FormatAdapter.PASTE);
AlignFrame af2 = new FileLoader().LoadFileWaitTillLoaded(
">Seq2\nDGEL\n", FormatAdapter.PASTE);
-
+
AlignedCodonFrame acf1 = new AlignedCodonFrame();
AlignedCodonFrame acf2 = new AlignedCodonFrame();
AlignedCodonFrame acf3 = new AlignedCodonFrame();
-
+
Set<AlignedCodonFrame> mappings1 = new LinkedHashSet<AlignedCodonFrame>();
mappings1.add(acf1);
af1.getViewport().getAlignment().setCodonFrames(mappings1);
mappings2.add(acf2);
mappings2.add(acf3);
af2.getViewport().getAlignment().setCodonFrames(mappings2);
-
+
/*
* AlignFrame1 has mapping acf1, AlignFrame2 has acf2 and acf3
*/
* Test that a mapping is not deregistered if another alignment holds a
* reference to it
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeregisterMapping_withReference()
{
Desktop d = Desktop.instance;
StructureSelectionManager ssm = StructureSelectionManager
.getStructureSelectionManager(Desktop.instance);
ssm.resetAll();
-
+
AlignFrame af1 = new FileLoader().LoadFileWaitTillLoaded(
">Seq1\nRSVQ\n", FormatAdapter.PASTE);
AlignFrame af2 = new FileLoader().LoadFileWaitTillLoaded(
">Seq2\nDGEL\n", FormatAdapter.PASTE);
-
+
AlignedCodonFrame acf1 = new AlignedCodonFrame();
AlignedCodonFrame acf2 = new AlignedCodonFrame();
AlignedCodonFrame acf3 = new AlignedCodonFrame();
-
+
Set<AlignedCodonFrame> mappings1 = new LinkedHashSet<AlignedCodonFrame>();
mappings1.add(acf1);
mappings1.add(acf2);
af1.getViewport().getAlignment().setCodonFrames(mappings1);
-
+
Set<AlignedCodonFrame> mappings2 = new LinkedHashSet<AlignedCodonFrame>();
mappings2.add(acf2);
mappings2.add(acf3);
af2.getViewport().getAlignment().setCodonFrames(mappings2);
-
+
/*
* AlignFrame1 has mappings acf1 and acf2, AlignFrame2 has acf2 and acf3
*/
-
+
Set<AlignedCodonFrame> ssmMappings = ssm.seqmappings;
assertEquals(0, ssmMappings.size());
ssm.registerMapping(acf1);
assertEquals(2, ssmMappings.size());
ssm.registerMapping(acf3);
assertEquals(3, ssmMappings.size());
-
+
/*
* Closing AlignFrame2 should remove mapping acf3 from
* StructureSelectionManager, but not acf2, since AlignFrame1 still has a
AlignFrame af;
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws IOException
{
// pin down annotation sort order for test
private void addAnnotations()
{
Annotation an = new Annotation(2f);
- Annotation[] anns = new Annotation[]
- { an, an, an };
+ Annotation[] anns = new Annotation[] { an, an, an };
AlignmentAnnotation ann0 = new AlignmentAnnotation("IUPRED", "", anns);
AlignmentAnnotation ann1 = new AlignmentAnnotation("Beauty", "", anns);
AlignmentAnnotation ann2 = new AlignmentAnnotation("JMol", "", anns);
/**
* Test creation of panel with OK and Cancel buttons
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildActionButtonsPanel()
{
testee = new AnnotationChooser(parentPanel);
* Test 'Apply to' has 3 radio buttons enabled, 'Selected Sequences' selected,
* when there is a current selection group.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildApplyToOptionsPanel_withSelectionGroup()
{
selectSequences(0, 2, 3);
* Test 'Apply to' has 1 radio button enabled, 'All Sequences' selected, when
* there is no current selection group.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildApplyToOptionsPanel_noSelectionGroup()
{
testee = new AnnotationChooser(parentPanel);
/**
* Test Show and Hide radio buttons created, with Hide initially selected.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildShowHidePanel()
{
testee = new AnnotationChooser(parentPanel);
/**
* Test construction of panel containing two sub-panels
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildShowHideOptionsPanel()
{
testee = new AnnotationChooser(parentPanel);
* Test that annotation types are (uniquely) identified.
*
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetAnnotationTypes()
{
selectSequences(1);
* We expect all annotations of that type to be set hidden. Other annotations
* should be left visible.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSelectType_hideForAll()
{
selectSequences(1, 2);
* We expect the annotations of that type, linked to the sequence group, to be
* set hidden. Other annotations should be left visible.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSelectType_hideForSelected()
{
selectSequences(1, 2);
* We expect all annotations of that type to be set visible. Other annotations
* should be left unchanged.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeselectType_hideForAll()
{
selectSequences(1, 2);
* We expect the annotations of that type, linked to the sequence group, to be
* set visible. Other annotations should be left unchanged.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeselectType_hideForSelected()
{
selectSequences(1, 2);
* We expect all annotations of that type to be set visible. Other annotations
* should be left unchanged
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSelectType_showForAll()
{
selectSequences(1, 2);
* We expect all annotations of that type, linked to the sequence group, to be
* set visible. Other annotations should be left unchanged
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSelectType_showForSelected()
{
// sequences 1 and 2 have annotations IUPred and Jmol
* We expect all annotations of that type to be set hidden. Other annotations
* should be left unchanged.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeselectType_showForAll()
{
selectSequences(1, 2);
* We expect the annotations of that type, linked to the sequence group, to be
* set hidden. Other annotations should be left unchanged.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeselectType_showForSelected()
{
selectSequences(1, 2);
* Test cases include sequences in the selection group, and others not in the
* group.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testIsInActionScope_selectedScope()
{
// sequences 1 and 2 have annotations 4 and 3 respectively
* Test cases include sequences in the selection group, and others not in the
* group.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testIsInActionScope_unselectedScope()
{
// sequences 1 and 2 have annotations 4 and 3 respectively
/**
* Test that the reset method restores previous visibility flags.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testResetOriginalState()
{
testee = new AnnotationChooser(parentPanel);
* available, plain) fonts and point sizes that would be rejected by Jalview's
* FontChooser as having an I-width of less than 1.0.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void dumpInvalidFonts()
{
String[] fonts = java.awt.GraphicsEnvironment
public class HelpTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void checkHelpTargets() throws HelpSetException
{
ClassLoader cl = Desktop.class.getClassLoader();
volatile boolean finish = false;
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void test()
{
Cache.initLogger();
public class JvSwingUtilsTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetScrollBarProportion()
{
/*
public class PDBSearchPanelTest
{
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
}
{
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void populateCmbSearchTargetOptionsTest()
{
PDBSearchPanel searchPanel = new PDBSearchPanel(null);
searchPanel.populateCmbSearchTargetOptions();
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDecodeSearchTerm()
{
String expectedString = "1xyz OR text:2xyz OR text:3xyz";
assertEquals(expectedString, outcome);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testgetPDBIdwithSpecifiedChain()
{
assertEquals(expectedString, outcome);
}
- @Test(groups =
- { "Network", "External" }, timeOut = 5000)
+ @Test(groups = { "Network", "External" }, timeOut = 5000)
public void txt_search_ActionPerformedTest()
{
PDBSearchPanel searchPanel = new PDBSearchPanel(null);
public class PaintRefresherTest
{
// TODO would prefer PaintRefresher to be a single rather than static
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp()
{
PaintRefresher.components.clear();
PaintRefresher.components.clear();
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRegister()
{
JPanel jp = new JPanel();
assertTrue(registered.get("44").contains(jp4));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRemoveComponent()
{
Map<String, List<Component>> registered = PaintRefresher.components;
-
+
// no error with an empty PaintRefresher
JPanel jp = new JPanel();
JPanel jp2 = new JPanel();
assertTrue(registered.get("22").contains(jp2));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetAssociatedPanels()
{
- SequenceI [] seqs = new SequenceI[]{new Sequence("", "ABC")};
+ SequenceI[] seqs = new SequenceI[] { new Sequence("", "ABC") };
Alignment al = new Alignment(seqs);
/*
.getSequenceSetId());
assertEquals(1, panels.length);
assertSame(ap1, panels[0]);
-
+
panels = PaintRefresher.getAssociatedPanels(av.getSequenceSetId() + 1);
assertEquals(0, panels.length);
}
PopupMenu testee = null;
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws IOException
{
alignment = new FormatAdapter().readFile(TEST_DATA,
int i = 0;
for (SequenceI seq : alignment.getSequences())
{
- final AlignmentAnnotation annotation = new AlignmentAnnotation("label" + i,
- "desc" + i, i);
+ final AlignmentAnnotation annotation = new AlignmentAnnotation(
+ "label" + i, "desc" + i, i);
annotation.setCalcId("calcId" + i);
seq.addAlignmentAnnotation(annotation);
annotation.setSequenceRef(seq);
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConfigureReferenceAnnotationsMenu_noSequenceSelected()
{
JMenuItem menu = new JMenuItem();
* are no reference annotations to add to the alignment. The menu item should
* be disabled.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConfigureReferenceAnnotationsMenu_noReferenceAnnotations()
{
JMenuItem menu = new JMenuItem();
* reference annotations are already on the alignment. The menu item should be
* disabled.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConfigureReferenceAnnotationsMenu_alreadyAdded()
{
JMenuItem menu = new JMenuItem();
* The menu item should be enabled, and acquire a tooltip which lists the
* annotation sources (calcIds) and type (labels).
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConfigureReferenceAnnotationsMenu()
{
JMenuItem menu = new JMenuItem();
* on the alignment. The menu item should be enabled, and acquire a tooltip
* which lists the annotation sources (calcIds) and type (labels).
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConfigureReferenceAnnotationsMenu_notOnAlignment()
{
JMenuItem menu = new JMenuItem();
* The menu item should be enabled, and acquire a tooltip which lists the
* annotation sources (calcIds) and type (labels).
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConfigureReferenceAnnotationsMenu_twoViews()
{
}
* Test for building menu options including 'show' and 'hide' annotation
* types.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildAnnotationTypesMenus()
{
JMenu showMenu = new JMenu();
// PDB.secondary structure on Sequence0
AlignmentAnnotation annotation = new AlignmentAnnotation(
- "secondary structure", "", new Annotation[]
- {});
+ "secondary structure", "", new Annotation[] {});
annotation.setCalcId("PDB");
annotation.visible = true;
seqs.get(0).addAlignmentAnnotation(annotation);
parentPanel.getAlignment().addAnnotation(annotation);
// JMOL.secondary structure on Sequence0 - hidden
- annotation = new AlignmentAnnotation("secondary structure", "", new Annotation[]
- {});
+ annotation = new AlignmentAnnotation("secondary structure", "",
+ new Annotation[] {});
annotation.setCalcId("JMOL");
annotation.visible = false;
seqs.get(0).addAlignmentAnnotation(annotation);
parentPanel.getAlignment().addAnnotation(annotation);
// Jpred.SSP on Sequence0 - hidden
- annotation = new AlignmentAnnotation("SSP", "", new Annotation[]
- {});
+ annotation = new AlignmentAnnotation("SSP", "", new Annotation[] {});
annotation.setCalcId("JPred");
annotation.visible = false;
seqs.get(0).addAlignmentAnnotation(annotation);
parentPanel.getAlignment().addAnnotation(annotation);
// PDB.Temp on Sequence1
- annotation = new AlignmentAnnotation("Temp", "", new Annotation[]
- {});
+ annotation = new AlignmentAnnotation("Temp", "", new Annotation[] {});
annotation.setCalcId("PDB");
annotation.visible = true;
seqs.get(1).addAlignmentAnnotation(annotation);
assertEquals(4, showOptions.length); // includes 'All' and separator
assertEquals(4, hideOptions.length);
- assertEquals("All",
- ((JMenuItem) showOptions[0]).getText());
+ assertEquals("All", ((JMenuItem) showOptions[0]).getText());
assertTrue(showOptions[1] instanceof JPopupMenu.Separator);
assertEquals(JSeparator.HORIZONTAL,
((JSeparator) showOptions[1]).getOrientation());
assertEquals("SSP", ((JMenuItem) showOptions[3]).getText());
assertEquals("JPred", ((JMenuItem) showOptions[3]).getToolTipText());
- assertEquals("All",
- ((JMenuItem) hideOptions[0]).getText());
+ assertEquals("All", ((JMenuItem) hideOptions[0]).getText());
assertTrue(hideOptions[1] instanceof JPopupMenu.Separator);
assertEquals(JSeparator.HORIZONTAL,
((JSeparator) hideOptions[1]).getOrientation());
/**
* Test for building menu options with only 'hide' annotation types enabled.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildAnnotationTypesMenus_showDisabled()
{
JMenu showMenu = new JMenu();
// PDB.secondary structure on Sequence0
AlignmentAnnotation annotation = new AlignmentAnnotation(
- "secondary structure", "", new Annotation[]
- {});
+ "secondary structure", "", new Annotation[] {});
annotation.setCalcId("PDB");
annotation.visible = true;
seqs.get(0).addAlignmentAnnotation(annotation);
parentPanel.getAlignment().addAnnotation(annotation);
// PDB.Temp on Sequence1
- annotation = new AlignmentAnnotation("Temp", "", new Annotation[]
- {});
+ annotation = new AlignmentAnnotation("Temp", "", new Annotation[] {});
annotation.setCalcId("PDB");
annotation.visible = true;
seqs.get(1).addAlignmentAnnotation(annotation);
/**
* Test for building menu options with only 'show' annotation types enabled.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildAnnotationTypesMenus_hideDisabled()
{
JMenu showMenu = new JMenu();
// PDB.secondary structure on Sequence0
AlignmentAnnotation annotation = new AlignmentAnnotation(
- "secondary structure", "", new Annotation[]
- {});
+ "secondary structure", "", new Annotation[] {});
annotation.setCalcId("PDB");
annotation.visible = false;
seqs.get(0).addAlignmentAnnotation(annotation);
parentPanel.getAlignment().addAnnotation(annotation);
// PDB.Temp on Sequence1
- annotation = new AlignmentAnnotation("Temp", "", new Annotation[]
- {});
+ annotation = new AlignmentAnnotation("Temp", "", new Annotation[] {});
annotation.setCalcId("PDB2");
annotation.visible = false;
seqs.get(1).addAlignmentAnnotation(annotation);
private JLabel statusBar;
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConstructor_prematureInstantiation()
{
try
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConstructor_wrongLayout()
{
statusPanel = new JPanel();
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSetProgressBar()
{
statusPanel = new JPanel();
* Add 'hello'
*/
pb.setProgressBar("hello", 1L);
- verifyProgress(layout, new String[]
- { "hello" });
+ verifyProgress(layout, new String[] { "hello" });
/*
* Add 'world'
*/
pb.setProgressBar("world", 2L);
- verifyProgress(layout, new String[]
- { "hello", "world" });
+ verifyProgress(layout, new String[] { "hello", "world" });
/*
* Remove 'hello' with no status bar update
*/
pb.setProgressBar(null, 1L);
- verifyProgress(layout, new String[]
- { "world" });
+ verifyProgress(layout, new String[] { "world" });
assertEquals("nothing", statusBar.getText());
/*
* Remove 'world' with status bar update
*/
pb.setProgressBar("goodbye", 2L);
- verifyProgress(layout, new String[]
- {});
+ verifyProgress(layout, new String[] {});
assertEquals("goodbye", statusBar.getText());
}
public class SequenceRendererTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetResidueBoxColour_zappo()
{
SequenceI seq = new Sequence("name", "MATVLGSPRAPAFF"); // FER1_MAIZE...
- AlignmentI al = new Alignment(new SequenceI[]
- { seq });
+ AlignmentI al = new Alignment(new SequenceI[] { seq });
final AlignViewport av = new AlignViewport(al);
SequenceRenderer sr = new SequenceRenderer(av);
av.setGlobalColourScheme(new ZappoColourScheme());
{
Sequence seq;
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
seq = new Sequence("PDB|4kqy|4KQY|A", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1,
seq = null;
}
-
-
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void buildQueryTest()
{
String query = StructureChooser.buildQuery(seq);
query);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void populateFilterComboBoxTest()
{
- SequenceI[] selectedSeqs = new SequenceI[]
- { seq };
- StructureChooser sc = new StructureChooser(selectedSeqs, seq,
- null);
+ SequenceI[] selectedSeqs = new SequenceI[] { seq };
+ StructureChooser sc = new StructureChooser(selectedSeqs, seq, null);
sc.populateFilterComboBox();
int optionsSize = sc.getCmbFilterOption().getItemCount();
assertEquals(3, optionsSize); // if structures are not discovered then don't
// should be populated
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void fetchStructuresInfoTest()
{
- SequenceI[] selectedSeqs = new SequenceI[]
- { seq };
+ SequenceI[] selectedSeqs = new SequenceI[] { seq };
StructureChooser sc = new StructureChooser(selectedSeqs, seq, null);
sc.fetchStructuresMetaData();
assertTrue(sc.getDiscoveredStructuresSet() != null);
*
* @throws Exception
*/
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setup() throws Exception
{
Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
.get(0).getId();
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void checkNoDuplicates()
{
// not strictly a requirement, but strange things may happen if multiple
{
for (int q = p + 1; q < avec.length; q++)
{
- Assert.assertNotEquals(
- "Found a duplicate annotation row " + avec[p].label,
- avec[p], avec[q]);
+ Assert.assertNotEquals("Found a duplicate annotation row "
+ + avec[p].label, avec[p], avec[q]);
}
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void checkPDBannotationSource()
{
/**
* Check sequence features have been added
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void checkPDBSequenceFeatures()
{
/*
assertEquals("TYR: 314 1gaqC", sf[295].getDescription());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void checkAnnotationWiring()
{
assertTrue(al.getAlignmentAnnotation() != null);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testJalviewProjectRelocationAnnotation() throws Exception
{
sq = sq.getDatasetSequence();
}
assertNotNull(sq.getAllPDBEntries());
- assertEquals("Expected only one PDB ID", sq.getAllPDBEntries().size(), 1);
+ assertEquals("Expected only one PDB ID",
+ sq.getAllPDBEntries().size(), 1);
for (PDBEntry pdbentry : sq.getAllPDBEntries())
{
System.err.println("PDB Entry " + pdbentry.getId() + " "
&& MCview.PDBfile.isCalcIdHandled(ana.getCalcId()))
{
exists = true;
- if (MCview.PDBfile.isCalcIdForFile(ana,
- pdbentry.getId()))
+ if (MCview.PDBfile.isCalcIdForFile(ana, pdbentry.getId()))
{
found = true;
}
public class AnnotationFileIOTest
{
- static String TestFiles[][] =
- {
+ static String TestFiles[][] = {
{ "Test example annotation import/export", "examples/uniref50.fa",
"examples/testdata/example_annot_file.jva" },
{ "Test multiple combine annotation statements import/export",
{ "Test hiding/showing of insertions on sequence_ref",
"examples/uniref50.fa", "examples/testdata/uniref50_seqref.jva" } };
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void exampleAnnotationFileIO() throws Exception
{
for (String[] testPair : TestFiles)
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
-
public class BioJsHTMLOutputTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void getJalviewAlignmentAsJsonString()
{
String bjsTemplate = null;
Assert.assertNotNull(bjsTemplate);
}
- @Test(groups =
- { "Functional" }, expectedExceptions = NullPointerException.class)
+ @Test(
+ groups = { "Functional" },
+ expectedExceptions = NullPointerException.class)
public void expectedNullPointerException()
{
try
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void getBioJsMSAVersions()
{
TreeMap<String, File> versions = null;
e.printStackTrace();
}
AssertJUnit.assertNotNull("No versions found", versions);
- AssertJUnit.assertTrue("One or more Templates required", versions.size() > 0);
+ AssertJUnit.assertTrue("One or more Templates required",
+ versions.size() > 0);
System.out
- .println("Number of discovered versions : "
- + versions.size());
+ .println("Number of discovered versions : " + versions.size());
for (String v : versions.keySet())
{
System.out.println("version : " + v);
}
- @Test(groups =
- { "Network" })
+ @Test(groups = { "Network" })
public void testBioJsUpdate()
{
String url = BioJsHTMLOutput.BJS_TEMPLATE_GIT_REPO;
- AssertJUnit.assertTrue("URL not reacable : " + url, urlIsReachable(url));
+ AssertJUnit
+ .assertTrue("URL not reacable : " + url, urlIsReachable(url));
String response = BioJsHTMLOutput.getURLContentAsString(url);
AssertJUnit.assertNotNull("Null response read from url!", response);
BioJSRepositoryPojo repository = new BioJSRepositoryPojo(response);
System.out.println(">>> description : " + repository.getDescription());
- System.out
-.println(">>> latest version : "
+ System.out.println(">>> latest version : "
+ repository.getLatestReleaseVersion());
System.out.println(">>> repo count : "
+ repository.getReleases().size());
private void assertValidFormat(String fmt, String src, FileParse fp)
{
- AssertJUnit.assertTrue("Couldn't resolve " + src + " as a valid file", fp.isValid());
+ AssertJUnit.assertTrue("Couldn't resolve " + src + " as a valid file",
+ fp.isValid());
String type = new IdentifyFile().Identify(fp);
AssertJUnit.assertTrue("Data from '" + src + "' Expected to be '" + fmt
+ "' identified as '" + type + "'", type.equalsIgnoreCase(fmt));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testStarsInFasta1() throws IOException
{
String uri;
assertValidFormat("FASTA", uri, fp);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testStarsInFasta2() throws IOException
{
String uri;
assertValidFormat("FASTA", uri, fp);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGzipIo() throws IOException
{
String uri;
assertValidFormat("FASTA", uri, fp);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGziplocalFileIO() throws IOException
{
String filepath;
assertValidFormat("FASTA", filepath, fp);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testNonGzipURLIO() throws IOException
{
String uri;
assertValidFormat("FASTA", uri, fp);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testNonGziplocalFileIO() throws IOException
{
String filepath;
exonerateOutput = "examples/testdata/exonerateoutput.gff",
simpleGff3file = "examples/testdata/simpleGff3.gff";
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testExonerateImport()
{
// exonerate does not tag sequences after features, so we have a more
AlignFrame af = loader.LoadFileWaitTillLoaded(exonerateSeqs,
FormatAdapter.FILE);
- assertEquals("Unexpected number of DNA protein associations", 0,
- af.getViewport().getAlignment().getCodonFrames().size());
+ assertEquals("Unexpected number of DNA protein associations", 0, af
+ .getViewport().getAlignment().getCodonFrames().size());
af.loadJalviewDataFile(exonerateOutput, FormatAdapter.FILE, null, null);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void simpleGff3FileIdentify()
{
- assertEquals("Didn't recognise file correctly.",
- IdentifyFile.GFF3File,
+ assertEquals("Didn't recognise file correctly.", IdentifyFile.GFF3File,
new IdentifyFile().Identify(simpleGff3file, FormatAdapter.FILE));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void simpleGff3FileClass() throws IOException
{
- AlignmentI dataset = new Alignment(new SequenceI[]
- {});
+ AlignmentI dataset = new Alignment(new SequenceI[] {});
FeaturesFile ffile = new FeaturesFile(simpleGff3file,
FormatAdapter.FILE);
checkDatasetfromSimpleGff3(dataset);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void simpleGff3FileLoader() throws IOException
{
AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
checkDatasetfromSimpleGff3(af.getViewport().getAlignment().getDataset());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void simpleGff3RelaxedIdMatching() throws IOException
{
- AlignmentI dataset = new Alignment(new SequenceI[]
- {});
+ AlignmentI dataset = new Alignment(new SequenceI[] {});
FeaturesFile ffile = new FeaturesFile(simpleGff3file,
FormatAdapter.FILE);
checkDatasetfromSimpleGff3(dataset);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void readGff3File() throws IOException
{
Gff3File gff3reader = new Gff3File(simpleGff3file, FormatAdapter.FILE);
placeholderseq.equals(seq1.getSequenceAsString()));
assertFalse("dummy replacement buggy for seq2",
placeholderseq.equals(seq2.getSequenceAsString()));
- assertNotNull("No features added to seq1",
- seq1.getSequenceFeatures());// != null);
+ assertNotNull("No features added to seq1", seq1.getSequenceFeatures());// !=
+ // null);
assertEquals("Wrong number of features", 3,
seq1.getSequenceFeatures().length);
assertNull(seq2.getSequenceFeatures());
assertEquals(
"Wrong number of features",
0,
- seq2
- .getSequenceFeatures() == null ? 0
- : seq2.getSequenceFeatures().length);
+ seq2.getSequenceFeatures() == null ? 0 : seq2
+ .getSequenceFeatures().length);
assertTrue(
"Expected at least one CDNA/Protein mapping for seq1",
dataset.getCodonFrame(seq1) != null
public class HtmlFileTest
{
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void test()
{
fail("Not yet implemented");
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-public class IdentifyFileTest {
+public class IdentifyFileTest
+{
- @Test(groups =
- { "Functional" }, dataProvider = "identifyFiles")
+ @Test(groups = { "Functional" }, dataProvider = "identifyFiles")
public void Identify(String data, String expectedFileType)
{
String protocol = AppletFormatAdapter.FILE;
@DataProvider(name = "identifyFiles")
public Object[][] IdentifyFileDP()
{
- return new Object[][]
- {
+ return new Object[][] {
{ "examples/example.json", "JSON" },
{ "examples/plantfdx.fa", "FASTA" },
{ "examples/dna_interleaved.phy", "PHYLIP" },
package jalview.io;
-
import static org.testng.AssertJUnit.assertNotNull;
import jalview.api.AlignExportSettingI;
seqs[3].addSequenceFeature(seqFeature3);
seqs[4].addSequenceFeature(seqFeature4);
-
for (Sequence seq : seqs)
{
seq.setDatasetSequence(seq);
af.changeColour(jf.getColourScheme());
af.getViewport().setFeaturesDisplayed(jf.getDisplayedFeatures());
-
formatAdapter = new AppletFormatAdapter(af.alignPanel, exportSettings);
String jsonOutput = formatAdapter.formatSequences(JSONFile.FILE_DESC,
af.alignPanel.getAlignment(), false);
}
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void methodSetup()
{
passedCount = 0;
jf = null;
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void roundTripTest()
{
assertNotNull("JSON roundtrip test failed!", testJsonFile);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSeqParsed()
{
assertNotNull("Couldn't read supplied alignment data.", testAlignment);
AssertJUnit.assertEquals("Some Sequences did not pass the test",
TEST_SEQ_HEIGHT, passedCount);
}
-
- @Test(groups ={ "Functional" })
+
+ @Test(groups = { "Functional" })
public void hiddenColsTest()
{
ColumnSelection cs = testJsonFile.getColumnSelection();
"Mismatched hidden columns!");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void hiddenSeqsTest()
{
Assert.assertNotNull(testJsonFile.getHiddenSequences(),
"Hidden sequence Expected but found Null");
- Assert.assertEquals(jf.getHiddenSequences().length, 1,
- "Hidden sequece");
+ Assert.assertEquals(jf.getHiddenSequences().length, 1, "Hidden sequece");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void colorSchemeTest()
{
Assert.assertNotNull(testJsonFile.getColourScheme(),
"Zappo colour scheme expected!");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void isShowSeqFeaturesSet()
{
Assert.assertTrue(testJsonFile.isShowSeqFeatures(),
"Sequence feature isDisplayed setting expected to be true");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGrpParsed()
{
Assert.assertNotNull(testAlignment.getGroups());
TEST_GRP_HEIGHT, passedCount);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAnnotationParsed()
{
Assert.assertNotNull(testAlignment.getAlignmentAnnotation());
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
- jalview.bin.Jalview.main(new String[]
- { "-props", "test/jalview/io/testProps.jvprops" });
+ jalview.bin.Jalview.main(new String[] { "-props",
+ "test/jalview/io/testProps.jvprops" });
}
/**
return numdsann;
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRNAStructureRecovery() throws Exception
{
String inFile = "examples/RF00031_folded.stk";
af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testTCoffeeScores() throws Exception
{
String inFile = "examples/uniref50.fa", inAnnot = "examples/uniref50.score_ascii";
.println("T-Coffee score shading successfully recovered from project.");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testColourByAnnotScores() throws Exception
{
String inFile = "examples/uniref50.fa", inAnnot = "examples/testdata/uniref50_iupred.jva";
.println("Per sequence (Group) colourscheme successfully applied and recovered.");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void gatherViewsHere() throws Exception
{
int origCount = Desktop.getAlignFrames() == null ? 0 : Desktop
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void viewRefPdbAnnotation() throws Exception
{
Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
assertTrue("Couldn't find the structure view", sps != null);
SequenceI sq = sps.getAlignment().findName("1A70|");
AlignmentAnnotation refan = null;
- for (AlignmentAnnotation ra:sps.getAlignment().getAlignmentAnnotation())
+ for (AlignmentAnnotation ra : sps.getAlignment()
+ .getAlignmentAnnotation())
{
if (ra.graph != 0)
{
break;
}
}
- assertTrue("Annotation secondary structure not found.",refan!=null);
+ assertTrue("Annotation secondary structure not found.", refan != null);
assertTrue("Couldn't find 1a70 null chain", sq != null);
// compare the manually added temperature factor annotation
// to the track automatically transferred from the pdb structure on load
for (int p = 0; p < ala.annotations.length; p++)
{
sq.findPosition(p);
- try {
+ try
+ {
assertTrue(
"Mismatch at alignment position " + p,
- (alaa.annotations[p] == null && refan.annotations[p] == null)
+ (alaa.annotations[p] == null && refan.annotations[p] == null)
|| alaa.annotations[p].value == refan.annotations[p].value);
- }
- catch (NullPointerException q)
+ } catch (NullPointerException q)
{
- Assert.fail("Mismatch of alignment annotations at position " + p
- + " Ref seq ann: " + refan.annotations[p]
+ Assert.fail("Mismatch of alignment annotations at position "
+ + p + " Ref seq ann: " + refan.annotations[p]
+ " alignment " + alaa.annotations[p]);
}
- }
+ }
}
}
-
+
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCopyViewSettings() throws Exception
{
AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
}
/**
- * test store and recovery of expanded views -
- * currently this is disabled since the
- * Desktop.explodeViews method doesn't seem
- * to result in the views being expanded to
- * distinct align frames when executed programmatically.
+ * test store and recovery of expanded views - currently this is disabled
+ * since the Desktop.explodeViews method doesn't seem to result in the views
+ * being expanded to distinct align frames when executed programmatically.
+ *
* @throws Exception
*/
@Test(groups = { "Functional" }, enabled = false)
public void testStoreAndRecoverExpandedviews() throws Exception
{
- AlignFrame af = new jalview.io.FileLoader()
- .LoadFileWaitTillLoaded(
+ AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
"examples/exampleFile_2_7.jar", FormatAdapter.FILE);
assertTrue("Didn't read in the example file correctly.", af != null);
String afid = af.getViewport().getSequenceSetId();
final AlignFrame xaf = af;
af = null;
new Thread(new Runnable()
- {
- @Override
- public void run()
{
+ @Override
+ public void run()
+ {
Desktop.instance.explodeViews(xaf);
- }
+ }
}).start();
Thread.sleep(1000);
}
// Thread.sleep(300);
// }
int oldviews = Desktop.getAlignFrames().length;
- Assert.assertEquals(
- Desktop.getAlignFrames().length,
+ Assert.assertEquals(Desktop.getAlignFrames().length,
Desktop.getAlignmentPanels(afid).length);
File tfile = File.createTempFile("testStoreAndRecoverExpanded", ".jvp");
try
af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
tfile.getAbsolutePath(), FormatAdapter.FILE);
Assert.assertNotNull(af);
- Assert.assertEquals(Desktop.getAlignFrames().length,
+ Assert.assertEquals(
+ Desktop.getAlignFrames().length,
Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length);
- Assert.assertEquals(oldviews,
+ Assert.assertEquals(
+ oldviews,
Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length);
}
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
- jalview.bin.Jalview.main(new String[]
- { "-props", "test/jalview/io/testProps.jvprops" });
+ jalview.bin.Jalview.main(new String[] { "-props",
+ "test/jalview/io/testProps.jvprops" });
}
/**
jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
}
- @Test(groups ={ "Functional" })
+
+ @Test(groups = { "Functional" })
public void testImportExportPeriodGaps() throws Exception
{
jalview.bin.Cache.setProperty("GAP_SYMBOL", ".");
.getAlignment().getSequenceAt(0).getCharAt(5) == '.');
SequenceGroup sg = new SequenceGroup();
- sg.addSequence(af.getViewport().getAlignment().getSequenceAt(0),false);
- sg.addSequence(af.getViewport().getAlignment().getSequenceAt(1),false);
+ sg.addSequence(af.getViewport().getAlignment().getSequenceAt(0), false);
+ sg.addSequence(af.getViewport().getAlignment().getSequenceAt(1), false);
sg.setStartRes(1);
sg.setEndRes(7);
af.getViewport().setSelectionGroup(sg);
public static Collection data()
{
return Arrays
- .asList(new Object[][]
- {
+ .asList(new Object[][] {
- new String[]
- {
+ new String[] {
"Simple uniref50 newick",
"(((FER_BRANA:128.0,FER3_RAPSA:128.0):50.75,FER_CAPAA:178.75):121.94443,(Q93Z60_ARATH:271.45456,((O80429_MAIZE:183.0,FER1_MAIZE:183.0):30.5,((Q7XA98_TRIPR:90.0,FER1_PEA:90.0):83.32143,(((FER2_ARATH:64.0,FER1_ARATH:64.0):94.375,(FER1_SPIOL:124.5,FER1_MESCR:124.5):33.875):6.4166718,((Q93XJ9_SOLTU:33.5,FER1_SOLLC:33.5):49.0,FER_CAPAN:82.5):82.29167):8.529755):40.178574):57.95456):29.239868);" },
- new String[]
- {
+ new String[] {
"Tree with quotes",
"('Syn_PROSU-1_IIh_3d(CA4)|CK_Syn_PROSU-1_1907':1.0638313,'Syn_MINOS11_5.3_3d(CA4)|CK_Syn_MINOS11_750':1.063831);" },
- new String[]
- {
+ new String[] {
"Tree with double escaped comma in node",
"('Syn_PROSU-1_IIh_3d(CA4)|CK_Syn_PROSU-1_1907':1.0638313,'Syn_MINOS11_5.3_3d(CA4)''|CK_Syn_MINOS11_750':1.063831);" } });
};
{
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testTreeIO() throws Exception
{
String stage = "Init", treename = " '" + name + "' :";
System.out.println(treename + "\n" + testTree);
NewickFile nf = new NewickFile(testTree, FormatAdapter.PASTE);
nf.parse();
- AssertJUnit.assertTrue(stage + "Invalid Tree '" + nf.getWarningMessage() + "'",
+ AssertJUnit.assertTrue(
+ stage + "Invalid Tree '" + nf.getWarningMessage() + "'",
nf.isValid());
SequenceNode tree = nf.getTree();
AssertJUnit.assertTrue(stage + "Null Tree", tree != null);
stage = "Creating newick file from testTree " + treename;
String gentree = new NewickFile(tree).print(nf.HasBootstrap(),
nf.HasDistances());
- AssertJUnit.assertTrue(stage + "Empty string generated", gentree != null
- && gentree.trim().length() > 0);
+ AssertJUnit.assertTrue(stage + "Empty string generated",
+ gentree != null && gentree.trim().length() > 0);
stage = "Parsing regenerated testTree " + treename;
NewickFile nf_regen = new NewickFile(gentree, FormatAdapter.PASTE);
nf_regen.parse();
Vector oseqs, nseqs;
oseqs = new NJTree(new SequenceI[0], nf).findLeaves(nf.getTree(),
new Vector());
- AssertJUnit.assertTrue(stage + "No nodes in original tree.", oseqs.size() > 0);
+ AssertJUnit.assertTrue(stage + "No nodes in original tree.",
+ oseqs.size() > 0);
SequenceI[] olsqs = new SequenceI[oseqs.size()];
for (int i = 0, iSize = oseqs.size(); i < iSize; i++)
{
}
nseqs = new NJTree(new SequenceI[0], nf_regen).findLeaves(
nf_regen.getTree(), new Vector());
- AssertJUnit.assertTrue(stage + "No nodes in regerated tree.", nseqs.size() > 0);
+ AssertJUnit.assertTrue(stage + "No nodes in regerated tree.",
+ nseqs.size() > 0);
SequenceI[] nsqs = new SequenceI[nseqs.size()];
for (int i = 0, iSize = nseqs.size(); i < iSize; i++)
{
nsqs[i] = (SequenceI) ((SequenceNode) nseqs.get(i)).element();
}
- AssertJUnit.assertTrue(stage + " Different number of leaves (original "
- + olsqs.length + " and regen " + nsqs.length + ")",
+ AssertJUnit.assertTrue(stage
+ + " Different number of leaves (original " + olsqs.length
+ + " and regen " + nsqs.length + ")",
olsqs.length == nsqs.length);
SequenceIdMatcher omatcher = new SequenceIdMatcher(olsqs), nmatcher = new SequenceIdMatcher(
nsqs);
*
* @throws Exception
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSequentialDataExtraction() throws Exception
{
testDataExtraction(sequentialFile);
*
* @throws Exception
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testInterleavedDataExtraction() throws Exception
{
testDataExtraction(interleavedFile);
*
* @throws Exception
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSequentialIO() throws Exception
{
testIO(sequentialFile);
*
* @throws Exception
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testInterleavedIO() throws Exception
{
testIO(interleavedFile);
{
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRnamlToStockholmIO()
{
StockholmFileTest.testFileIOwithFormat(new File(
static String PfamFile = "examples/PF00111_seed.stk",
RfamFile = "examples/RF00031_folded.stk";
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void pfamFileIO() throws Exception
{
testFileIOwithFormat(new File(PfamFile), "STH", -1, 0);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void pfamFileDataExtraction() throws Exception
{
AppletFormatAdapter af = new AppletFormatAdapter();
numpdb > 0);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void rfamFileIO() throws Exception
{
testFileIOwithFormat(new File(RfamFile), "STH", 2, 1);
if (naliannot > -1)
{
assertEquals("Number of alignment annotations", naliannot,
- numaliannot);
+ numaliannot);
}
assertTrue(
+ (ignoreFeatures ? " ignoring." : ""),
ignoreFeatures
|| (seq_original[i].getSequenceFeatures() == null && seq_new[in]
- .getSequenceFeatures() == null)
+ .getSequenceFeatures() == null)
|| (seq_original[i].getSequenceFeatures() != null && seq_new[in]
.getSequenceFeatures() != null));
// compare sequence features
final static File ALIGN_FILE = new File(
"test/jalview/io/tcoffee.fasta_aln");
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testReadHeader() throws IOException
{
TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(),
AppletFormatAdapter.FILE);
- AssertJUnit.assertTrue(scoreFile.getWarningMessage(), scoreFile.isValid());
+ AssertJUnit.assertTrue(scoreFile.getWarningMessage(),
+ scoreFile.isValid());
Header header = scoreFile.header;
AssertJUnit.assertNotNull(header);
- AssertJUnit.assertEquals(
- "T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)",
- header.head);
+ AssertJUnit
+ .assertEquals(
+ "T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)",
+ header.head);
AssertJUnit.assertEquals(90, header.score);
AssertJUnit.assertEquals(89, header.getScoreFor("1PHT"));
AssertJUnit.assertEquals(90, header.getScoreFor("1BB9"));
AssertJUnit.assertEquals(90, header.getScoreFor("cons"));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testWrongFile()
{
try
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testHeightAndWidth() throws IOException
{
TCoffeeScoreFile result = new TCoffeeScoreFile(SCORE_FILE.getPath(),
AssertJUnit.assertEquals(83, result.getWidth());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testReadBlock() throws IOException
{
Block block = TCoffeeScoreFile.readBlock(source, 0);
AssertJUnit.assertNotNull(block);
- AssertJUnit.assertEquals("999999999999999999999999998762112222543211112134",
+ AssertJUnit.assertEquals(
+ "999999999999999999999999998762112222543211112134",
block.getScoresFor("1PHT"));
- AssertJUnit.assertEquals("99999999999999999999999999987-------4322----2234",
+ AssertJUnit.assertEquals(
+ "99999999999999999999999999987-------4322----2234",
block.getScoresFor("1BB9"));
- AssertJUnit.assertEquals("99999999999999999999999999987-------5321----2246",
+ AssertJUnit.assertEquals(
+ "99999999999999999999999999987-------5321----2246",
block.getScoresFor("1UHC"));
- AssertJUnit.assertEquals("99999999999999999999999999986-------4321----1-35",
+ AssertJUnit.assertEquals(
+ "99999999999999999999999999986-------4321----1-35",
block.getScoresFor("1YCS"));
- AssertJUnit.assertEquals("999999999999999999999999999861-------3------1135",
+ AssertJUnit.assertEquals(
+ "999999999999999999999999999861-------3------1135",
block.getScoresFor("1OOT"));
- AssertJUnit.assertEquals("99999999999999999999999999986-------422-------34",
+ AssertJUnit.assertEquals(
+ "99999999999999999999999999986-------422-------34",
block.getScoresFor("1ABO"));
- AssertJUnit.assertEquals("99999999999999999999999999985-------32--------35",
+ AssertJUnit.assertEquals(
+ "99999999999999999999999999985-------32--------35",
block.getScoresFor("1FYN"));
- AssertJUnit.assertEquals("99999999999999999999999999974-------2---------24",
+ AssertJUnit.assertEquals(
+ "99999999999999999999999999974-------2---------24",
block.getScoresFor("1QCF"));
- AssertJUnit.assertEquals("999999999999999999999999999851000110321100001134",
+ AssertJUnit.assertEquals(
+ "999999999999999999999999999851000110321100001134",
block.getConsensus());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testParse() throws IOException
{
TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),
FormatAdapter.FILE);
- AssertJUnit.assertEquals(
- "999999999999999999999999998762112222543211112134----------5666642367889999999999889",
- parser.getScoresFor("1PHT"));
- AssertJUnit.assertEquals(
- "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889",
- parser.getScoresFor("1BB9"));
- AssertJUnit.assertEquals(
- "99999999999999999999999999987-------5321----2246----------788774--66789999999999889",
- parser.getScoresFor("1UHC"));
- AssertJUnit.assertEquals(
- "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889",
- parser.getScoresFor("1YCS"));
- AssertJUnit.assertEquals(
- "999999999999999999999999999861-------3------1135----------78877--356789999999997-67",
- parser.getScoresFor("1OOT"));
- AssertJUnit.assertEquals(
- "99999999999999999999999999986-------422-------34----------687774--56779999999999889",
- parser.getScoresFor("1ABO"));
- AssertJUnit.assertEquals(
- "99999999999999999999999999985-------32--------35----------6888842356789999999999889",
- parser.getScoresFor("1FYN"));
- AssertJUnit.assertEquals(
- "99999999999999999999999999974-------2---------24----------6878742356789999999999889",
- parser.getScoresFor("1QCF"));
- AssertJUnit.assertEquals(
- "99999999999999999999999999985100011032110000113400100000006877641356789999999999889",
- parser.getScoresFor("cons"));
+ AssertJUnit
+ .assertEquals(
+ "999999999999999999999999998762112222543211112134----------5666642367889999999999889",
+ parser.getScoresFor("1PHT"));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889",
+ parser.getScoresFor("1BB9"));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999987-------5321----2246----------788774--66789999999999889",
+ parser.getScoresFor("1UHC"));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889",
+ parser.getScoresFor("1YCS"));
+ AssertJUnit
+ .assertEquals(
+ "999999999999999999999999999861-------3------1135----------78877--356789999999997-67",
+ parser.getScoresFor("1OOT"));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999986-------422-------34----------687774--56779999999999889",
+ parser.getScoresFor("1ABO"));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999985-------32--------35----------6888842356789999999999889",
+ parser.getScoresFor("1FYN"));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999974-------2---------24----------6878742356789999999999889",
+ parser.getScoresFor("1QCF"));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999985100011032110000113400100000006877641356789999999999889",
+ parser.getScoresFor("cons"));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetAsList() throws IOException
{
FormatAdapter.FILE);
AssertJUnit.assertTrue(parser.getWarningMessage(), parser.isValid());
List<String> scores = parser.getScoresList();
- AssertJUnit.assertEquals(
- "999999999999999999999999998762112222543211112134----------5666642367889999999999889",
- scores.get(0));
- AssertJUnit.assertEquals(
- "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889",
- scores.get(1));
- AssertJUnit.assertEquals(
- "99999999999999999999999999987-------5321----2246----------788774--66789999999999889",
- scores.get(2));
- AssertJUnit.assertEquals(
- "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889",
- scores.get(3));
- AssertJUnit.assertEquals(
- "999999999999999999999999999861-------3------1135----------78877--356789999999997-67",
- scores.get(4));
- AssertJUnit.assertEquals(
- "99999999999999999999999999986-------422-------34----------687774--56779999999999889",
- scores.get(5));
- AssertJUnit.assertEquals(
- "99999999999999999999999999985-------32--------35----------6888842356789999999999889",
- scores.get(6));
- AssertJUnit.assertEquals(
- "99999999999999999999999999974-------2---------24----------6878742356789999999999889",
- scores.get(7));
- AssertJUnit.assertEquals(
- "99999999999999999999999999985100011032110000113400100000006877641356789999999999889",
- scores.get(8));
+ AssertJUnit
+ .assertEquals(
+ "999999999999999999999999998762112222543211112134----------5666642367889999999999889",
+ scores.get(0));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889",
+ scores.get(1));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999987-------5321----2246----------788774--66789999999999889",
+ scores.get(2));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889",
+ scores.get(3));
+ AssertJUnit
+ .assertEquals(
+ "999999999999999999999999999861-------3------1135----------78877--356789999999997-67",
+ scores.get(4));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999986-------422-------34----------687774--56779999999999889",
+ scores.get(5));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999985-------32--------35----------6888842356789999999999889",
+ scores.get(6));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999974-------2---------24----------6878742356789999999999889",
+ scores.get(7));
+ AssertJUnit
+ .assertEquals(
+ "99999999999999999999999999985100011032110000113400100000006877641356789999999999889",
+ scores.get(8));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetAsArray() throws IOException
{
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testHeightAndWidthWithResidueNumbers() throws Exception
{
String file = "test/jalview/io/tcoffee.score_ascii_with_residue_numbers";
public class DnaCodonTests
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAmbiguityCodeGeneration()
{
assertTrue(ResidueProperties.ambiguityCodes.size() > 0);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testAmbiguityCodon()
{
for (String ac : ResidueProperties.ambiguityCodes.keySet())
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void regenerateCodonTable()
{
for (Map.Entry<String, String> codon : ResidueProperties.codonHash2
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void checkOldCodonagainstNewCodonTable()
{
// note - this test will be removed once the old codon table (including
/**
* Test 'standard' codon translations (no ambiguity codes)
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCodonTranslate()
{
// standard translation table order column 1/2/3/4
* Test a sample of codon translations involving ambiguity codes. Should
* return a protein value where the ambiguity does not affect the translation.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCodonTranslate_ambiguityCodes()
{
// Y is C or T
assertNull(ResidueProperties.codonTranslate("WSK"));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetResidues_nucleotide()
{
/*
assertEquals("[A, C, G, I, N, R, T, U, X, Y]", residues.toString());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetResidues_peptide()
{
/*
public class ScoreMatrixPrinter
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void printAllMatrices()
{
for (Map.Entry<String, ScoreModelI> sm : ResidueProperties.scoreMatrices
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void printHTMLMatrices()
{
for (Map.Entry<String, ScoreModelI> _sm : ResidueProperties.scoreMatrices
* 115 in PDB Res Numbering secondary structure numbers in jmol seem to be in
* msd numbering, not pdb res numbering.
*/
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void pdbEntryPositionMap() throws Exception
{
Assert.fail("This test intentionally left to fail");
// original numbers taken from
// http://www.ebi.ac.uk/pdbe-srv/view/entry/1qcf/secondary.html
// these are in numbering relative to the subsequence above
- int coils[] =
- { 266, 275, 278, 287, 289, 298, 302, 316 }, helices[] = new int[]
- { 303, 315 }, sheets[] = new int[]
- { 267, 268, 269, 270 };
+ int coils[] = { 266, 275, 278, 287, 289, 298, 302, 316 }, helices[] = new int[]
+ { 303, 315 }, sheets[] = new int[] { 267, 268, 269, 270 };
StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
- PDBfile pmap = ssm.setMapping(true, new SequenceI[]
- { uprot }, new String[]
- { "A" }, "test/jalview/ext/jmol/1QCF.pdb",
+ PDBfile pmap = ssm.setMapping(true, new SequenceI[] { uprot },
+ new String[] { "A" }, "test/jalview/ext/jmol/1QCF.pdb",
jalview.io.FormatAdapter.FILE);
assertTrue(pmap != null);
SequenceI protseq = pmap.getSeqsAsArray()[0];
}
}
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void testPDBentryMapping() throws Exception
{
Assert.fail("This test intentionally left to fail");
StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
// Associate the 1GAQ pdb file with the subsequence 'imported' from another
// source
- PDBfile pde = ssm.setMapping(true, new SequenceI[]
- { sq }, new String[]
+ PDBfile pde = ssm.setMapping(true, new SequenceI[] { sq }, new String[]
{ "A" }, inFile = "examples/1gaq.txt", jalview.io.FormatAdapter.FILE);
assertTrue("PDB File couldn't be found", pde != null);
StructureMapping[] mp = ssm.getMapping(inFile);
Annotation a = transfer.annotations[tanpos], b = alan.annotations[p];
assertEquals("Non-equivalent annotation element at " + p + "("
+ rseqpos + ")" + " expected at " + fpos + " (alIndex "
- + tanpos + ")",
- a == null ? a : a.toString(),
+ + tanpos + ")", a == null ? a : a.toString(),
b == null ? b : b.toString());
System.out.print("(" + a + "|" + b + ")");
}
* transform
*
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void mapFer1From3W5V() throws Exception
{
AlignFrame seqf = new FileLoader(false)
FormatAdapter.PASTE, "FASTA");
SequenceI newseq = seqf.getViewport().getAlignment().getSequenceAt(0);
StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
- PDBfile pmap = ssm.setMapping(true, new SequenceI[]
- { newseq }, new String[]
- { null }, "examples/3W5V.pdb",
+ PDBfile pmap = ssm.setMapping(true, new SequenceI[] { newseq },
+ new String[] { null }, "examples/3W5V.pdb",
jalview.io.FormatAdapter.FILE);
if (pmap == null)
{
* compare reference annotation for imported pdb sequence to identical
* seuqence with transferred annotation from mapped pdb file
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void compareTransferredToRefPDBAnnot() throws Exception
{
AlignFrame ref = new FileLoader(false)
StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
ssm.setProcessSecondaryStructure(true);
ssm.setAddTempFacAnnot(true);
- PDBfile pmap = ssm.setMapping(true, new SequenceI[]
- { newseq }, new String[]
- { null }, "test/jalview/ext/jmol/1QCF.pdb",
+ PDBfile pmap = ssm.setMapping(true, new SequenceI[] { newseq },
+ new String[] { null }, "test/jalview/ext/jmol/1QCF.pdb",
jalview.io.FormatAdapter.FILE);
assertTrue(pmap != null);
assertEquals("Original and copied sequence of different lengths.",
{
private StructureSelectionManager ssm;
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp()
{
ssm = new StructureSelectionManager();
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRegisterMapping()
{
AlignedCodonFrame acf1 = new AlignedCodonFrame();
assertTrue(ssm.seqmappings.contains(acf2));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRegisterMappings()
{
AlignedCodonFrame acf1 = new AlignedCodonFrame();
sm.setProcessSecondaryStructure(true);
sm.setAddTempFacAnnot(true);
PDBfile pmap = sm.setMapping(true, new SequenceI[] { seq },
- new String[] { null }, "examples/1gaq.txt",
- FormatAdapter.FILE);
+ new String[] { null }, "examples/1gaq.txt", FormatAdapter.FILE);
assertTrue(pmap != null);
assertEquals(3, pmap.getSeqs().size());
/**
* Set up test conditions with three aligned sequences,
*/
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp()
{
SequenceI seq1 = new Sequence("1YCS", "-VPSQK");
SequenceI seq2 = new Sequence("3A6S", "MK-KLQ");
SequenceI seq3 = new Sequence("1OOT", "SPK-AV");
- al = new Alignment(new SequenceI[]
- { seq1, seq2, seq3 });
+ al = new Alignment(new SequenceI[] { seq1, seq2, seq3 });
al.setDataset(null);
PDBEntry[] pdbFiles = new PDBEntry[3];
pdbFiles[2] = new PDBEntry("1OOT", "A", Type.PDB, "1OOT.pdb");
String[][] chains = new String[3][];
SequenceI[][] seqs = new SequenceI[3][];
- seqs[0] = new SequenceI[]
- { seq1 };
- seqs[1] = new SequenceI[]
- { seq2 };
- seqs[2] = new SequenceI[]
- { seq3 };
+ seqs[0] = new SequenceI[] { seq1 };
+ seqs[1] = new SequenceI[] { seq2 };
+ seqs[2] = new SequenceI[] { seq3 };
StructureSelectionManager ssm = new StructureSelectionManager();
- ssm.setMapping(new SequenceI[]
- { seq1 }, null, PDB_1, AppletFormatAdapter.PASTE);
- ssm.setMapping(new SequenceI[]
- { seq2 }, null, PDB_2, AppletFormatAdapter.PASTE);
- ssm.setMapping(new SequenceI[]
- { seq3 }, null, PDB_3, AppletFormatAdapter.PASTE);
+ ssm.setMapping(new SequenceI[] { seq1 }, null, PDB_1,
+ AppletFormatAdapter.PASTE);
+ ssm.setMapping(new SequenceI[] { seq2 }, null, PDB_2,
+ AppletFormatAdapter.PASTE);
+ ssm.setMapping(new SequenceI[] { seq3 }, null, PDB_3,
+ AppletFormatAdapter.PASTE);
testee = new AAStructureBindingModel(ssm, pdbFiles, seqs, chains, null)
{
* fudge 'filenames' to match those generated when PDBFile parses PASTE
* data
*/
- return new String[]
- { "INLINE1YCS", "INLINE3A6S", "INLINE1OOT" };
+ return new String[] { "INLINE1YCS", "INLINE3A6S", "INLINE1OOT" };
}
+
@Override
public void updateColours(Object source)
{
}
+
@Override
public void releaseReferences(Object svl)
{
}
+
@Override
public void highlightAtoms(List<AtomSpec> atoms)
{
* Verify that the method determines that columns 2, 5 and 6 of the alignment
* are alignable in structure
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindSuperposableResidues()
{
SuperposeData[] structs = new SuperposeData[al.getHeight()];
assertTrue(matched[5]);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindSuperposableResidues_hiddenColumn()
{
SuperposeData[] structs = new SuperposeData[al.getHeight()];
Color darkColour = new Color(11, 30, 50); // dark blue
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDarkerThan()
{
assertEquals("Wrong darker shade", new Color(32, 69, 37),
assertNull(ColorUtils.darkerThan(null));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBrighterThan()
{
assertEquals("Wrong brighter shade", new Color(255, 255, 255), // white
/**
* @see http://www.rtapo.com/notes/named_colors.html
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testToTkCode()
{
assertEquals("#fffafa", ColorUtils.toTkCode(new Color(255, 250, 250))); // snow
public class ComparisonTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testIsGap()
{
assertTrue(Comparison.isGap('-'));
* Test for isNucleotide is that sequences in a dataset are more than 85%
* AGCTU. Test is not case-sensitive and ignores gaps.
*/
- @Test(groups ={ "Functional" })
- public void testIsNucleotide() {
+ @Test(groups = { "Functional" })
+ public void testIsNucleotide()
+ {
SequenceI seq = new Sequence("eightypercent", "agctuAGCPV");
- assertFalse(Comparison.isNucleotide(new SequenceI[]
- { seq }));
- assertFalse(Comparison.isNucleotide(new SequenceI[][]
- { new SequenceI[]
+ assertFalse(Comparison.isNucleotide(new SequenceI[] { seq }));
+ assertFalse(Comparison.isNucleotide(new SequenceI[][] { new SequenceI[]
{ seq } }));
seq = new Sequence("eightyfivepercent", "agctuAGCPVagctuAGCUV");
- assertFalse(Comparison.isNucleotide(new SequenceI[]
- { seq }));
+ assertFalse(Comparison.isNucleotide(new SequenceI[] { seq }));
seq = new Sequence("nineypercent", "agctuAGCgVagctuAGCUV");
- assertTrue(Comparison.isNucleotide(new SequenceI[]
- { seq }));
+ assertTrue(Comparison.isNucleotide(new SequenceI[] { seq }));
seq = new Sequence("eightyfivepercentgapped",
"--agc--tuA--GCPV-a---gct-uA-GC---UV");
- assertFalse(Comparison.isNucleotide(new SequenceI[]
- { seq }));
+ assertFalse(Comparison.isNucleotide(new SequenceI[] { seq }));
seq = new Sequence("nineypercentgapped",
"ag--ct-u-A---GC---g----Vag--c---tuAGCUV");
- assertTrue(Comparison.isNucleotide(new SequenceI[]
- { seq }));
+ assertTrue(Comparison.isNucleotide(new SequenceI[] { seq }));
seq = new Sequence("allgap", "---------");
- assertFalse(Comparison.isNucleotide(new SequenceI[]
- { seq }));
+ assertFalse(Comparison.isNucleotide(new SequenceI[] { seq }));
seq = new Sequence("DNA", "ACTugGCCAG");
SequenceI seq2 = new Sequence("Protein", "FLIMVSPTYW");
/*
* 90% DNA:
*/
- assertTrue(Comparison.isNucleotide(new SequenceI[]
- { seq, seq, seq, seq, seq, seq, seq, seq, seq, seq2 }));
- assertTrue(Comparison.isNucleotide(new SequenceI[][]
- { new SequenceI[]
- { seq }, new SequenceI[]
- { seq, seq, seq }, new SequenceI[]
- { seq, seq, seq, seq, seq, seq2 } }));
+ assertTrue(Comparison.isNucleotide(new SequenceI[] { seq, seq, seq,
+ seq, seq, seq, seq, seq, seq, seq2 }));
+ assertTrue(Comparison.isNucleotide(new SequenceI[][] {
+ new SequenceI[] { seq }, new SequenceI[] { seq, seq, seq },
+ new SequenceI[] { seq, seq, seq, seq, seq, seq2 } }));
/*
* 80% DNA:
*/
- assertFalse(Comparison.isNucleotide(new SequenceI[]
- { seq, seq, seq, seq, seq, seq, seq, seq, seq2, seq2 }));
- assertFalse(Comparison.isNucleotide(new SequenceI[][]
- { new SequenceI[]
- { seq }, new SequenceI[]
- { seq, seq, seq }, new SequenceI[]
- { seq, seq, seq, seq, seq2, seq2, null } }));
+ assertFalse(Comparison.isNucleotide(new SequenceI[] { seq, seq, seq,
+ seq, seq, seq, seq, seq, seq2, seq2 }));
+ assertFalse(Comparison.isNucleotide(new SequenceI[][] { new SequenceI[]
+ { seq }, new SequenceI[] { seq, seq, seq },
+ new SequenceI[] { seq, seq, seq, seq, seq2, seq2, null } }));
seq = new Sequence("ProteinThatLooksLikeDNA", "WYATGCCTGAgtcgt");
// 12/14 = 85.7%
- assertTrue(Comparison.isNucleotide(new SequenceI[]
- { seq }));
+ assertTrue(Comparison.isNucleotide(new SequenceI[] { seq }));
assertFalse(Comparison.isNucleotide((SequenceI[]) null));
assertFalse(Comparison.isNucleotide((SequenceI[][]) null));
/**
* Test percentage identity calculation for two sequences.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testPID_matchGaps()
{
String seq1 = "ABCDEF";
* Test the method that selects DBRefEntry items whose source is in a supplied
* list
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSelectRefs()
{
assertNull(DBRefUtils.selectRefs(null, null));
DBRefEntry ref2 = new DBRefEntry("UNIPROT", "1.2", "A12346");
// Source is converted to upper-case by this constructor!
DBRefEntry ref3 = new DBRefEntry("Uniprot", "1.2", "A12347");
- DBRefEntry[] dbrefs = new DBRefEntry[]
- { ref1, ref2, ref3 };
- String[] sources = new String[]
- { "EMBL", "UNIPROT" };
+ DBRefEntry[] dbrefs = new DBRefEntry[] { ref1, ref2, ref3 };
+ String[] sources = new String[] { "EMBL", "UNIPROT" };
DBRefEntry[] selected = DBRefUtils.selectRefs(dbrefs, sources);
assertEquals(3, selected.length);
assertSame(ref2, selected[1]);
assertSame(ref3, selected[2]);
- sources = new String[]
- { "EMBL" };
+ sources = new String[] { "EMBL" };
selected = DBRefUtils.selectRefs(dbrefs, sources);
assertEquals(1, selected.length);
assertSame(ref1, selected[0]);
- sources = new String[]
- { "UNIPROT" };
+ sources = new String[] { "UNIPROT" };
selected = DBRefUtils.selectRefs(dbrefs, sources);
assertEquals(2, selected.length);
assertSame(ref2, selected[0]);
assertSame(ref3, selected[1]);
- sources = new String[]
- { "Uniprot", "EMBLCDS" };
+ sources = new String[] { "Uniprot", "EMBLCDS" };
selected = DBRefUtils.selectRefs(dbrefs, sources);
assertNull(selected);
}
* Test the method that converts (currently three) database names to a
* canonical name (not case-sensitive)
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetCanonicalName()
{
assertNull(DBRefUtils.getCanonicalName(null));
DBRefUtils.getCanonicalName("UNIPROTKB/SWISS-CHEESE"));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testIsDasCoordinateSystem()
{
assertFalse(DBRefUtils.isDasCoordinateSystem(null, null));
assertTrue(DBRefUtils.isDasCoordinateSystem("Uniprot", new DBRefEntry(
"UNIPROT", "v1", "a1")));
assertFalse(DBRefUtils.isDasCoordinateSystem("UNIPROTKB",
- new DBRefEntry(
- "pdb", "v1", "a1")));
+ new DBRefEntry("pdb", "v1", "a1")));
assertTrue(DBRefUtils.isDasCoordinateSystem("EMBL", new DBRefEntry(
"EMBL", "v1", "a1")));
/**
* Test 'parsing' a DBRef - non PDB case
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testParseToDbRef()
{
SequenceI seq = new Sequence("Seq1", "ABCD");
/**
* Test 'parsing' a DBRef - Stockholm PDB format
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testParseToDbRef_PDB()
{
SequenceI seq = new Sequence("Seq1", "ABCD");
* Test the method that searches for matches references - case when we are
* matching a reference with no mappings
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSearchRefs_noMapping()
{
DBRefEntry target = new DBRefEntry("EMBL", "2", "A1234");
DBRefEntry ref4 = new DBRefEntry("EMBLCDS", "1", "A1234"); // no match
// ref5 matches although it has a mapping - ignored
DBRefEntry ref5 = new DBRefEntry("EMBL", "1", "A1234");
- ref5.setMap(new Mapping(new MapList(new int[]
- { 1, 1 }, new int[]
- { 1, 1 }, 1, 1)));
+ ref5.setMap(new Mapping(new MapList(new int[] { 1, 1 }, new int[] { 1,
+ 1 }, 1, 1)));
- DBRefEntry[] matches = DBRefUtils.searchRefs(new DBRefEntry[]
- { ref1, ref2, ref3, ref4, ref5 }, target);
+ DBRefEntry[] matches = DBRefUtils.searchRefs(new DBRefEntry[] { ref1,
+ ref2, ref3, ref4, ref5 }, target);
assertEquals(3, matches.length);
assertSame(ref1, matches[0]);
assertSame(ref2, matches[1]);
* Test the method that searches for matches references - case when we are
* matching a reference with a mapping
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSearchRefs_withMapping()
{
DBRefEntry target = new DBRefEntry("EMBL", "2", "A1234");
- final Mapping map1 = new Mapping(new MapList(new int[]
- { 1, 1 }, new int[]
- { 1, 1 }, 1, 1));
+ final Mapping map1 = new Mapping(new MapList(new int[] { 1, 1 },
+ new int[] { 1, 1 }, 1, 1));
target.setMap(map1);
// these all match target iff mappings match
DBRefEntry ref1 = new DBRefEntry("EMBL", "1", "A1234"); // no map: matches
DBRefEntry ref2 = new DBRefEntry("EMBL", "1", "A1234"); // =map: matches
- final Mapping map2 = new Mapping(new MapList(new int[]
- { 1, 1 }, new int[]
- { 1, 1 }, 1, 1));
+ final Mapping map2 = new Mapping(new MapList(new int[] { 1, 1 },
+ new int[] { 1, 1 }, 1, 1));
ref2.setMap(map2);
// different map: no match
DBRefEntry ref3 = new DBRefEntry("EMBL", "1", "A1234");
- final Mapping map3 = new Mapping(new MapList(new int[]
- { 1, 1 }, new int[]
- { 1, 1 }, 2, 2));
+ final Mapping map3 = new Mapping(new MapList(new int[] { 1, 1 },
+ new int[] { 1, 1 }, 2, 2));
ref3.setMap(map3);
- DBRefEntry[] matches = DBRefUtils.searchRefs(new DBRefEntry[]
- { ref1, ref2, ref3 }, target);
+ DBRefEntry[] matches = DBRefUtils.searchRefs(new DBRefEntry[] { ref1,
+ ref2, ref3 }, target);
assertEquals(2, matches.length);
assertSame(ref1, matches[0]);
assertSame(ref2, matches[1]);
public class MapListTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSomething()
{
- MapList ml = new MapList(new int[]
- { 1, 5, 10, 15, 25, 20 }, new int[]
- { 51, 1 }, 1, 3);
- MapList ml1 = new MapList(new int[]
- { 1, 3, 17, 4 }, new int[]
- { 51, 1 }, 1, 3);
- MapList ml2 = new MapList(new int[]
- { 1, 60 }, new int[]
- { 1, 20 }, 3, 1);
+ MapList ml = new MapList(new int[] { 1, 5, 10, 15, 25, 20 }, new int[] {
+ 51, 1 }, 1, 3);
+ MapList ml1 = new MapList(new int[] { 1, 3, 17, 4 },
+ new int[] { 51, 1 }, 1, 3);
+ MapList ml2 = new MapList(new int[] { 1, 60 }, new int[] { 1, 20 }, 3,
+ 1);
// test internal consistency
int to[] = new int[51];
testMap(ml, 1, 60);
- MapList mldna = new MapList(new int[]
- { 2, 2, 6, 8, 12, 16 }, new int[]
+ MapList mldna = new MapList(new int[] { 2, 2, 6, 8, 12, 16 }, new int[]
{ 1, 3 }, 3, 1);
int[] frm = mldna.locateInFrom(1, 1);
- testLocateFrom(mldna, 1, 1, new int[]
- { 2, 2, 6, 7 });
+ testLocateFrom(mldna, 1, 1, new int[] { 2, 2, 6, 7 });
testMap(mldna, 1, 3);
/*
* for (int from=1; from<=51; from++) { int[] too=ml.shiftTo(from); int[]
if (mmap[1][i - 1] == -1)
{
System.out.print(i + "=XXX");
-
+
}
else
{
if (mmap[1][i - 1] == -1)
{
System.out.print(i + "=XXX");
-
+
}
else
{
* Tests for method that locates ranges in the 'from' map for given range in
* the 'to' map.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testLocateInFrom_noIntrons()
{
/*
* Simple mapping with no introns
*/
- int[] codons = new int[]
- { 1, 12 };
- int[] protein = new int[]
- { 1, 4 };
+ int[] codons = new int[] { 1, 12 };
+ int[] protein = new int[] { 1, 4 };
MapList ml = new MapList(codons, protein, 3, 1);
assertEquals("[1, 3]", Arrays.toString(ml.locateInFrom(1, 1)));
assertEquals("[4, 6]", Arrays.toString(ml.locateInFrom(2, 2)));
* Tests for method that locates ranges in the 'from' map for given range in
* the 'to' map.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testLocateInFrom_withIntrons()
{
/*
* Exons at positions [2, 3, 5] [6, 7, 9] [10, 12, 14] [16, 17, 18] i.e.
* 2-3, 5-7, 9-10, 12-12, 14-14, 16-18
*/
- int[] codons =
- { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
- int[] protein =
- { 1, 4 };
+ int[] codons = { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
+ int[] protein = { 1, 4 };
MapList ml = new MapList(codons, protein, 3, 1);
assertEquals("[2, 3, 5, 5]", Arrays.toString(ml.locateInFrom(1, 1)));
assertEquals("[6, 7, 9, 9]", Arrays.toString(ml.locateInFrom(2, 2)));
* Tests for method that locates ranges in the 'to' map for given range in the
* 'from' map.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testLocateInTo_noIntrons()
{
/*
* Simple mapping with no introns
*/
- int[] codons = new int[]
- { 1, 12 };
- int[] protein = new int[]
- { 1, 4 };
+ int[] codons = new int[] { 1, 12 };
+ int[] protein = new int[] { 1, 4 };
MapList ml = new MapList(codons, protein, 3, 1);
assertEquals("[1, 1]", Arrays.toString(ml.locateInTo(1, 3)));
assertEquals("[2, 2]", Arrays.toString(ml.locateInTo(4, 6)));
* Tests for method that locates ranges in the 'to' map for given range in the
* 'from' map.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testLocateInTo_withIntrons()
{
/*
* Exons at positions [2, 3, 5] [6, 7, 9] [10, 12, 14] [16, 17, 18] i.e.
* 2-3, 5-7, 9-10, 12-12, 14-14, 16-18
*/
- int[] codons =
- { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
+ int[] codons = { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
/*
* Mapped proteins at positions 1, 3, 4, 6 in the sequence
*/
- int[] protein =
- { 1, 1, 3, 4, 6, 6 };
+ int[] protein = { 1, 1, 3, 4, 6, 6 };
MapList ml = new MapList(codons, protein, 3, 1);
/*
/**
* Test equals method.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testEquals()
{
- int[] codons = new int[]
- { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
- int[] protein = new int[]
- { 1, 4 };
+ int[] codons = new int[] { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
+ int[] protein = new int[] { 1, 4 };
MapList ml = new MapList(codons, protein, 3, 1);
MapList ml1 = new MapList(codons, protein, 3, 1); // same values
MapList ml2 = new MapList(codons, protein, 2, 1); // fromRatio differs
/**
* Test for the method that flattens a list of ranges into a single array.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetRanges()
{
List<int[]> ranges = new ArrayList<int[]>();
- ranges.add(new int[]
- { 2, 3 });
- ranges.add(new int[]
- { 5, 6 });
+ ranges.add(new int[] { 2, 3 });
+ ranges.add(new int[] { 5, 6 });
assertEquals("[2, 3, 5, 6]", Arrays.toString(MapList.getRanges(ranges)));
}
/**
* Check state after construction
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConstructor()
{
- int[] codons =
- { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
- int[] protein =
- { 1, 1, 3, 4, 6, 6 };
+ int[] codons = { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
+ int[] protein = { 1, 1, 3, 4, 6, 6 };
MapList ml = new MapList(codons, protein, 3, 1);
assertEquals(3, ml.getFromRatio());
assertEquals(2, ml.getFromLowest());
/**
* Test the method that creates an inverse mapping
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetInverse()
{
- int[] codons =
- { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
- int[] protein =
- { 1, 1, 3, 4, 6, 6 };
+ int[] codons = { 2, 3, 5, 7, 9, 10, 12, 12, 14, 14, 16, 18 };
+ int[] protein = { 1, 1, 3, 4, 6, 6 };
MapList ml = new MapList(codons, protein, 3, 1);
MapList ml2 = ml.getInverse();
prettyPrint(ml2.getFromRanges()));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testToString()
{
- MapList ml = new MapList(new int[]
- { 1, 5, 10, 15, 25, 20 }, new int[]
- { 51, 1 }, 1, 3);
+ MapList ml = new MapList(new int[] { 1, 5, 10, 15, 25, 20 }, new int[] {
+ 51, 1 }, 1, 3);
String s = ml.toString();
assertEquals("From (1:3) [ [1, 5] [10, 15] [25, 20] ] To [ [51, 1] ]",
s);
package jalview.util;
-
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
public class MappingUtilsTest
{
private AlignViewportI dnaView;
+
private AlignViewportI proteinView;
/**
* Simple test of mapping with no intron involved.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildSearchResults()
{
final Sequence seq1 = new Sequence("Seq1", "C-G-TA-GC");
* Map dna bases 1-6 to protein residues 1-2
*/
AlignedCodonFrame acf = new AlignedCodonFrame();
- MapList map = new MapList(new int[]
- { 1, 6 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1);
acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map);
Set<AlignedCodonFrame> acfList = Collections.singleton(acf);
/**
* Simple test of mapping with introns involved.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testBuildSearchResults_withIntron()
{
final Sequence seq1 = new Sequence("Seq1", "C-G-TAGA-GCAGCTT");
seq1.createDatasetSequence();
-
+
final Sequence aseq1 = new Sequence("Seq1", "-P-R");
aseq1.createDatasetSequence();
-
+
/*
* Map dna bases [2, 4, 5], [7, 9, 11] to protein residues 1 and 2
*/
AlignedCodonFrame acf = new AlignedCodonFrame();
- MapList map = new MapList(new int[]
- { 2, 2, 4, 5, 7, 7, 9, 9, 11, 11 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 2, 2, 4, 5, 7, 7, 9, 9, 11, 11 },
+ new int[] { 1, 2 }, 3, 1);
acf.addMap(seq1.getDatasetSequence(), aseq1.getDatasetSequence(), map);
Set<AlignedCodonFrame> acfList = Collections.singleton(acf);
-
+
/*
* Check protein residue 1 maps to [2, 4, 5]
*/
assertEquals(seq1.getDatasetSequence(), m.getSequence());
assertEquals(11, m.getStart());
assertEquals(11, m.getEnd());
-
+
/*
* Check inverse mappings, from codons to protein
*/
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapSequenceGroup_sequences() throws IOException
{
/*
"FASTA");
protein.setDataset(null);
AlignedCodonFrame acf = new AlignedCodonFrame();
- MapList map = new MapList(new int[]
- { 1, 3 }, new int[]
- { 1, 1 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 3 }, new int[] { 1, 1 }, 3, 1);
for (int seq = 0; seq < 3; seq++)
{
acf.addMap(cdna.getSequenceAt(seq).getDatasetSequence(), protein
/*
* Verify the mapped sequence group in dna
*/
- SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, proteinView, dnaView);
+ SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg,
+ proteinView, dnaView);
assertTrue(mappedGroup.getColourText());
assertSame(sg.getIdColour(), mappedGroup.getIdColour());
assertSame(sg.getOutlineColour(), mappedGroup.getOutlineColour());
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapColumnSelection_proteinToDna() throws IOException
{
setupMappedAlignments();
-
+
ColumnSelection colsel = new ColumnSelection();
/*
* viewport). Lower case for introns.
*/
AlignmentI cdna = loadAlignment(">Seq1\nAC-GctGtC-T\n"
- + ">Seq2\nTc-GA-G-T-Tc\n" + ">Seq3\nTtTT-AaCGg-\n",
- "FASTA");
+ + ">Seq2\nTc-GA-G-T-Tc\n" + ">Seq3\nTtTT-AaCGg-\n", "FASTA");
cdna.setDataset(null);
AlignmentI protein = loadAlignment(
- ">Seq1\n-K-P\n>Seq2\nL--Q\n>Seq3\nG--S\n",
- "FASTA");
+ ">Seq1\n-K-P\n>Seq2\nL--Q\n>Seq3\nG--S\n", "FASTA");
protein.setDataset(null);
AlignedCodonFrame acf = new AlignedCodonFrame();
- MapList map = new MapList(new int[]
- { 1, 3, 6, 6, 8, 9 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 3, 6, 6, 8, 9 }, new int[] {
+ 1, 2 }, 3, 1);
acf.addMap(cdna.getSequenceAt(0).getDatasetSequence(), protein
.getSequenceAt(0).getDatasetSequence(), map);
- map = new MapList(new int[]
- { 1, 1, 3, 4, 5, 7 }, new int[]
- { 1, 2 }, 3, 1);
+ map = new MapList(new int[] { 1, 1, 3, 4, 5, 7 }, new int[] { 1, 2 },
+ 3, 1);
acf.addMap(cdna.getSequenceAt(1).getDatasetSequence(), protein
.getSequenceAt(1).getDatasetSequence(), map);
- map = new MapList(new int[]
- { 1, 1, 3, 4, 5, 5, 7, 8 }, new int[]
- { 1, 2 }, 3, 1);
+ map = new MapList(new int[] { 1, 1, 3, 4, 5, 5, 7, 8 }, new int[] { 1,
+ 2 }, 3, 1);
acf.addMap(cdna.getSequenceAt(2).getDatasetSequence(), protein
.getSequenceAt(2).getDatasetSequence(), map);
Set<AlignedCodonFrame> acfList = Collections.singleton(acf);
-
+
dnaView = new AlignViewport(cdna);
proteinView = new AlignViewport(protein);
protein.setCodonFrames(acfList);
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapColumnSelection_dnaToProtein() throws IOException
{
setupMappedAlignments();
-
+
ColumnSelection colsel = new ColumnSelection();
-
+
/*
* Column 0 in dna picks up first bases which map to residue 1, columns 0-1
* in protein.
assertEquals("[0, 1, 3]", cs.getSelected().toString());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapColumnSelection_null() throws IOException
{
setupMappedAlignments();
* Tests for the method that converts a series of [start, end] ranges to
* single positions
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFlattenRanges()
{
assertEquals("[1, 2, 3, 4]",
- Arrays.toString(MappingUtils.flattenRanges(new int[]
- { 1, 4 })));
- assertEquals("[1, 2, 3, 4]",
- Arrays.toString(MappingUtils.flattenRanges(new int[]
- { 1, 2, 3, 4 })));
- assertEquals("[1, 2, 3, 4]",
- Arrays.toString(MappingUtils.flattenRanges(new int[]
- { 1, 1, 2, 2, 3, 3, 4, 4 })));
- assertEquals("[1, 2, 3, 4, 7, 8, 9, 12]",
- Arrays.toString(MappingUtils.flattenRanges(new int[]
- { 1, 4, 7, 9, 12, 12 })));
+ Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 4 })));
+ assertEquals(
+ "[1, 2, 3, 4]",
+ Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 2, 3,
+ 4 })));
+ assertEquals(
+ "[1, 2, 3, 4]",
+ Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 1, 2,
+ 2, 3, 3, 4, 4 })));
+ assertEquals(
+ "[1, 2, 3, 4, 7, 8, 9, 12]",
+ Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 4, 7,
+ 9, 12, 12 })));
// unpaired start position is ignored:
- assertEquals("[1, 2, 3, 4, 7, 8, 9, 12]",
- Arrays.toString(MappingUtils.flattenRanges(new int[]
- { 1, 4, 7, 9, 12, 12, 15 })));
+ assertEquals(
+ "[1, 2, 3, 4, 7, 8, 9, 12]",
+ Arrays.toString(MappingUtils.flattenRanges(new int[] { 1, 4, 7,
+ 9, 12, 12, 15 })));
}
/**
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapSequenceGroup_columns() throws IOException
{
/*
* viewport).
*/
AlignmentI cdna = loadAlignment(
- ">Seq1\nACGGCA\n>Seq2\nTGACAG\n>Seq3\nTACGTA\n",
- "FASTA");
+ ">Seq1\nACGGCA\n>Seq2\nTGACAG\n>Seq3\nTACGTA\n", "FASTA");
cdna.setDataset(null);
AlignmentI protein = loadAlignment(">Seq1\nKA\n>Seq2\nLQ\n>Seq3\nQV\n",
"FASTA");
protein.setDataset(null);
AlignedCodonFrame acf = new AlignedCodonFrame();
- MapList map = new MapList(new int[]
- { 1, 6 }, new int[]
- { 1, 2 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1);
for (int seq = 0; seq < 3; seq++)
{
acf.addMap(cdna.getSequenceAt(seq).getDatasetSequence(), protein
.getSequenceAt(seq).getDatasetSequence(), map);
}
Set<AlignedCodonFrame> acfList = Collections.singleton(acf);
-
+
AlignViewportI dnaView = new AlignViewport(cdna);
AlignViewportI proteinView = new AlignViewport(protein);
protein.setCodonFrames(acfList);
-
+
/*
* Select all sequences, column 2 in the protein
*/
sg.addSequence(protein.getSequenceAt(2), false);
sg.setStartRes(1);
sg.setEndRes(1);
-
+
/*
* Verify the mapped sequence group in dna
*/
- SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, proteinView, dnaView);
+ SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg,
+ proteinView, dnaView);
assertTrue(mappedGroup.getColourText());
assertSame(sg.getIdColour(), mappedGroup.getIdColour());
assertSame(sg.getOutlineColour(), mappedGroup.getOutlineColour());
assertSame(cdna.getSequenceAt(2), mappedGroup.getSequences().get(2));
assertEquals(3, mappedGroup.getStartRes());
assertEquals(5, mappedGroup.getEndRes());
-
+
/*
* Verify mapping sequence group from dna to protein
*/
*
* @throws IOException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testMapSequenceGroup_region() throws IOException
{
/*
">Seq1\n-KA-S\n>Seq2\n--L-QY\n>Seq3\nQ-V-M\n", "FASTA");
protein.setDataset(null);
AlignedCodonFrame acf = new AlignedCodonFrame();
- MapList map = new MapList(new int[]
- { 1, 9 }, new int[]
- { 1, 3 }, 3, 1);
+ MapList map = new MapList(new int[] { 1, 9 }, new int[] { 1, 3 }, 3, 1);
for (int seq = 0; seq < 3; seq++)
{
acf.addMap(cdna.getSequenceAt(seq).getDatasetSequence(), protein
.getSequenceAt(seq).getDatasetSequence(), map);
}
Set<AlignedCodonFrame> acfList = Collections.singleton(acf);
-
+
AlignViewportI dnaView = new AlignViewport(cdna);
AlignViewportI proteinView = new AlignViewport(protein);
protein.setCodonFrames(acfList);
-
+
/*
* Select Seq1 and Seq2 in the protein, column 1 (K/-). Expect mapped
* sequence group to cover Seq1, columns 0-3 (ACG). Because the selection
sg.addSequence(protein.getSequenceAt(1), false);
sg.setStartRes(1);
sg.setEndRes(1);
-
+
/*
* Verify the mapped sequence group in dna
*/
- SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, proteinView, dnaView);
+ SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg,
+ proteinView, dnaView);
assertTrue(mappedGroup.getColourText());
assertSame(sg.getIdColour(), mappedGroup.getIdColour());
assertSame(sg.getOutlineColour(), mappedGroup.getOutlineColour());
// Seq1 has K which should map to columns 0-3 in Seq1
assertEquals(0, mappedGroup.getStartRes());
assertEquals(3, mappedGroup.getEndRes());
-
+
/*
* Now select cols 2-4 in protein. These cover Seq1:AS Seq2:LQ Seq3:VM which
* extend over DNA columns 3-12, 1-7, 6-13 respectively, or 1-13 overall.
assertEquals(4, mappedGroup.getEndRes());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testFindMappingsForSequence()
{
SequenceI seq1 = new Sequence("Seq1", "ABC");
* Create mappings from seq1 to seq2, seq2 to seq1, seq3 to seq1
*/
AlignedCodonFrame acf1 = new AlignedCodonFrame();
- MapList map = new MapList(new int[]
- { 1, 3 }, new int[]
- { 1, 3 },1, 1);
+ MapList map = new MapList(new int[] { 1, 3 }, new int[] { 1, 3 }, 1, 1);
acf1.addMap(seq1.getDatasetSequence(), seq2.getDatasetSequence(), map);
AlignedCodonFrame acf2 = new AlignedCodonFrame();
acf2.addMap(seq2.getDatasetSequence(), seq1.getDatasetSequence(), map);
AlignedCodonFrame acf3 = new AlignedCodonFrame();
acf3.addMap(seq3.getDatasetSequence(), seq1.getDatasetSequence(), map);
-
+
Set<AlignedCodonFrame> mappings = new HashSet<AlignedCodonFrame>();
mappings.add(acf1);
mappings.add(acf2);
mappings.add(acf3);
-
+
/*
* Seq1 has three mappings
*/
result = MappingUtils.findMappingsForSequence(null, null);
assertEquals(0, result.size());
-}
+ }
}
private Object[] things;
- private final Object[] sortedThings = new Object[]
- { c4, c2, c1, c3 };
+ private final Object[] sortedThings = new Object[] { c4, c2, c1, c3 };
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp()
{
- things = new Object[]
- { c1, c2, c3, c4 };
+ things = new Object[] { c1, c2, c3, c4 };
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSort_byIntValues()
{
- int[] values = new int[]
- { 3, 2, 4, 1 };
+ int[] values = new int[] { 3, 2, 4, 1 };
QuickSort.sort(values, things);
- assertTrue(Arrays.equals(new int[]
- { 1, 2, 3, 4 }, values));
+ assertTrue(Arrays.equals(new int[] { 1, 2, 3, 4 }, values));
assertTrue(Arrays.equals(sortedThings, things));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSort_byFloatValues()
{
- float[] values = new float[]
- { 3f, 2f, 4f, 1f };
+ float[] values = new float[] { 3f, 2f, 4f, 1f };
QuickSort.sort(values, things);
- assertTrue(Arrays.equals(new float[]
- { 1f, 2f, 3f, 4f }, values));
+ assertTrue(Arrays.equals(new float[] { 1f, 2f, 3f, 4f }, values));
assertTrue(Arrays.equals(sortedThings, things));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSort_byDoubleValues()
{
- double[] values = new double[]
- { 3d, 2d, 4d, 1d };
+ double[] values = new double[] { 3d, 2d, 4d, 1d };
QuickSort.sort(values, things);
- assertTrue(Arrays.equals(new double[]
- { 1d, 2d, 3d, 4d }, values));
+ assertTrue(Arrays.equals(new double[] { 1d, 2d, 3d, 4d }, values));
assertTrue(Arrays.equals(sortedThings, things));
}
/**
* Sort by String is descending order, case-sensitive
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSort_byStringValues()
{
- String[] values = new String[]
- { "JOHN", "henry", "lucy", "ALISON" };
+ String[] values = new String[] { "JOHN", "henry", "lucy", "ALISON" };
QuickSort.sort(values, things);
- assertTrue(Arrays.equals(new String[]
- { "lucy", "henry", "JOHN", "ALISON" }, values));
- assertTrue(Arrays.equals(new Object[]
- { c3, c2, c1, c4 }, things));
+ assertTrue(Arrays.equals(new String[] { "lucy", "henry", "JOHN",
+ "ALISON" }, values));
+ assertTrue(Arrays.equals(new Object[] { c3, c2, c1, c4 }, things));
}
/**
* Test whether sort is stable i.e. equal values retain their mutual ordering.
*/
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void testSort_withDuplicates()
{
- int[] values = new int[]
- { 3, 4, 2, 4, 1 };
- Object [] things = new Object [] {"A", "X", "Y", "B", "Z"};
+ int[] values = new int[] { 3, 4, 2, 4, 1 };
+ Object[] things = new Object[] { "A", "X", "Y", "B", "Z" };
QuickSort.sort(values, things);
- assertTrue(Arrays.equals(new int[]
- { 1, 2, 3, 4, 4 }, values));
+ assertTrue(Arrays.equals(new int[] { 1, 2, 3, 4, 4 }, values));
// this fails - do we care?
- assertTrue(Arrays.equals(new Object[]
- { "Z", "Y", "A", "X", "B" }, things));
+ assertTrue(Arrays.equals(new Object[] { "Z", "Y", "A", "X", "B" },
+ things));
}
/**
* Test that exercises sort with a mostly zero-valued sortby array. May be of
* interest to check the sort algorithm is efficient.
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSort_MostlyZeroValues()
{
char[] residues = new char[64];
public class ShiftListTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testParseMap()
{
assertNull(ShiftList.parseMap(null));
- assertNull(ShiftList.parseMap(new int[]
- {}));
-
+ assertNull(ShiftList.parseMap(new int[] {}));
+
/*
* Gap map showing residues in aligned positions 2,3,6,8,9,10,12
*/
- int[] gm = new int[]
- { 2, 3, 6, 8, 9, 10, 12 };
+ int[] gm = new int[] { 2, 3, 6, 8, 9, 10, 12 };
List<int[]> shifts = ShiftList.parseMap(gm).getShifts();
assertEquals(4, shifts.size());
public class StringUtilsTest
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testInsertCharAt()
{
char[] c1 = "ABC".toCharArray();
- char[] expected = new char[]
- { 'A', 'B', 'C', 'w', 'w' };
+ char[] expected = new char[] { 'A', 'B', 'C', 'w', 'w' };
assertTrue(Arrays.equals(expected,
StringUtils.insertCharAt(c1, 3, 2, 'w')));
- expected = new char[]
- { 'A', 'B', 'C', 'w', 'w' };
+ expected = new char[] { 'A', 'B', 'C', 'w', 'w' };
assertTrue(Arrays.equals(expected,
StringUtils.insertCharAt(c1, 4, 2, 'w')));
assertTrue(Arrays.equals(expected,
StringUtils.insertCharAt(c1, 7, 2, 'w')));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDeleteChars()
{
char[] c1 = "ABC".toCharArray();
// delete second position
- assertTrue(Arrays.equals(new char[]
- { 'A', 'C' }, StringUtils.deleteChars(c1, 1, 2)));
+ assertTrue(Arrays.equals(new char[] { 'A', 'C' },
+ StringUtils.deleteChars(c1, 1, 2)));
// delete positions 1 and 2
- assertTrue(Arrays.equals(new char[]
- { 'C' }, StringUtils.deleteChars(c1, 0, 2)));
+ assertTrue(Arrays.equals(new char[] { 'C' },
+ StringUtils.deleteChars(c1, 0, 2)));
// delete positions 1-3
- assertTrue(Arrays.equals(new char[]
- {}, StringUtils.deleteChars(c1, 0, 3)));
+ assertTrue(Arrays.equals(new char[] {},
+ StringUtils.deleteChars(c1, 0, 3)));
// delete position 3
- assertTrue(Arrays.equals(new char[]
- { 'A', 'B' }, StringUtils.deleteChars(c1, 2, 3)));
+ assertTrue(Arrays.equals(new char[] { 'A', 'B' },
+ StringUtils.deleteChars(c1, 2, 3)));
// out of range deletion is ignore
assertTrue(Arrays.equals(c1, StringUtils.deleteChars(c1, 3, 4)));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetLastToken()
{
assertNull(StringUtils.getLastToken(null, null));
"file://localhost:8080/data/examples/file1.dat", "/"));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testSeparatorListToArray()
{
String[] result = StringUtils.separatorListToArray(
*/
result = StringUtils.separatorListToArray("minsize='2', sep=','", ",");
assertEquals("[minsize='2', sep=',']", Arrays.toString(result));
-
+
/*
* String delimited by | containing a quoted | (should not be treated as
* delimiter)
.separatorListToArray("abc='|'d|ef|g", "|")));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testArrayToSeparatorList()
{
assertEquals("*", StringUtils.arrayToSeparatorList(null, "*"));
- assertEquals("*", StringUtils.arrayToSeparatorList(new String[]
- {}, "*"));
- assertEquals("a*bc*cde", StringUtils.arrayToSeparatorList(new String[]
- { "a", "bc", "cde" }, "*"));
- assertEquals("a*cde", StringUtils.arrayToSeparatorList(new String[]
- { "a", null, "cde" }, "*"));
- assertEquals("a**cde", StringUtils.arrayToSeparatorList(new String[]
- { "a", "", "cde" }, "*"));
+ assertEquals("*",
+ StringUtils.arrayToSeparatorList(new String[] {}, "*"));
+ assertEquals(
+ "a*bc*cde",
+ StringUtils.arrayToSeparatorList(new String[] { "a", "bc",
+ "cde" }, "*"));
+ assertEquals(
+ "a*cde",
+ StringUtils.arrayToSeparatorList(new String[] { "a", null,
+ "cde" }, "*"));
+ assertEquals("a**cde", StringUtils.arrayToSeparatorList(new String[] {
+ "a", "", "cde" }, "*"));
// delimiter within token is not (yet) escaped
assertEquals("a*b*c*cde", StringUtils.arrayToSeparatorList(new String[]
{ "a", "b*c", "cde" }, "*"));
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
-
public class ViewStyleTest
{
* @throws IllegalAccessException
* @throws IllegalArgumentException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCopyConstructor() throws IllegalArgumentException,
IllegalAccessException
{
ViewStyle vs2 = new ViewStyle(vs1);
- for (Field field1 : fields) {
+ for (Field field1 : fields)
+ {
final Object value1 = field1.get(vs1);
final Object value2 = field1.get(vs2);
String msg = "Mismatch in " + field1.getName() + "(" + value1 + "/"
}
else
{
- AssertJUnit.fail("Unhandled field type (add to test): " + field.getName()
- + ":" + type);
+ AssertJUnit.fail("Unhandled field type (add to test): "
+ + field.getName() + ":" + type);
}
}
* @throws IllegalAccessException
* @throws IllegalArgumentException
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testEquals() throws IllegalArgumentException,
IllegalAccessException
{
SequenceFetcher sf;
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
// ensure 'add annotation from structure' is selected
*
* @throws Exception
*/
- @Test(groups =
- { "Network" }, enabled = true)
+ @Test(groups = { "Network" }, enabled = true)
public void testRnaSeqRetrieve() throws Exception
{
List<DbSourceProxy> sps = sf.getSourceProxy("PDB");
{
assertTrue("No annotation transfered to sequence.",
sq.getAnnotation().length > 0);
- assertTrue("No PDBEntry on sequence.", sq.getAllPDBEntries().size() > 0);
+ assertTrue("No PDBEntry on sequence.",
+ sq.getAllPDBEntries().size() > 0);
assertTrue(
"No RNA annotation on sequence, possibly http://arn-ibmc.in2p3.fr/api/compute/2d not available?",
sq.getRNA() != null);
public class PDBRestClientTest
{
- @BeforeMethod(alwaysRun = true)
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
}
{
}
- @Test(groups =
- { "External", "Network" })
+ @Test(groups = { "External", "Network" })
public void executeRequestTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
assertTrue(response.getSearchSummary().size() > 99);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void getPDBDocFieldsAsCommaDelimitedStringTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
assertEquals("", expectedResult, actualResult);
}
- @Test(groups =
- { "External, Network" })
+ @Test(groups = { "External, Network" })
public void parsePDBJsonExceptionStringTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
assertEquals(expectedErrorMsg, parsedErrorResponse);
}
- @Test(groups =
- { "External", "Network" }, expectedExceptions = Exception.class)
+ @Test(
+ groups = { "External", "Network" },
+ expectedExceptions = Exception.class)
public void testForExpectedRuntimeException() throws Exception
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
new PDBRestClient().executeRequest(request);
}
- @Test(groups =
- { "External" })
+ @Test(groups = { "External" })
public void parsePDBJsonResponseTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
assertTrue(response.getSearchSummary().size() == 14);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void getPDBIdColumIndexTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
assertEquals(4, PDBRestClient.getPDBIdColumIndex(wantedFields, false));
}
- @Test(groups =
- { "External" })
+ @Test(groups = { "External" })
public void externalServiceIntegrationTest()
{
ClientConfig clientConfig = new DefaultClientConfig();
sb.append(line);
sb.append(System.lineSeparator());
line = br.readLine();
- }
+ }
fileContent = sb.toString();
} finally
{
/**
* Test the method that unmarshals XML to a Uniprot model
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetUniprotEntries()
{
Uniprot u = new Uniprot();
/*
* UniprotSequence drops any space characters
*/
- assertEquals("MHAPLVSKDL", entry.getUniprotSequence()
- .getContent());
+ assertEquals("MHAPLVSKDL", entry.getUniprotSequence().getContent());
assertEquals(2, entry.getProtein().getName().size());
assertEquals("Mitogen-activated protein kinase 13", entry.getProtein()
/**
* Test the method that formats the sequence name in Fasta style
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testConstructSequenceFastaHeader()
{
Uniprot u = new Uniprot();
* rather than hang
*/
- @Test(groups =
- { "Interactive" }, enabled = true)
+ @Test(groups = { "Interactive" }, enabled = true)
public void testJws2Gui()
{
Iterator<String> presetEnum = presetTests.iterator();
WsJobParameters pgui = new WsJobParameters(service,
new JabaPreset(service, pr));
JFrame jf = new JFrame(MessageManager.formatMessage(
- "label.ws_parameters_for", new String[]
- { service.getActionText() }));
+ "label.ws_parameters_for",
+ new String[] { service.getActionText() }));
jf.setSize(700, 800);
JPanel cont = new JPanel(new BorderLayout());
pgui.validate();
{
af.setVisible(false);
af.dispose();
- af=null;
+ af = null;
}
}
/**
* test servers
*/
- private static String[] serviceUrls = new String[]
- { "http://localhost:8080/jabaws",
+ private static String[] serviceUrls = new String[] {
+ "http://localhost:8080/jabaws",
"http://www.compbio.dundee.ac.uk/jabaws" };
- @Test(groups =
- { "Functional" }, enabled = false)
+ @Test(groups = { "Functional" }, enabled = false)
public void testAnnotExport()
{
fail("Not yet implemented");
{
return getJabawsDiscoverer(true);
}
+
public static Jws2Discoverer getJabawsDiscoverer(boolean localhost)
{
jalview.ws.jws2.Jws2Discoverer disc = jalview.ws.jws2.Jws2Discoverer
return disc;
}
-
}
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testJPredStructOneSeqOnly()
{
af.selectAllSequenceMenuItem_actionPerformed(null);
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testJPredStructExport()
{
+ "\nCouldn't complete Annotation file roundtrip input/output/input test.");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testJpredwsSettingsRecovery()
{
Assert.fail("not implemnented");
public class MinJabawsClientTests
{
- /**
- * simple test for the benefit of JAL-1338
- * @throws Exception
- */
- @SuppressWarnings("rawtypes")
- @Test(groups =
- { "Network" })
- public void msaTest() throws Exception {
- String url;
- RegistryWS registry = Jws2Client
- .connectToRegistry(url = "http://www.compbio.dundee.ac.uk/jabaws");
- if (registry != null) {
+ /**
+ * simple test for the benefit of JAL-1338
+ *
+ * @throws Exception
+ */
+ @SuppressWarnings("rawtypes")
+ @Test(groups = { "Network" })
+ public void msaTest() throws Exception
+ {
+ String url;
+ RegistryWS registry = Jws2Client
+ .connectToRegistry(url = "http://www.compbio.dundee.ac.uk/jabaws");
+ if (registry != null)
+ {
- MsaWS msaservice = null;
- for (Services service : registry.getSupportedServices()) {
- if (service.equals(Services.ClustalOWS)) {
- msaservice = (MsaWS) Jws2Client.connect(url, service);
- if (msaservice != null) {
- break;
- }
- }
- }
- if (msaservice == null) {
- Assert.fail("couldn't find a clustalO service on the public registry");
- }
- FastaSequence fsq = new FastaSequence("seqA",
- "SESESESESESESESSESESSESESESESESESESESESEEEEEESSESESESESSSSESESESESESESE");
- List<FastaSequence> iseqs = new ArrayList<FastaSequence>();
- for (int i = 0; i < 9; i++) {
- iseqs.add(new FastaSequence(fsq.getId() + i, fsq.getSequence()
- + fsq.getSequence().substring(i + 3, i + 3 + i)));
- }
+ MsaWS msaservice = null;
+ for (Services service : registry.getSupportedServices())
+ {
+ if (service.equals(Services.ClustalOWS))
+ {
+ msaservice = (MsaWS) Jws2Client.connect(url, service);
+ if (msaservice != null)
+ {
+ break;
+ }
+ }
+ }
+ if (msaservice == null)
+ {
+ Assert.fail("couldn't find a clustalO service on the public registry");
+ }
+ FastaSequence fsq = new FastaSequence("seqA",
+ "SESESESESESESESSESESSESESESESESESESESESEEEEEESSESESESESSSSESESESESESESE");
+ List<FastaSequence> iseqs = new ArrayList<FastaSequence>();
+ for (int i = 0; i < 9; i++)
+ {
+ iseqs.add(new FastaSequence(fsq.getId() + i, fsq.getSequence()
+ + fsq.getSequence().substring(i + 3, i + 3 + i)));
+ }
- String jobid = msaservice.align(iseqs);
+ String jobid = msaservice.align(iseqs);
if (jobid != null)
{
JobStatus js = null;
// System.out.println(t.getFormattedFasta());
// }
// });
- }
+ }
- }
- }
+ }
+ }
}
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRNAAliFoldValidStructure()
{
} while (af.getViewport().getCalcManager().isWorking());
AlignmentI orig_alig = af.getViewport().getAlignment();
- for (AlignmentAnnotation aa:orig_alig.getAlignmentAnnotation())
+ for (AlignmentAnnotation aa : orig_alig.getAlignmentAnnotation())
{
if (alifoldClient.involves(aa))
{
}
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRNAStructExport()
{
+ "\nCouldn't complete Annotation file roundtrip input/output/input test.");
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testRnaalifoldSettingsRecovery()
{
List<compbio.metadata.Argument> opts = new ArrayList<compbio.metadata.Argument>();
disc = JalviewJabawsTestUtils.getJabawsDiscoverer();
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testWriteParameterSet() throws WrongParameterException
{
for (Jws2Instance service : disc.getServices())
String on = o.next();
String sn = s.next();
String st = t.next();
- final String errorMsg = "Original was " + on + " Phase 1 wrote " + sn
- + "\tPhase 2 wrote " + st;
+ final String errorMsg = "Original was " + on
+ + " Phase 1 wrote " + sn + "\tPhase 2 wrote " + st;
assertEquals(errorMsg, sn, st);
assertEquals(errorMsg, sn, on);
}
|| serviceTests.contains(service.serviceType.toLowerCase());
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCopyOption()
{
for (Jws2Instance service : disc.getServices())
/**
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testCopyParameter()
{
for (Jws2Instance service : disc.getServices())
/**
* Refactored 'as is' from main method
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testGetRestClient()
{
/*
public class ShmmrRSBSService
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testShmmrService()
{
RestClient.makeShmmrRestClient().service));
}
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testShmmrServiceDataprep() throws Exception
{
RestClient _rc = RestClient.makeShmmrRestClient();
public class DasSequenceFetcher
{
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testDasRegistryContact()
{
jalview.bin.Cache.getDasSourceRegistry().refreshSources();
- AssertJUnit.assertTrue(
- "Expected to find at least one DAS source at the registry. Check config.",
- jalview.bin.Cache.getDasSourceRegistry().getSources().size() > 0);
+ AssertJUnit
+ .assertTrue(
+ "Expected to find at least one DAS source at the registry. Check config.",
+ jalview.bin.Cache.getDasSourceRegistry().getSources()
+ .size() > 0);
}
}
* and also PDB. (Additional sources are dependent on available of DAS
* services.)
*/
- @Test(groups ={ "Functional" })
+ @Test(groups = { "Functional" })
public void testStandardProtDbs()
{
String[] defdb = DBRefSource.PROTEINDBS;
*
* @throws Exception
*/
- @Test(groups =
- { "External" })
+ @Test(groups = { "External" })
public void testEmblUniprotProductRecovery() throws Exception
{
String retrievalId = "V00488";
- DbSourceProxy embl = new SequenceFetcher().getSourceProxy(DBRefSource.EMBL).get(0);
+ DbSourceProxy embl = new SequenceFetcher().getSourceProxy(
+ DBRefSource.EMBL).get(0);
assertNotNull("Couldn't find the EMBL retrieval client", embl);
verifyProteinNucleotideXref(retrievalId, embl);
}
*
* @throws Exception
*/
- @Test(groups =
- { "External" })
+ @Test(groups = { "External" })
public void testEmblCDSUniprotProductRecovery() throws Exception
{
String retrievalId = "AAH29712";
{
AlignmentI alsq = embl.getSequenceRecords(retrievalId);
assertNotNull("Couldn't find the EMBL record " + retrievalId, alsq);
- assertEquals("Didn't retrieve right number of records", 1, alsq.getHeight());
+ assertEquals("Didn't retrieve right number of records", 1,
+ alsq.getHeight());
SequenceI seq = alsq.getSequenceAt(0);
assertEquals("Wrong sequence name", embl.getDbSource() + "|"
+ retrievalId, seq.getName());
FeatureProperties.isCodingFeature(embl.getDbSource(),
sfs[0].getType()));
assertEquals(embl.getDbSource(), sfs[0].getFeatureGroup());
- DBRefEntry[] dr = DBRefUtils.selectRefs(seq.getDBRef(), DBRefSource.PROTEINSEQ);
+ DBRefEntry[] dr = DBRefUtils.selectRefs(seq.getDBRef(),
+ DBRefSource.PROTEINSEQ);
assertNotNull(dr);
assertEquals("Expected a single Uniprot cross reference", 1, dr.length);
assertEquals("Expected cross reference map to be one amino acid", dr[0]
.getMap().getMappedWidth(), 1);
assertEquals("Expected local reference map to be 3 nucleotides", dr[0]
.getMap().getWidth(), 3);
- AlignmentI sprods = CrossRef.findXrefSequences(alsq.getSequencesArray(), true, dr[0].getSource(), alsq.getDataset());
+ AlignmentI sprods = CrossRef.findXrefSequences(
+ alsq.getSequencesArray(), true, dr[0].getSource(),
+ alsq.getDataset());
assertNotNull(
"Couldn't recover cross reference sequence from dataset. Was it ever added ?",
sprods);