From: Jim Procter Date: Wed, 5 Oct 2016 15:33:28 +0000 (+0100) Subject: JAL-2189 format tests X-Git-Tag: Release_2_10_0~9^2~5 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=528c0f1815bc67b54618ad5b16c2162946974caf;p=jalview.git JAL-2189 format tests --- diff --git a/test/MCview/PDBfileTest.java b/test/MCview/PDBfileTest.java index 8e2e2fe..2863643 100644 --- a/test/MCview/PDBfileTest.java +++ b/test/MCview/PDBfileTest.java @@ -311,8 +311,8 @@ public class PDBfileTest return al.getAlignmentAnnotation(); } - //@formatter:on - + // @formatter:on + @BeforeMethod(alwaysRun = true) public void setUp() { diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index b4628b8..4aed7e7 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -439,7 +439,8 @@ public class AlignmentUtilsTests SequenceI alignFrom = new Sequence("Seq2", alignModel); alignFrom.createDatasetSequence(); AlignedCodonFrame acf = new AlignedCodonFrame(); - acf.addMap(alignMe.getDatasetSequence(), alignFrom.getDatasetSequence(), map); + acf.addMap(alignMe.getDatasetSequence(), + alignFrom.getDatasetSequence(), map); AlignmentUtils.alignSequenceAs(alignMe, alignFrom, acf, "---", '-', preserveMappedGaps, preserveUnmappedGaps); @@ -1014,15 +1015,14 @@ public class AlignmentUtilsTests * CDS sequences are 'discovered' from dna-to-protein mappings on the alignment * dataset (e.g. added from dbrefs by CrossRef.findXrefSequences) */ - MapList mapfordna1 = new MapList(new int[] { 4, 6, 10, 12 }, - new int[] { 1, 2 }, 3, 1); + MapList mapfordna1 = new MapList(new int[] { 4, 6, 10, 12 }, new int[] { + 1, 2 }, 3, 1); AlignedCodonFrame acf = new AlignedCodonFrame(); acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), mapfordna1); dna.addCodonFrame(acf); MapList mapfordna2 = new MapList(new int[] { 1, 3, 7, 9, 13, 15 }, - new int[] { 1, 3 }, - 3, 1); + new int[] { 1, 3 }, 3, 1); acf = new AlignedCodonFrame(); acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), mapfordna2); @@ -1310,8 +1310,7 @@ public class AlignmentUtilsTests .findMappingsForSequence(cds.get(0), dnaMappings); Mapping mapping = dnaToCds1Mappings.get(0).getMappings().get(0) .getMapping(); - assertSame(cds.get(0).getDatasetSequence(), mapping - .getTo()); + assertSame(cds.get(0).getDatasetSequence(), mapping.getTo()); assertEquals("G(1) in CDS should map to G(4) in DNA", 4, mapping .getMap().getToPosition(1)); @@ -1379,8 +1378,7 @@ public class AlignmentUtilsTests * @throws IOException */ @Test(groups = { "Functional" }) - public void testMapCdnaToProtein_forSubsequence() - throws IOException + public void testMapCdnaToProtein_forSubsequence() throws IOException { SequenceI prot = new Sequence("UNIPROT|V12345", "E-I--Q", 10, 12); prot.createDatasetSequence(); @@ -1401,7 +1399,7 @@ public class AlignmentUtilsTests @Test(groups = { "Functional" }) public void testAlignSequenceAs_mappedProteinProtein() { - + SequenceI alignMe = new Sequence("Match", "MGAASEV"); alignMe.createDatasetSequence(); SequenceI alignFrom = new Sequence("Query", "LQTGYMGAASEVMFSPTRR"); @@ -1412,7 +1410,7 @@ public class AlignmentUtilsTests MapList map = new MapList(new int[] { 6, 12 }, new int[] { 1, 7 }, 1, 1); acf.addMap(alignFrom.getDatasetSequence(), alignMe.getDatasetSequence(), map); - + AlignmentUtils.alignSequenceAs(alignMe, alignFrom, acf, "-", '-', true, true); assertEquals("-----MGAASEV-------", alignMe.getSequenceAsString()); @@ -1427,7 +1425,7 @@ public class AlignmentUtilsTests { // map first 3 codons to KPF; G is a trailing unmapped residue MapList map = new MapList(new int[] { 1, 9 }, new int[] { 1, 3 }, 3, 1); - + checkAlignSequenceAs("AAACCCTTT", "K-PFG", true, true, map, "AAA---CCCTTT---"); } @@ -1526,7 +1524,7 @@ public class AlignmentUtilsTests MapList map = new MapList(new int[] { 4, 6, 10, 12 }, new int[] { 1, 6 }, 1, 1); - + // [5, 11] maps to [2, 5] dna.addSequenceFeature(new SequenceFeature("type4", "desc4", 5, 11, 4f, null)); @@ -1536,12 +1534,12 @@ public class AlignmentUtilsTests // [12, 12] maps to [6, 6] dna.addSequenceFeature(new SequenceFeature("type8", "desc8", 12, 12, 8f, null)); - + // desc4 and desc8 are the 'omit these' varargs AlignmentUtils.transferFeatures(dna, cds, map, null, "type4", "type8"); SequenceFeature[] sfs = cds.getSequenceFeatures(); assertEquals(1, sfs.length); - + SequenceFeature sf = sfs[0]; assertEquals("type5", sf.getType()); assertEquals(1, sf.getBegin()); @@ -1556,10 +1554,10 @@ public class AlignmentUtilsTests { SequenceI dna = new Sequence("dna/20-34", "acgTAGcaaGCCcgt"); SequenceI cds = new Sequence("cds/10-15", "TAGGCC"); - + MapList map = new MapList(new int[] { 4, 6, 10, 12 }, new int[] { 1, 6 }, 1, 1); - + // [5, 11] maps to [2, 5] dna.addSequenceFeature(new SequenceFeature("type4", "desc4", 5, 11, 4f, null)); @@ -1569,12 +1567,12 @@ public class AlignmentUtilsTests // [12, 12] maps to [6, 6] dna.addSequenceFeature(new SequenceFeature("type8", "desc8", 12, 12, 8f, null)); - + // "type5" is the 'select this type' argument AlignmentUtils.transferFeatures(dna, cds, map, "type5"); SequenceFeature[] sfs = cds.getSequenceFeatures(); assertEquals(1, sfs.length); - + SequenceFeature sf = sfs[0]; assertEquals("type5", sf.getType()); assertEquals(1, sf.getBegin()); @@ -1603,26 +1601,25 @@ public class AlignmentUtilsTests AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2, dna3 }); dna.setDataset(null); - + MapList map = new MapList(new int[] { 4, 12, 16, 18 }, new int[] { 1, 4 }, 3, 1); AlignedCodonFrame acf = new AlignedCodonFrame(); acf.addMap(dna1.getDatasetSequence(), pep1.getDatasetSequence(), map); dna.addCodonFrame(acf); map = new MapList(new int[] { 4, 8, 12, 12, 16, 18 }, - new int[] { 1, 3 }, - 3, 1); + new int[] { 1, 3 }, 3, 1); acf = new AlignedCodonFrame(); acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), map); dna.addCodonFrame(acf); - + AlignmentI cds = AlignmentUtils.makeCdsAlignment(new SequenceI[] { dna1, dna2, dna3 }, dna.getDataset(), null); List cdsSeqs = cds.getSequences(); assertEquals(2, cdsSeqs.size()); assertEquals("GGGCCCTTTGGG", cdsSeqs.get(0).getSequenceAsString()); assertEquals("GGGCCTGGG", cdsSeqs.get(1).getSequenceAsString()); - + /* * verify shared, extended alignment dataset */ @@ -1638,7 +1635,7 @@ public class AlignmentUtilsTests */ List mappings = cds.getCodonFrames(); assertEquals(6, mappings.size()); - + /* * 2 mappings involve pep1 */ @@ -1657,8 +1654,7 @@ public class AlignmentUtilsTests pep1CdsMappings); assertEquals(1, sr.getResults().size()); Match m = sr.getResults().get(0); - assertEquals(cds.getSequenceAt(0).getDatasetSequence(), - m.getSequence()); + assertEquals(cds.getSequenceAt(0).getDatasetSequence(), m.getSequence()); assertEquals(1, m.getStart()); assertEquals(3, m.getEnd()); sr = MappingUtils.buildSearchResults(pep1, 2, pep1CdsMappings); @@ -1673,7 +1669,7 @@ public class AlignmentUtilsTests m = sr.getResults().get(0); assertEquals(10, m.getStart()); assertEquals(12, m.getEnd()); - + /* * Get mapping of pep2 to cds2 and verify it * maps GPG in pep2 to 1-3,4-6,7-9 in second CDS sequence @@ -1687,8 +1683,7 @@ public class AlignmentUtilsTests sr = MappingUtils.buildSearchResults(pep2, 1, pep2CdsMappings); assertEquals(1, sr.getResults().size()); m = sr.getResults().get(0); - assertEquals(cds.getSequenceAt(1).getDatasetSequence(), - m.getSequence()); + assertEquals(cds.getSequenceAt(1).getDatasetSequence(), m.getSequence()); assertEquals(1, m.getStart()); assertEquals(3, m.getEnd()); sr = MappingUtils.buildSearchResults(pep2, 2, pep2CdsMappings); @@ -1715,7 +1710,7 @@ public class AlignmentUtilsTests SequenceI dna3 = new Sequence("Seq3", "ccaaa-ttt-GGG-"); AlignmentI dna = new Alignment(new SequenceI[] { dna1, dna2, dna3 }); dna.setDataset(null); - + // prot1 has 'X' for incomplete start codon (not mapped) SequenceI prot1 = new Sequence("Seq1", "XKFG"); // X for incomplete start SequenceI prot2 = new Sequence("Seq2", "NG"); @@ -1723,7 +1718,7 @@ public class AlignmentUtilsTests AlignmentI protein = new Alignment(new SequenceI[] { prot1, prot2, prot3 }); protein.setDataset(null); - + // map dna1 [3, 11] to prot1 [2, 4] KFG MapList map = new MapList(new int[] { 3, 11 }, new int[] { 2, 4 }, 3, 1); AlignedCodonFrame acf = new AlignedCodonFrame(); @@ -1762,7 +1757,7 @@ public class AlignmentUtilsTests SequenceI dnaSeq = new Sequence("dna", "aaagGGCCCaaaTTTttt"); dnaSeq.createDatasetSequence(); SequenceI ds = dnaSeq.getDatasetSequence(); - + // CDS for dna 5-6 (incomplete codon), 7-9 SequenceFeature sf = new SequenceFeature("CDS", "", 5, 9, 0f, null); sf.setPhase("2"); // skip 2 bases to start of next codon @@ -1770,9 +1765,9 @@ public class AlignmentUtilsTests // CDS for dna 13-15 sf = new SequenceFeature("CDS_predicted", "", 13, 15, 0f, null); ds.addSequenceFeature(sf); - + List ranges = AlignmentUtils.findCdsPositions(dnaSeq); - + /* * check the mapping starts with the first complete codon */ @@ -1794,7 +1789,7 @@ public class AlignmentUtilsTests SequenceI dnaSeq = new Sequence("dna", "aaaGGGcccAAATTTttt"); dnaSeq.createDatasetSequence(); SequenceI ds = dnaSeq.getDatasetSequence(); - + // CDS for dna 10-12 SequenceFeature sf = new SequenceFeature("CDS_predicted", "", 10, 12, 0f, null); @@ -1807,7 +1802,7 @@ public class AlignmentUtilsTests // exon feature should be ignored here sf = new SequenceFeature("exon", "", 7, 9, 0f, null); ds.addSequenceFeature(sf); - + List ranges = AlignmentUtils.findCdsPositions(dnaSeq); /* * verify ranges { [4-6], [12-10] } @@ -2152,7 +2147,7 @@ public class AlignmentUtilsTests SequenceI dnaSeq = new Sequence("dna", "aaaGGGcccAAATTTttt"); dnaSeq.createDatasetSequence(); SequenceI ds = dnaSeq.getDatasetSequence(); - + // CDS for dna 4-6 SequenceFeature sf = new SequenceFeature("CDS", "", 4, 6, 0f, null); sf.setStrand("-"); @@ -2164,7 +2159,7 @@ public class AlignmentUtilsTests sf = new SequenceFeature("CDS_predicted", "", 10, 12, 0f, null); sf.setStrand("-"); ds.addSequenceFeature(sf); - + List ranges = AlignmentUtils.findCdsPositions(dnaSeq); /* * verify ranges { [12-10], [6-4] } @@ -2190,7 +2185,7 @@ public class AlignmentUtilsTests SequenceI dnaSeq = new Sequence("dna", "aaagGGCCCaaaTTTttt"); dnaSeq.createDatasetSequence(); SequenceI ds = dnaSeq.getDatasetSequence(); - + // CDS for dna 5-9 SequenceFeature sf = new SequenceFeature("CDS", "", 5, 9, 0f, null); sf.setStrand("-"); @@ -2200,9 +2195,9 @@ public class AlignmentUtilsTests sf.setStrand("-"); sf.setPhase("2"); // skip 2 bases to start of next codon ds.addSequenceFeature(sf); - + List ranges = AlignmentUtils.findCdsPositions(dnaSeq); - + /* * check the mapping starts with the first complete codon * expect ranges [13, 13], [9, 5] @@ -2255,8 +2250,7 @@ public class AlignmentUtilsTests from.createDatasetSequence(); seq1.createDatasetSequence(); Mapping mapping = new Mapping(seq1, new MapList( - new int[] { 3, 6, 9, 10 }, - new int[] { 1, 6 }, 1, 1)); + new int[] { 3, 6, 9, 10 }, new int[] { 1, 6 }, 1, 1)); Map> map = new TreeMap>(); AlignmentUtils.addMappedPositions(seq1, from, mapping, map); @@ -2288,11 +2282,10 @@ public class AlignmentUtilsTests from.createDatasetSequence(); seq1.createDatasetSequence(); Mapping mapping = new Mapping(seq1, new MapList( - new int[] { 3, 6, 9, 10 }, - new int[] { 1, 6 }, 1, 1)); + new int[] { 3, 6, 9, 10 }, new int[] { 1, 6 }, 1, 1)); Map> map = new TreeMap>(); AlignmentUtils.addMappedPositions(seq1, from, mapping, map); - + /* * verify map has seq1 residues in columns 3,4,6,7,11,12 */ @@ -2330,7 +2323,7 @@ public class AlignmentUtilsTests dna.setDataset(null); AlignmentI emblPeptides = new Alignment(new SequenceI[] { pep3, pep4 }); emblPeptides.setDataset(null); - + AlignedCodonFrame acf = new AlignedCodonFrame(); MapList map = new MapList(new int[] { 4, 6, 10, 12 }, new int[] { 1, 2 }, 3, 1); @@ -2344,17 +2337,17 @@ public class AlignmentUtilsTests acf.addMap(dna2.getDatasetSequence(), pep2.getDatasetSequence(), map); acf.addMap(dna2.getDatasetSequence(), pep4.getDatasetSequence(), map); dna.addCodonFrame(acf); - + /* * execute method under test to find CDS for EMBL peptides only */ AlignmentI cds = AlignmentUtils.makeCdsAlignment(new SequenceI[] { dna1, dna2 }, dna.getDataset(), emblPeptides.getSequencesArray()); - + assertEquals(2, cds.getSequences().size()); assertEquals("GGGTTT", cds.getSequenceAt(0).getSequenceAsString()); assertEquals("GGGTTTCCC", cds.getSequenceAt(1).getSequenceAsString()); - + /* * verify shared, extended alignment dataset */ @@ -2363,7 +2356,7 @@ public class AlignmentUtilsTests .contains(cds.getSequenceAt(0).getDatasetSequence())); assertTrue(dna.getDataset().getSequences() .contains(cds.getSequenceAt(1).getDatasetSequence())); - + /* * Verify mappings from CDS to peptide, cDNA to CDS, and cDNA to peptide * the mappings are on the shared alignment dataset @@ -2373,7 +2366,7 @@ public class AlignmentUtilsTests * 6 mappings, 2*(DNA->CDS), 2*(DNA->Pep), 2*(CDS->Pep) */ assertEquals(6, cdsMappings.size()); - + /* * verify that mapping sets for dna and cds alignments are different * [not current behaviour - all mappings are on the alignment dataset] @@ -2382,7 +2375,7 @@ public class AlignmentUtilsTests // Assert.assertNotSame(dna.getCodonFrames(), cds.getCodonFrames()); // assertEquals(4, dna.getCodonFrames().size()); // assertEquals(4, cds.getCodonFrames().size()); - + /* * Two mappings involve pep3 (dna to pep3, cds to pep3) * Mapping from pep3 to GGGTTT in first new exon sequence @@ -2393,7 +2386,7 @@ public class AlignmentUtilsTests List mappings = MappingUtils .findMappingsForSequence(cds.getSequenceAt(0), pep3Mappings); assertEquals(1, mappings.size()); - + // map G to GGG SearchResults sr = MappingUtils.buildSearchResults(pep3, 1, mappings); assertEquals(1, sr.getResults().size()); @@ -2407,7 +2400,7 @@ public class AlignmentUtilsTests assertSame(cds.getSequenceAt(0).getDatasetSequence(), m.getSequence()); assertEquals(4, m.getStart()); assertEquals(6, m.getEnd()); - + /* * Two mappings involve pep4 (dna to pep4, cds to pep4) * Verify mapping from pep4 to GGGTTTCCC in second new exon sequence @@ -2461,7 +2454,7 @@ public class AlignmentUtilsTests dna4.setSequence(seq2); AlignmentI al2 = new Alignment(new SequenceI[] { dna3, dna4 }); ((Alignment) al2).createDatasetAlignment(); - + assertTrue(AlignmentUtils.alignAsSameSequences(al1, al2)); assertEquals(seq1, al1.getSequenceAt(0).getSequenceAsString()); assertEquals(seq2, al1.getSequenceAt(1).getSequenceAsString()); @@ -2518,5 +2511,5 @@ public class AlignmentUtilsTests assertEquals(s_as2, uas2.getSequenceAsString()); assertEquals(s_as3, uas3.getSequenceAsString()); } - + } diff --git a/test/jalview/analysis/CrossRefTest.java b/test/jalview/analysis/CrossRefTest.java index 759f527..a85dcef 100644 --- a/test/jalview/analysis/CrossRefTest.java +++ b/test/jalview/analysis/CrossRefTest.java @@ -251,8 +251,7 @@ public class CrossRefTest */ SequenceI dna1 = new Sequence("AF039662", "GGGGCAGCACAAGAAC"); Mapping map = new Mapping(new Sequence("pep2", "MLAVSRG"), new MapList( - new int[] { 1, 21 }, new int[] { - 1, 7 }, 3, 1)); + new int[] { 1, 21 }, new int[] { 1, 7 }, 3, 1)); DBRefEntry dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2", map); dna1.addDBRef(dbref); dna1.addDBRef(new DBRefEntry("EMBL", "0", "AF039662")); @@ -282,7 +281,7 @@ public class CrossRefTest dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2"); found = testee.searchDataset(!dna1.isProtein(), dna1, dbref, result, acf, false); // search dataset with a protein xref from a dna - // sequence to locate the protein product + // sequence to locate the protein product assertTrue(found); assertEquals(1, result.size()); assertSame(pep1, result.get(0)); @@ -296,7 +295,7 @@ public class CrossRefTest dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2"); found = testee.searchDataset(!pep1.isProtein(), pep1, dbref, result, acf, false); // search dataset with a protein's direct dbref to - // locate dna sequences with matching xref + // locate dna sequences with matching xref assertTrue(found); assertEquals(1, result.size()); assertSame(dna1, result.get(0)); diff --git a/test/jalview/analysis/DnaTest.java b/test/jalview/analysis/DnaTest.java index 0142ab5..1851517 100644 --- a/test/jalview/analysis/DnaTest.java +++ b/test/jalview/analysis/DnaTest.java @@ -525,7 +525,7 @@ public class DnaTest String seqDsRev = new StringBuilder(seqDs).reverse().toString(); SequenceI dna = new Sequence("Seq1", seq); - Alignment al = new Alignment(new SequenceI[] {dna}); + Alignment al = new Alignment(new SequenceI[] { dna }); al.createDatasetAlignment(); assertEquals(seqDs, al.getSequenceAt(0).getDatasetSequence() .getSequenceAsString()); diff --git a/test/jalview/analysis/GroupingTest.java b/test/jalview/analysis/GroupingTest.java index df39b81..cea8ae4 100644 --- a/test/jalview/analysis/GroupingTest.java +++ b/test/jalview/analysis/GroupingTest.java @@ -44,11 +44,11 @@ public class GroupingTest Sequence s5 = new Sequence("s5", "AAAADDEDTTEE"); - SequenceGroup sg_12 = new SequenceGroup(Arrays.asList(new SequenceI[] { s1, - s2 }), "Group1", null, false, false, false, 0, 5); + SequenceGroup sg_12 = new SequenceGroup(Arrays.asList(new SequenceI[] { + s1, s2 }), "Group1", null, false, false, false, 0, 5); - SequenceGroup sg_345 = new SequenceGroup(Arrays.asList(new SequenceI[] { s3, - s4, s5 }), "Group2", null, false, false, false, 0, 5); + SequenceGroup sg_345 = 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 }); diff --git a/test/jalview/analysis/RnaTest.java b/test/jalview/analysis/RnaTest.java index f96d2c9..9d35a19 100644 --- a/test/jalview/analysis/RnaTest.java +++ b/test/jalview/analysis/RnaTest.java @@ -105,7 +105,7 @@ public class RnaTest { String s = String.valueOf((char) i); String ss = Rna.getRNASecStrucState(s); - + /* * valid SS chars are a-z, A-Z, and various brackets; * anything else is returned as a space @@ -120,7 +120,7 @@ public class RnaTest assertEquals(" ", ss); } } - + /* * a string is processed character by character */ @@ -278,7 +278,7 @@ public class RnaTest public void testIsRnaSecondaryStructureSymbol() { assertFalse(Rna.isRnaSecondaryStructureSymbol(null)); - + /* * only A-Z, a-z, ()[]{}<> are valid symbols */ diff --git a/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java b/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java index 029483f..309790f 100644 --- a/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java +++ b/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java @@ -82,8 +82,8 @@ public class FeatureScoreModelTest { AlignFrame alf = getTestAlignmentFrame(); FeatureScoreModel fsm = new FeatureScoreModel(); - Assert.assertTrue(fsm.configureFromAlignmentView(alf - .getCurrentView().getAlignPanel())); + Assert.assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView() + .getAlignPanel())); alf.selectAllSequenceMenuItem_actionPerformed(null); float[][] dm = fsm.findDistances(alf.getViewport().getAlignmentView( true)); @@ -124,11 +124,13 @@ public class FeatureScoreModelTest alf.selectAllSequenceMenuItem_actionPerformed(null); float[][] dm = fsm.findDistances(alf.getViewport().getAlignmentView( true)); - Assert.assertTrue(dm[0][2] == 0f, + Assert.assertTrue( + dm[0][2] == 0f, "After hiding last two columns FER1_MESCR (0) should still be identical with RAPSA (2)"); - Assert.assertTrue(dm[0][1] == 0f, + Assert.assertTrue( + dm[0][1] == 0f, "After hiding last two columns FER1_MESCR (0) should now also be identical with SPIOL (1)"); - for (int s=0;s<3;s++) + for (int s = 0; s < 3; s++) { Assert.assertTrue(dm[s][3] > 0f, "After hiding last two columns " + alf.getViewport().getAlignment().getSequenceAt(s).getName() diff --git a/test/jalview/controller/AlignViewControllerTest.java b/test/jalview/controller/AlignViewControllerTest.java index 3eefada..55428b1 100644 --- a/test/jalview/controller/AlignViewControllerTest.java +++ b/test/jalview/controller/AlignViewControllerTest.java @@ -52,14 +52,13 @@ public class AlignViewControllerTest assertEquals(2, bs.cardinality()); assertTrue(bs.get(1)); assertTrue(bs.get(2)); - + /* * select the first four columns: Metal in seq1 2:4, seq2 4:4 */ sg.setEndRes(3); bs.clear(); - seqCount = AlignViewController.findColumnsWithFeature("Metal", sg, - bs); + seqCount = AlignViewController.findColumnsWithFeature("Metal", sg, bs); assertEquals(2, seqCount); assertEquals(3, bs.cardinality()); assertTrue(bs.get(1)); diff --git a/test/jalview/datamodel/AlignedCodonFrameTest.java b/test/jalview/datamodel/AlignedCodonFrameTest.java index f2dd968..2e0793e 100644 --- a/test/jalview/datamodel/AlignedCodonFrameTest.java +++ b/test/jalview/datamodel/AlignedCodonFrameTest.java @@ -462,7 +462,7 @@ public class AlignedCodonFrameTest seq1.createDatasetSequence(); final Sequence aseq1 = new Sequence("Seq1", "-V-L"); aseq1.createDatasetSequence(); - + AlignedCodonFrame acf = new AlignedCodonFrame(); MapList map = new MapList(new int[] { 2, 4, 6, 6, 8, 9 }, new int[] { 1, 2 }, 3, 1); diff --git a/test/jalview/datamodel/AlignmentTest.java b/test/jalview/datamodel/AlignmentTest.java index fcf724a..7958e9b 100644 --- a/test/jalview/datamodel/AlignmentTest.java +++ b/test/jalview/datamodel/AlignmentTest.java @@ -134,19 +134,23 @@ public class AlignmentTest * - the alignmentI object to verify (either alignment or dataset) * @param raiseAssert * - when set, testng assertions are raised. - * @param message - * - null or a string message to prepend to the assert failed messages. + * @param message + * - null or a string message to prepend to the assert failed + * messages. * @return true if alignment references were in order, otherwise false. */ public static boolean verifyAlignmentDatasetRefs(AlignmentI alignment, boolean raiseAssert, String message) { - if (message==null) { message = ""; } + if (message == null) + { + message = ""; + } if (alignment == null) { if (raiseAssert) { - Assert.fail(message+"Alignment for verification was null."); + Assert.fail(message + "Alignment for verification was null."); } return false; } @@ -161,7 +165,8 @@ public class AlignmentTest { if (raiseAssert) { - Assert.fail(message+" Alignment contained a sequence who's dataset sequence has a second dataset reference."); + Assert.fail(message + + " Alignment contained a sequence who's dataset sequence has a second dataset reference."); } return false; } @@ -169,12 +174,14 @@ public class AlignmentTest { if (raiseAssert) { - Assert.fail(message+" Alignment contained a sequence who's dataset sequence was not in the dataset."); + Assert.fail(message + + " Alignment contained a sequence who's dataset sequence was not in the dataset."); } return false; } } - return verifyAlignmentDatasetRefs(alignment.getDataset(), raiseAssert, message); + return verifyAlignmentDatasetRefs(alignment.getDataset(), + raiseAssert, message); } else { @@ -187,7 +194,8 @@ public class AlignmentTest { if (raiseAssert) { - Assert.fail(message+" Dataset contained a sequence with non-null dataset reference (ie not a dataset sequence!)"); + Assert.fail(message + + " Dataset contained a sequence with non-null dataset reference (ie not a dataset sequence!)"); } return false; } @@ -216,7 +224,8 @@ public class AlignmentTest { if (raiseAssert) { - Assert.fail(message+" DBRefEntry for sequence in alignment had map to sequence which was not a dataset sequence"); + Assert.fail(message + + " DBRefEntry for sequence in alignment had map to sequence which was not a dataset sequence"); } return false; @@ -225,7 +234,8 @@ public class AlignmentTest { if (raiseAssert) { - Assert.fail(message+" DBRefEntry for sequence in alignment had map to sequence not in dataset"); + Assert.fail(message + + " DBRefEntry for sequence in alignment had map to sequence not in dataset"); } return false; } @@ -245,7 +255,8 @@ public class AlignmentTest { if (raiseAssert) { - Assert.fail(message+" CodonFrame-SSM-FromSeq is not a dataset sequence"); + Assert.fail(message + + " CodonFrame-SSM-FromSeq is not a dataset sequence"); } return false; } @@ -254,7 +265,8 @@ public class AlignmentTest if (raiseAssert) { - Assert.fail(message+" CodonFrame-SSM-FromSeq is not contained in dataset"); + Assert.fail(message + + " CodonFrame-SSM-FromSeq is not contained in dataset"); } return false; } @@ -262,7 +274,8 @@ public class AlignmentTest { if (raiseAssert) { - Assert.fail(message+" CodonFrame-SSM-Mapping-ToSeq is not a dataset sequence"); + Assert.fail(message + + " CodonFrame-SSM-Mapping-ToSeq is not a dataset sequence"); } return false; } @@ -271,7 +284,8 @@ public class AlignmentTest if (raiseAssert) { - Assert.fail(message+" CodonFrame-SSM-Mapping-ToSeq is not contained in dataset"); + Assert.fail(message + + " CodonFrame-SSM-Mapping-ToSeq is not contained in dataset"); } return false; } @@ -335,6 +349,7 @@ public class AlignmentTest + msg); } } + @Test(groups = { "Functional" }) public void testVerifyAlignmentDatasetRefs() { @@ -342,16 +357,13 @@ public class AlignmentTest "TTTTTT"); // construct simple valid alignment dataset - Alignment al = new Alignment(new SequenceI[] { - sq1, sq2 }); + Alignment al = new Alignment(new SequenceI[] { sq1, sq2 }); // expect this to pass assertVerifyAlignment(al, true, "Simple valid alignment didn't verify"); // check test for sequence->datasetSequence validity sq1.setDatasetSequence(sq2); - assertVerifyAlignment( - al, - false, + assertVerifyAlignment(al, false, "didn't detect dataset sequence with a dataset sequence reference."); sq1.setDatasetSequence(null); @@ -445,7 +457,7 @@ public class AlignmentTest */ public static void assertDatasetIsNormalised(AlignmentI al, String message) { - if (al.getDataset()!=null) + if (al.getDataset() != null) { assertDatasetIsNormalised(al.getDataset(), message); return; @@ -454,17 +466,17 @@ public class AlignmentTest * look for pairs of sequences with same ID, start, end, and sequence */ List seqSet = al.getSequences(); - for (int p=0;p primRefs = Arrays.asList(new DBRefEntry[] { pdb1pdb, pdb2pdb }); @@ -474,15 +472,15 @@ public class SequenceTest new DBRefEntry("PDB", "version3", "3PDB")); // should do nothing sq.getDatasetSequence().addDBRef( new DBRefEntry("PDB", "version4", "4PDB")); // should do nothing - - PDBEntry pdbe1a=new PDBEntry("1PDB", "A", Type.PDB, "filePath/test1"); + + PDBEntry pdbe1a = new PDBEntry("1PDB", "A", Type.PDB, "filePath/test1"); PDBEntry pdbe1b = new PDBEntry("1PDB", "B", Type.PDB, "filePath/test1"); - PDBEntry pdbe2a=new PDBEntry("2PDB", "A", Type.MMCIF, "filePath/test2"); - PDBEntry pdbe2b = new PDBEntry("2PDB", "B", Type.MMCIF, "filePath/test2"); - sq.getDatasetSequence().addPDBId( - pdbe1a); - sq.getDatasetSequence().addPDBId( - pdbe1b); + PDBEntry pdbe2a = new PDBEntry("2PDB", "A", Type.MMCIF, + "filePath/test2"); + PDBEntry pdbe2b = new PDBEntry("2PDB", "B", Type.MMCIF, + "filePath/test2"); + sq.getDatasetSequence().addPDBId(pdbe1a); + sq.getDatasetSequence().addPDBId(pdbe1b); sq.getDatasetSequence().addPDBId(pdbe2a); sq.getDatasetSequence().addPDBId(pdbe2b); @@ -544,7 +542,7 @@ public class SequenceTest assertNotNull(sq.getSequenceFeatures()); assertArrayEquals(sq.getSequenceFeatures(), derived.getSequenceFeatures()); - + /* * verify we have primary db refs *just* for PDB IDs with associated * PDBEntry objects @@ -599,7 +597,7 @@ public class SequenceTest 12.4f, "group")); seq1.addPDBId(new PDBEntry("1A70", "B", Type.PDB, "File")); seq1.addDBRef(new DBRefEntry("EMBL", "1.2", "AZ12345")); - + SequenceI copy = new Sequence(seq1); assertNull(copy.getDatasetSequence()); @@ -675,9 +673,13 @@ public class SequenceTest // copy has a copy of the sequence feature: SequenceFeature[] sfs = copy.getSequenceFeatures(); assertEquals(1, sfs.length); - if (seq1.getDatasetSequence()!=null && copy.getDatasetSequence()==seq1.getDatasetSequence()) { + if (seq1.getDatasetSequence() != null + && copy.getDatasetSequence() == seq1.getDatasetSequence()) + { assertTrue(sfs[0] == seq1.getSequenceFeatures()[0]); - } else { + } + else + { assertFalse(sfs[0] == seq1.getSequenceFeatures()[0]); } assertTrue(sfs[0].equals(seq1.getSequenceFeatures()[0])); @@ -867,11 +869,11 @@ public class SequenceTest public void testGetPrimaryDBRefs_nucleotide() { SequenceI sq = new Sequence("aseq", "TGATCACTCGACTAGCATCAGCATA", 10, 34); - + // primary - Ensembl DBRefEntry dbr1 = new DBRefEntry("ENSEMBL", "0", "ENSG1234"); sq.addDBRef(dbr1); - + // not primary - Ensembl 'transcript' mapping of sub-sequence DBRefEntry dbr2 = new DBRefEntry("ENSEMBL", "0", "ENST1234"); dbr2.setMap(new Mapping(null, new MapList(new int[] { 15, 25 }, @@ -891,7 +893,7 @@ public class SequenceTest // not primary - to protein DBRefEntry dbr5 = new DBRefEntry("UNIPROT", "0", "Q87654"); sq.addDBRef(dbr5); - + List primaryDBRefs = sq.getPrimaryDBRefs(); assertEquals(2, primaryDBRefs.size()); assertTrue(primaryDBRefs.contains(dbr1)); @@ -913,7 +915,7 @@ public class SequenceTest seq.addDBRef(new DBRefEntry("PDB", "0", "3a6sB")); // 7 is not a valid chain code: seq.addDBRef(new DBRefEntry("PDB", "0", "2GIS7")); - + seq.updatePDBIds(); List pdbIds = seq.getAllPDBEntries(); assertEquals(4, pdbIds.size()); diff --git a/test/jalview/datamodel/xdb/embl/EmblEntryTest.java b/test/jalview/datamodel/xdb/embl/EmblEntryTest.java index abe5099..146d570 100644 --- a/test/jalview/datamodel/xdb/embl/EmblEntryTest.java +++ b/test/jalview/datamodel/xdb/embl/EmblEntryTest.java @@ -216,8 +216,7 @@ public class EmblEntryTest // truncate last exon by 6bp int[] truncated = EmblEntry.adjustForProteinLength(4, exons); - assertEquals("[11, 15, 21, 25, 31, 32]", - Arrays.toString(truncated)); + assertEquals("[11, 15, 21, 25, 31, 32]", Arrays.toString(truncated)); // remove last exon and truncate preceding by 1bp truncated = EmblEntry.adjustForProteinLength(3, exons); diff --git a/test/jalview/ext/ensembl/EnsemblCdnaTest.java b/test/jalview/ext/ensembl/EnsemblCdnaTest.java index fb7e143..973ef3d 100644 --- a/test/jalview/ext/ensembl/EnsemblCdnaTest.java +++ b/test/jalview/ext/ensembl/EnsemblCdnaTest.java @@ -32,6 +32,7 @@ public class EnsemblCdnaTest { SequenceOntologyFactory.setInstance(null); } + /** * Test that the cdna part of genomic sequence is correctly identified by * 'exon' features (or subtypes) - reverse strand case. @@ -99,30 +100,30 @@ public class EnsemblCdnaTest genomic.setStart(10000); genomic.setEnd(50000); String transcriptId = "ABC123"; - + // exon at (start+10000) length 501 SequenceFeature sf = new SequenceFeature("exon", "", 20000, 20500, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + // exon (sub-type) at (start + exon_variant) length 101 sf = new SequenceFeature("coding_exon", "", 10500, 10600, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + // exon belonging to a different transcript doesn't count sf = new SequenceFeature("exon", "", 11500, 12600, 0f, null); sf.setValue("Parent", "transcript:anotherOne"); genomic.addSequenceFeature(sf); - + // transcript feature doesn't count sf = new SequenceFeature("transcript", "", 10000, 50000, 0f, null); sf.setStrand("-"); // weird but ignored genomic.addSequenceFeature(sf); - + MapList ranges = testee.getGenomicRangesFromFeatures(genomic, transcriptId, 23); List fromRanges = ranges.getFromRanges(); @@ -151,18 +152,18 @@ public class EnsemblCdnaTest genomic.setStart(10000); genomic.setEnd(50000); String transcriptId = "ABC123"; - + SequenceFeature sf = new SequenceFeature("exon", "", 20000, 20500, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("-"); genomic.addSequenceFeature(sf); - + sf = new SequenceFeature("coding_exon", "", 10500, 10600, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + MapList ranges = testee.getGenomicRangesFromFeatures(genomic, transcriptId, 23); assertNull(ranges); diff --git a/test/jalview/ext/ensembl/EnsemblCdsTest.java b/test/jalview/ext/ensembl/EnsemblCdsTest.java index 5344575..02ce2b2 100644 --- a/test/jalview/ext/ensembl/EnsemblCdsTest.java +++ b/test/jalview/ext/ensembl/EnsemblCdsTest.java @@ -44,25 +44,25 @@ public class EnsemblCdsTest genomic.setStart(10000); genomic.setEnd(50000); String transcriptId = "ABC123"; - + // CDS at (start+10000) length 501 SequenceFeature sf = new SequenceFeature("CDS", "", 20000, 20500, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + // CDS (sub-type) at (start + 10500) length 101 sf = new SequenceFeature("CDS_predicted", "", 10500, 10600, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + // CDS belonging to a different transcript doesn't count sf = new SequenceFeature("CDS", "", 11500, 12600, 0f, null); sf.setValue("Parent", "transcript:anotherOne"); genomic.addSequenceFeature(sf); - + // exon feature doesn't count sf = new SequenceFeature("exon", "", 10000, 50000, 0f, null); genomic.addSequenceFeature(sf); @@ -70,7 +70,7 @@ public class EnsemblCdsTest // mRNA_region feature doesn't count (parent of CDS) sf = new SequenceFeature("mRNA_region", "", 10000, 50000, 0f, null); genomic.addSequenceFeature(sf); - + MapList ranges = testee.getGenomicRangesFromFeatures(genomic, transcriptId, 23); List fromRanges = ranges.getFromRanges(); @@ -96,22 +96,22 @@ public class EnsemblCdsTest { String accId = "ABC123"; EnsemblCds testee = new EnsemblCds(); - - SequenceFeature sf = new SequenceFeature("CDS", "", 20000, - 20500, 0f, null); + + SequenceFeature sf = new SequenceFeature("CDS", "", 20000, 20500, 0f, + null); assertFalse(testee.retainFeature(sf, accId)); - + sf.setType("CDS_predicted"); assertFalse(testee.retainFeature(sf, accId)); - + // other feature with no parent is retained sf.setType("sequence_variant"); assertTrue(testee.retainFeature(sf, accId)); - + // other feature with desired parent is retained sf.setValue("Parent", "transcript:" + accId); assertTrue(testee.retainFeature(sf, accId)); - + // feature with wrong parent is not retained sf.setValue("Parent", "transcript:XYZ"); assertFalse(testee.retainFeature(sf, accId)); @@ -126,27 +126,27 @@ public class EnsemblCdsTest { String accId = "ABC123"; EnsemblCds testee = new EnsemblCds(); - + // cds with no parent not valid SequenceFeature sf = new SequenceFeature("CDS", "", 1, 2, 0f, null); assertFalse(testee.identifiesSequence(sf, accId)); - + // cds with wrong parent not valid sf.setValue("Parent", "transcript:XYZ"); assertFalse(testee.identifiesSequence(sf, accId)); - + // cds with right parent is valid sf.setValue("Parent", "transcript:" + accId); assertTrue(testee.identifiesSequence(sf, accId)); - + // cds sub-type with right parent is valid sf.setType("CDS_predicted"); assertTrue(testee.identifiesSequence(sf, accId)); - + // transcript not valid: sf.setType("transcript"); assertFalse(testee.identifiesSequence(sf, accId)); - + // exon not valid: sf.setType("exon"); assertFalse(testee.identifiesSequence(sf, accId)); diff --git a/test/jalview/ext/ensembl/EnsemblGeneTest.java b/test/jalview/ext/ensembl/EnsemblGeneTest.java index 4e815d1..ed3449b 100644 --- a/test/jalview/ext/ensembl/EnsemblGeneTest.java +++ b/test/jalview/ext/ensembl/EnsemblGeneTest.java @@ -135,8 +135,8 @@ public class EnsemblGeneTest genomic.addSequenceFeature(sf1); // transcript sub-type feature - SequenceFeature sf2 = new SequenceFeature("snRNA", "", 20000, - 20500, 0f, null); + SequenceFeature sf2 = new SequenceFeature("snRNA", "", 20000, 20500, + 0f, null); sf2.setValue("Parent", "gene:" + geneId); sf2.setValue("transcript_id", "transcript2"); genomic.addSequenceFeature(sf2); @@ -177,8 +177,8 @@ public class EnsemblGeneTest { String geneId = "ABC123"; EnsemblGene testee = new EnsemblGene(); - SequenceFeature sf = new SequenceFeature("gene", "", 20000, - 20500, 0f, null); + SequenceFeature sf = new SequenceFeature("gene", "", 20000, 20500, 0f, + null); sf.setValue("ID", "gene:" + geneId); assertFalse(testee.retainFeature(sf, geneId)); @@ -210,27 +210,27 @@ public class EnsemblGeneTest { String accId = "ABC123"; EnsemblGene testee = new EnsemblGene(); - + // gene with no ID not valid SequenceFeature sf = new SequenceFeature("gene", "", 1, 2, 0f, null); assertFalse(testee.identifiesSequence(sf, accId)); - + // gene with wrong ID not valid sf.setValue("ID", "gene:XYZ"); assertFalse(testee.identifiesSequence(sf, accId)); - + // gene with right ID is valid sf.setValue("ID", "gene:" + accId); assertTrue(testee.identifiesSequence(sf, accId)); - + // gene sub-type with right ID is valid sf.setType("snRNA_gene"); assertTrue(testee.identifiesSequence(sf, accId)); - + // transcript not valid: sf.setType("transcript"); assertFalse(testee.identifiesSequence(sf, accId)); - + // exon not valid: sf.setType("exon"); assertFalse(testee.identifiesSequence(sf, accId)); diff --git a/test/jalview/ext/ensembl/EnsemblGenomeTest.java b/test/jalview/ext/ensembl/EnsemblGenomeTest.java index c711279..377c8c7 100644 --- a/test/jalview/ext/ensembl/EnsemblGenomeTest.java +++ b/test/jalview/ext/ensembl/EnsemblGenomeTest.java @@ -43,15 +43,14 @@ public class EnsemblGenomeTest genomic.setStart(10000); genomic.setEnd(50000); String transcriptId = "ABC123"; - + // transcript at (start+10000) length 501 SequenceFeature sf = new SequenceFeature("transcript", "", 20000, - 20500, 0f, - null); + 20500, 0f, null); sf.setValue("ID", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + // transcript (sub-type) at (start + 10500) length 101 sf = new SequenceFeature("ncRNA", "", 10500, 10600, 0f, null); sf.setValue("ID", "transcript:" + transcriptId); @@ -65,12 +64,12 @@ public class EnsemblGenomeTest sf.setValue("ID", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + // transcript with a different ID doesn't count sf = new SequenceFeature("transcript", "", 11500, 12600, 0f, null); sf.setValue("ID", "transcript:anotherOne"); genomic.addSequenceFeature(sf); - + // parent of transcript feature doesn't count sf = new SequenceFeature("gene_member_region", "", 10000, 50000, 0f, null); @@ -107,13 +106,13 @@ public class EnsemblGenomeTest SequenceFeature sf = new SequenceFeature("transcript", "", 20000, 20500, 0f, null); assertFalse(testee.retainFeature(sf, accId)); - + sf.setType("mature_transcript"); assertFalse(testee.retainFeature(sf, accId)); - + sf.setType("NMD_transcript_variant"); assertFalse(testee.retainFeature(sf, accId)); - + // other feature with no parent is kept sf.setType("anything"); assertTrue(testee.retainFeature(sf, accId)); @@ -136,20 +135,20 @@ public class EnsemblGenomeTest { String accId = "ABC123"; EnsemblGenome testee = new EnsemblGenome(); - + // transcript with no ID not valid SequenceFeature sf = new SequenceFeature("transcript", "", 1, 2, 0f, null); assertFalse(testee.identifiesSequence(sf, accId)); - + // transcript with wrong ID not valid sf.setValue("ID", "transcript"); assertFalse(testee.identifiesSequence(sf, accId)); - + // transcript with right ID is valid sf.setValue("ID", "transcript:" + accId); assertTrue(testee.identifiesSequence(sf, accId)); - + // transcript sub-type with right ID is valid sf.setType("ncRNA"); assertTrue(testee.identifiesSequence(sf, accId)); @@ -157,11 +156,11 @@ public class EnsemblGenomeTest // Ensembl treats NMD_transcript_variant as if a transcript sf.setType("NMD_transcript_variant"); assertTrue(testee.identifiesSequence(sf, accId)); - + // gene not valid: sf.setType("gene"); assertFalse(testee.identifiesSequence(sf, accId)); - + // exon not valid: sf.setType("exon"); assertFalse(testee.identifiesSequence(sf, accId)); diff --git a/test/jalview/ext/ensembl/EnsemblRestClientTest.java b/test/jalview/ext/ensembl/EnsemblRestClientTest.java index 56e1339..5c427a5 100644 --- a/test/jalview/ext/ensembl/EnsemblRestClientTest.java +++ b/test/jalview/ext/ensembl/EnsemblRestClientTest.java @@ -16,43 +16,43 @@ public class EnsemblRestClientTest { EnsemblRestClient sf = new EnsemblRestClient() { - + @Override public String getDbName() { return null; } - + @Override public AlignmentI getSequenceRecords(String queries) throws Exception { return null; } - + @Override protected URL getUrl(List ids) throws MalformedURLException { return null; } - + @Override protected boolean useGetRequest() { return false; } - + @Override protected String getRequestMimeType(boolean b) { return null; } - + @Override protected String getResponseMimeType() { return null; } - + }; boolean isAvailable = sf.isEnsemblAvailable(); if (isAvailable) diff --git a/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java b/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java index 2d3948f..3ca4553 100644 --- a/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java +++ b/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java @@ -23,7 +23,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; - public class EnsemblSeqProxyTest { private static final Object[][] allSeqs = new Object[][] { @@ -125,12 +124,11 @@ public class EnsemblSeqProxyTest } @Test(dataProvider = "ens_seqs", suiteName = "live") - public void testGetOneSeqs(EnsemblRestClient proxy, String sq, String fastasq) - throws Exception + public void testGetOneSeqs(EnsemblRestClient proxy, String sq, + String fastasq) throws Exception { FileParse fp = proxy.getSequenceReader(Arrays - .asList(new String[] - { sq })); + .asList(new String[] { sq })); SequenceI[] sqs = new FastaFile(fp).getSeqsAsArray(); FastaFile trueRes = new FastaFile(fastasq, AppletFormatAdapter.PASTE); SequenceI[] trueSqs = trueRes.getSeqsAsArray(); @@ -152,7 +150,7 @@ public class EnsemblSeqProxyTest "Sequences differ for " + tr.getName() + "\n" + "Exp:" + tr.getSequenceAsString() + "\n" + "Got:" + rseq[0].getSequenceAsString()); - + } } diff --git a/test/jalview/ext/jmol/JmolParserTest.java b/test/jalview/ext/jmol/JmolParserTest.java index f728d63..fb092f6 100644 --- a/test/jalview/ext/jmol/JmolParserTest.java +++ b/test/jalview/ext/jmol/JmolParserTest.java @@ -183,8 +183,7 @@ public class JmolParserTest public void testParse_missingResidues() throws Exception { PDBfile mctest = new PDBfile(false, false, false, - pastePDBDataWithChainBreak, - AppletFormatAdapter.PASTE); + pastePDBDataWithChainBreak, AppletFormatAdapter.PASTE); JmolParser jtest = new JmolParser(pastePDBDataWithChainBreak, AppletFormatAdapter.PASTE); Vector seqs = jtest.getSeqs(); @@ -212,7 +211,7 @@ public class JmolParserTest AppletFormatAdapter.PASTE); Vector seqs = jtest.getSeqs(); Vector mcseqs = mctest.getSeqs(); - + assertEquals("Failed to find 1 sequence\n", 1, seqs.size()); assertEquals("Failed to find 1 sequence\n", 1, mcseqs.size()); assertEquals("ALC", seqs.get(0).getSequenceAsString()); diff --git a/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java b/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java index c984b3a..b6aa375 100644 --- a/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java +++ b/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java @@ -65,15 +65,15 @@ public class JmolVsJalviewPDBParserEndToEndTest { try { - String testSeq = mcseqs.remove(0).getSequenceAsString(); + String testSeq = mcseqs.remove(0).getSequenceAsString(); if (!sq.getSequenceAsString().equals(testSeq)) - { - ++totalFail; + { + ++totalFail; System.err.println("Test Failed for " + pdbStr + ". Diff:"); - System.err.println(sq.getSequenceAsString()); - System.err.println(testSeq); - failedFiles.add(pdbStr); - } + System.err.println(sq.getSequenceAsString()); + System.err.println(testSeq); + failedFiles.add(pdbStr); + } ++totalSeqScanned; } catch (Exception e) { diff --git a/test/jalview/ext/so/SequenceOntologyTest.java b/test/jalview/ext/so/SequenceOntologyTest.java index ea92e3c..720edf6 100644 --- a/test/jalview/ext/so/SequenceOntologyTest.java +++ b/test/jalview/ext/so/SequenceOntologyTest.java @@ -13,7 +13,8 @@ public class SequenceOntologyTest private SequenceOntologyI so; @BeforeClass(alwaysRun = true) - public void setUp() { + public void setUp() + { long now = System.currentTimeMillis(); try { diff --git a/test/jalview/fts/core/FTSRestClientTest.java b/test/jalview/fts/core/FTSRestClientTest.java index eae5575..3f03a76 100644 --- a/test/jalview/fts/core/FTSRestClientTest.java +++ b/test/jalview/fts/core/FTSRestClientTest.java @@ -61,11 +61,12 @@ public class FTSRestClientTest @Test(groups = { "Functional" }) public void getAllDefaulDisplayedDataColumns() { - Assert.assertNotNull(ftsRestClient.getAllDefaultDisplayedFTSDataColumns()); + Assert.assertNotNull(ftsRestClient + .getAllDefaultDisplayedFTSDataColumns()); Assert.assertTrue(!ftsRestClient.getAllDefaultDisplayedFTSDataColumns() .isEmpty()); - Assert.assertEquals(ftsRestClient.getAllDefaultDisplayedFTSDataColumns() - .size(), 7); + Assert.assertEquals(ftsRestClient + .getAllDefaultDisplayedFTSDataColumns().size(), 7); } @Test(groups = { "Functional" }) @@ -79,7 +80,6 @@ public class FTSRestClientTest "id,entry name,protein names,genes,organism,reviewed,length"); } - @Test(groups = { "Functional" }) public void getAllFTSDataColumns() { diff --git a/test/jalview/fts/service/pdb/PDBFTSRestClientTest.java b/test/jalview/fts/service/pdb/PDBFTSRestClientTest.java index ed248bb..8faec58 100644 --- a/test/jalview/fts/service/pdb/PDBFTSRestClientTest.java +++ b/test/jalview/fts/service/pdb/PDBFTSRestClientTest.java @@ -72,13 +72,11 @@ public class PDBFTSRestClientTest { wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("molecule_type")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("pdb_id")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("genus")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("gene_name")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("title")); @@ -117,13 +115,11 @@ public class PDBFTSRestClientTest { wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("molecule_type")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("pdb_id")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("genus")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("gene_name")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("title")); @@ -147,13 +143,11 @@ public class PDBFTSRestClientTest { wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("molecule_type")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("pdb_id")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("genus")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("gene_name")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("title")); @@ -190,9 +184,7 @@ public class PDBFTSRestClientTest assertEquals(expectedErrorMsg, parsedErrorResponse); } - @Test( - groups = { "External" }, - expectedExceptions = Exception.class) + @Test(groups = { "External" }, expectedExceptions = Exception.class) public void testForExpectedRuntimeException() throws Exception { List wantedFields = new ArrayList(); @@ -206,7 +198,7 @@ public class PDBFTSRestClientTest PDBFTSRestClient.getInstance().executeRequest(request); } - // JBP: Is this actually external ? Looks like it is mocked + // JBP: Is this actually external ? Looks like it is mocked @Test(groups = { "External" }) public void parsePDBJsonResponseTest() { @@ -215,13 +207,11 @@ public class PDBFTSRestClientTest { wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("molecule_type")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("pdb_id")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("genus")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("gene_name")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("title")); @@ -259,13 +249,11 @@ public class PDBFTSRestClientTest .getDataColumnByNameOrCode("molecule_type")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("genus")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("gene_name")); wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("title")); - wantedFields -.add(PDBFTSRestClient.getInstance() + wantedFields.add(PDBFTSRestClient.getInstance() .getDataColumnByNameOrCode("pdb_id")); } catch (Exception e) { @@ -273,11 +261,9 @@ public class PDBFTSRestClientTest } try { - assertEquals(5, - PDBFTSRestClient.getInstance() + assertEquals(5, PDBFTSRestClient.getInstance() .getPrimaryKeyColumIndex(wantedFields, true)); - assertEquals(4, - PDBFTSRestClient.getInstance() + assertEquals(4, PDBFTSRestClient.getInstance() .getPrimaryKeyColumIndex(wantedFields, false)); } catch (Exception e) { diff --git a/test/jalview/gui/AlignFrameTest.java b/test/jalview/gui/AlignFrameTest.java index 80e3d5a..244fa0b 100644 --- a/test/jalview/gui/AlignFrameTest.java +++ b/test/jalview/gui/AlignFrameTest.java @@ -60,8 +60,7 @@ public class AlignFrameTest * [1-3], [6-8] base zero */ assertTrue(af.hideFeatureColumns("Turn", true)); - hidden = af.getViewport().getColumnSelection() - .getHiddenColumns(); + hidden = af.getViewport().getColumnSelection().getHiddenColumns(); assertEquals(2, hidden.size()); assertEquals(1, hidden.get(0)[0]); assertEquals(3, hidden.get(0)[1]); diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index bbad963..341a814 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -300,7 +300,7 @@ public class AlignViewportTest assertTrue(ssmMappings.contains(acf2)); assertFalse(ssmMappings.contains(acf3)); } - + /** * Test for JAL-1306 - conservation thread should run even when only Quality * (and not Conservation) is enabled in Preferences @@ -318,7 +318,8 @@ public class AlignViewportTest Boolean.FALSE.toString()); AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( "examples/uniref50.fa", FormatAdapter.FILE); - AlignmentAnnotation[] anns = af.viewport.getAlignment().getAlignmentAnnotation(); + AlignmentAnnotation[] anns = af.viewport.getAlignment() + .getAlignmentAnnotation(); assertNotNull("No annotations found", anns); assertEquals("More than one annotation found", 1, anns.length); assertTrue("Annotation is not Quality", diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index fd989ad..b8c12c6 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -85,8 +85,8 @@ public class AnnotatedPDBFileInputTest { for (int q = p + 1; q < avec.length; q++) { - assertTrue("Found a duplicate annotation row " - + avec[p].label, avec[p] != avec[q]); + assertTrue("Found a duplicate annotation row " + avec[p].label, + avec[p] != avec[q]); } } } @@ -104,7 +104,7 @@ public class AnnotatedPDBFileInputTest if (StructureImportSettings.getDefaultPDBFileParser().equals( StructureParser.JALVIEW_PARSER)) { - assertTrue(MCview.PDBfile.isCalcIdForFile(aa, pdbId)); + assertTrue(MCview.PDBfile.isCalcIdForFile(aa, pdbId)); } } } diff --git a/test/jalview/io/CrossRef2xmlTests.java b/test/jalview/io/CrossRef2xmlTests.java index 2063c88..c55ddd9 100644 --- a/test/jalview/io/CrossRef2xmlTests.java +++ b/test/jalview/io/CrossRef2xmlTests.java @@ -168,7 +168,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase // perform crossref action, or retrieve stored project List cra_views = new ArrayList(); CrossRefAction cra = null; - + if (pass2 == 0) { // retrieve and show cross-refs in this thread cra = new CrossRefAction(af, seqs, dna, db); @@ -248,7 +248,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase : new CrossRef(xrseqs, dataset) .findXrefSourcesForSequences(avp .getAlignViewport().isNucleotide()); - + stringify(dbtoviewBit, savedProjects, nextxref, avp); xrptypes.put(nextxref, _xrptypes); @@ -266,8 +266,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase { List cra_views2 = new ArrayList(); int q = 0; - String nextnextxref = nextxref - + " -> " + xrefdb + "{" + q + "}"; + String nextnextxref = nextxref + " -> " + xrefdb + "{" + + q + "}"; if (pass3 == 0) { @@ -284,8 +284,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase { failedXrefMenuItems .add("No crossrefs retrieved for '" - + nextxref + "' to " + xrefdb + " via '" - + nextaf.getTitle() + "'"); + + nextxref + "' to " + xrefdb + + " via '" + nextaf.getTitle() + "'"); continue; } cra_views2 = cra.getXrefViews(); @@ -345,8 +345,8 @@ public class CrossRef2xmlTests extends Jalview2xmlBase for (AlignmentViewPanel nextavp : cra_views2) { - nextnextxref = nextxref - + " -> " + xrefdb + "{" + q++ + "}"; + nextnextxref = nextxref + " -> " + xrefdb + "{" + q++ + + "}"; // verify references for this panel AlignmentTest.assertAlignmentDatasetRefs( @@ -471,8 +471,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase { List nonType = new ArrayList(); for (SequenceI sq : alignmentViewPanel.getAlignViewport() - .getAlignment() - .getSequences()) + .getAlignment().getSequences()) { if (sq.isProtein() != expectProtein) { @@ -483,8 +482,7 @@ public class CrossRef2xmlTests extends Jalview2xmlBase { Assert.fail(message + " [ " + (expectProtein ? "nucleotides were " : "proteins were ") - + nonType.toString() - + " ]"); + + nonType.toString() + " ]"); } } diff --git a/test/jalview/io/FeaturesFileTest.java b/test/jalview/io/FeaturesFileTest.java index 2f5d0c5..602ce9f 100644 --- a/test/jalview/io/FeaturesFileTest.java +++ b/test/jalview/io/FeaturesFileTest.java @@ -153,7 +153,8 @@ public class FeaturesFileTest Map colours = af.getFeatureRenderer() .getFeatureColours(); // GFF2 uses space as name/value separator in column 9 - String gffData = "METAL\tcc9900\n" + "GFF\n" + String gffData = "METAL\tcc9900\n" + + "GFF\n" + "FER_CAPAA\tuniprot\tMETAL\t44\t45\t4.0\t.\t.\tNote Iron-sulfur; Note 2Fe-2S\n" + "FER1_SOLLC\tuniprot\tPfam\t55\t130\t2.0\t.\t."; FeaturesFile featuresFile = new FeaturesFile(gffData, @@ -304,7 +305,7 @@ public class FeaturesFileTest { assertEquals("no sequences extracted from GFF3 file", 2, dataset.getHeight()); - + SequenceI seq1 = dataset.findName("seq1"); SequenceI seq2 = dataset.findName("seq2"); assertNotNull(seq1); @@ -335,7 +336,7 @@ public class FeaturesFileTest "Expected at least one CDNA/Protein mapping for seq1", dataset.getCodonFrame(seq1) != null && dataset.getCodonFrame(seq1).size() > 0); - + } @Test(groups = { "Functional" }) @@ -352,9 +353,8 @@ public class FeaturesFileTest public void simpleGff3FileClass() throws IOException { AlignmentI dataset = new Alignment(new SequenceI[] {}); - FeaturesFile ffile = new FeaturesFile(simpleGffFile, - FormatAdapter.FILE); - + FeaturesFile ffile = new FeaturesFile(simpleGffFile, FormatAdapter.FILE); + boolean parseResult = ffile.parse(dataset, null, false, false); assertTrue("return result should be true", parseResult); checkDatasetfromSimpleGff3(dataset); @@ -375,9 +375,8 @@ public class FeaturesFileTest public void simpleGff3RelaxedIdMatching() throws IOException { AlignmentI dataset = new Alignment(new SequenceI[] {}); - FeaturesFile ffile = new FeaturesFile(simpleGffFile, - FormatAdapter.FILE); - + FeaturesFile ffile = new FeaturesFile(simpleGffFile, FormatAdapter.FILE); + boolean parseResult = ffile.parse(dataset, null, false, true); assertTrue("return result (relaxedID matching) should be true", parseResult); @@ -408,8 +407,7 @@ public class FeaturesFileTest * first with no features displayed */ FeatureRenderer fr = af.alignPanel.getFeatureRenderer(); - Map visible = fr - .getDisplayedFeatureCols(); + Map visible = fr.getDisplayedFeatureCols(); String exported = featuresFile.printJalviewFormat( al.getSequencesArray(), visible); String expected = "No Features Visible"; diff --git a/test/jalview/io/FormatAdapterTest.java b/test/jalview/io/FormatAdapterTest.java index 81e336e..4cd9651 100644 --- a/test/jalview/io/FormatAdapterTest.java +++ b/test/jalview/io/FormatAdapterTest.java @@ -58,9 +58,8 @@ public class FormatAdapterTest */ sequenceString = adjustForGapTreatment(sequenceString, gap, format); assertEquals( - String.format("Sequence %d: %s", i, - seqs[i].getName()), seqs[i].getSequenceAsString(), - sequenceString); + String.format("Sequence %d: %s", i, seqs[i].getName()), + seqs[i].getSequenceAsString(), sequenceString); i++; } } catch (IOException e) diff --git a/test/jalview/io/SequenceAnnotationReportTest.java b/test/jalview/io/SequenceAnnotationReportTest.java index f551571..07ae0ab 100644 --- a/test/jalview/io/SequenceAnnotationReportTest.java +++ b/test/jalview/io/SequenceAnnotationReportTest.java @@ -44,7 +44,7 @@ public class SequenceAnnotationReportTest SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3, Float.NaN, "group"); sf.setStatus("Confirmed"); - + sar.appendFeature(sb, 1, null, sf); assertEquals("METAL 1 3; Fe2-S; (Confirmed)", sb.toString()); } @@ -89,7 +89,7 @@ public class SequenceAnnotationReportTest StringBuffer sb = new StringBuffer(); SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3, Float.NaN, "group"); - + sar.appendFeature(sb, 1, null, sf); assertEquals("METAL 1 3; Fe2-S", sb.toString()); } @@ -102,7 +102,7 @@ public class SequenceAnnotationReportTest SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3, Float.NaN, "group"); sf.setValue("clinical_significance", "Benign"); - + sar.appendFeature(sb, 1, null, sf); assertEquals("METAL 1 3; Fe2-S; Benign", sb.toString()); } @@ -131,7 +131,7 @@ public class SequenceAnnotationReportTest StringBuffer sb = new StringBuffer(); SequenceFeature sf = new SequenceFeature("METAL", "METAL", 1, 3, Float.NaN, "group"); - + // description is not included if it duplicates type: sar.appendFeature(sb, 1, null, sf); assertEquals("METAL 1 3", sb.toString()); @@ -151,11 +151,10 @@ public class SequenceAnnotationReportTest SequenceFeature sf = new SequenceFeature("METAL", "helloworld", 1, 3, Float.NaN, "group"); - + sar.appendFeature(sb, 1, null, sf); // !! strips off but not ?? - assertEquals("METAL 1 3; helloworld", - sb.toString()); + assertEquals("METAL 1 3; helloworld", sb.toString()); sb.setLength(0); sf.setDescription("
&kHD>6"); diff --git a/test/jalview/io/StockholmFileTest.java b/test/jalview/io/StockholmFileTest.java index b635aa3..035f484 100644 --- a/test/jalview/io/StockholmFileTest.java +++ b/test/jalview/io/StockholmFileTest.java @@ -281,8 +281,7 @@ public class StockholmFileTest assertEquals("different number of features", seq_original[i].getSequenceFeatures().length, - seq_new[in] - .getSequenceFeatures().length); + seq_new[in].getSequenceFeatures().length); for (int feat = 0; feat < seq_original[i].getSequenceFeatures().length; feat++) { diff --git a/test/jalview/io/gff/ExonerateHelperTest.java b/test/jalview/io/gff/ExonerateHelperTest.java index 54d6eb2..ce52ee5 100644 --- a/test/jalview/io/gff/ExonerateHelperTest.java +++ b/test/jalview/io/gff/ExonerateHelperTest.java @@ -238,20 +238,19 @@ public class ExonerateHelperTest { FileLoader loader = new FileLoader(false); AlignFrame af = loader.LoadFileWaitTillLoaded( - "examples/testdata/exonerateseqs.fa", - FormatAdapter.FILE); - + "examples/testdata/exonerateseqs.fa", FormatAdapter.FILE); + af.loadJalviewDataFile("examples/testdata/exonerateoutput.gff", FormatAdapter.FILE, null, null); - + /* * verify one mapping to a dummy sequence, one to a real one */ - List mappings = af - .getViewport().getAlignment().getDataset().getCodonFrames(); + List mappings = af.getViewport().getAlignment() + .getDataset().getCodonFrames(); assertEquals(2, mappings.size()); Iterator iter = mappings.iterator(); - + // first mapping is to dummy sequence AlignedCodonFrame mapping = iter.next(); Mapping[] mapList = mapping.getProtMappings(); @@ -262,7 +261,7 @@ public class ExonerateHelperTest // 143 in protein should map to codon [11270, 11269, 11268] in dna int[] mappedRegion = mapList[0].getMap().locateInFrom(143, 143); assertArrayEquals(new int[] { 11270, 11268 }, mappedRegion); - + // second mapping is to a sequence in the alignment mapping = iter.next(); mapList = mapping.getProtMappings(); @@ -271,23 +270,23 @@ public class ExonerateHelperTest .findName("DDB_G0280897"); assertSame(proteinSeq.getDatasetSequence(), mapList[0].getTo()); assertEquals(1, mapping.getdnaToProt().length); - + // 143 in protein should map to codon [11270, 11269, 11268] in dna mappedRegion = mapList[0].getMap().locateInFrom(143, 143); assertArrayEquals(new int[] { 11270, 11268 }, mappedRegion); - + // 182 in protein should map to codon [11153, 11152, 11151] in dna mappedRegion = mapList[0].getMap().locateInFrom(182, 182); assertArrayEquals(new int[] { 11153, 11151 }, mappedRegion); - + // and the reverse mapping: mappedRegion = mapList[0].getMap().locateInTo(11151, 11153); assertArrayEquals(new int[] { 182, 182 }, mappedRegion); - + // 11150 in dna should _not_ map to protein mappedRegion = mapList[0].getMap().locateInTo(11150, 11150); assertNull(mappedRegion); - + // similarly 183 in protein should _not_ map to dna mappedRegion = mapList[0].getMap().locateInFrom(183, 183); assertNull(mappedRegion); diff --git a/test/jalview/io/gff/Gff3HelperTest.java b/test/jalview/io/gff/Gff3HelperTest.java index 420b032..3b6930f 100644 --- a/test/jalview/io/gff/Gff3HelperTest.java +++ b/test/jalview/io/gff/Gff3HelperTest.java @@ -161,7 +161,7 @@ public class Gff3HelperTest "GAATTCGTTCATGTAGGTTGATTTTTATT"); seq.createDatasetSequence(); AlignmentI align = new Alignment(new SequenceI[] {}); - + // mapping from gi|68711 12923-13060 to gi|N37351 1-138 String[] gff = "gi|68711\tblat-pasa\tcDNA_match\t12923\t13060\t98.55\t+\t.\tID=align_68;Target=gi|N37351 1 138 +" .split("\\t"); @@ -179,7 +179,7 @@ public class Gff3HelperTest // (this is important for 'align cdna to genome' to work correctly) assertEquals(1, align.getCodonFrames().size()); AlignedCodonFrame mapping = align.getCodonFrames().get(0); - + /* * 'dnaseqs' (map from) is here [gi|68711] * 'aaseqs' (map to) is here [gi|N37351] @@ -192,8 +192,7 @@ public class Gff3HelperTest assertEquals(1, mapping.getdnaToProt().length); assertEquals(2, mapping.getdnaToProt()[0].getFromRanges().size()); // the two spliced dna ranges are combined in one MapList - assertArrayEquals(new int[] { 12923, 13060 }, - mapping.getdnaToProt()[0] + assertArrayEquals(new int[] { 12923, 13060 }, mapping.getdnaToProt()[0] .getFromRanges().get(0)); assertArrayEquals(new int[] { 13411, 13550 }, mapping.getdnaToProt()[0] .getFromRanges().get(1)); diff --git a/test/jalview/io/gff/InterProScanHelperTest.java b/test/jalview/io/gff/InterProScanHelperTest.java index 2ef4c99..d118f67 100644 --- a/test/jalview/io/gff/InterProScanHelperTest.java +++ b/test/jalview/io/gff/InterProScanHelperTest.java @@ -38,7 +38,7 @@ public class InterProScanHelperTest seq.createDatasetSequence(); AlignmentI align = new Alignment(new SequenceI[] {}); Map> set = Gff3Helper.parseNameValuePairs(gff[8]); - + /* * this should create a mapping from Prot1/5-30 to virtual sequence * match$17_5_30 (added to newseqs) positions 1-26 diff --git a/test/jalview/schemes/FeatureColourTest.java b/test/jalview/schemes/FeatureColourTest.java index e13f542..9d9d996 100644 --- a/test/jalview/schemes/FeatureColourTest.java +++ b/test/jalview/schemes/FeatureColourTest.java @@ -123,7 +123,8 @@ public class FeatureColourTest @Test(groups = { "Functional" }) public void testGetColor_Graduated() { - // graduated colour from score 0 to 100, gray(128, 128, 128) to red(255, 0, 0) + // graduated colour from score 0 to 100, gray(128, 128, 128) to red(255, 0, + // 0) FeatureColour fc = new FeatureColour(Color.GRAY, Color.RED, 0f, 100f); // feature score is 75 which is 3/4 of the way from GRAY to RED SequenceFeature sf = new SequenceFeature("type", "desc", 0, 20, 75f, @@ -166,7 +167,7 @@ public class FeatureColourTest String redHex = Format.getHexString(Color.RED); String hexColour = redHex; assertEquals("domain\t" + hexColour, fc.toJalviewFormat("domain")); - + /* * colour by label (no threshold) */ diff --git a/test/jalview/schemes/UserColourSchemeTest.java b/test/jalview/schemes/UserColourSchemeTest.java index e524cb4..f3f72f6 100644 --- a/test/jalview/schemes/UserColourSchemeTest.java +++ b/test/jalview/schemes/UserColourSchemeTest.java @@ -7,6 +7,7 @@ import static org.testng.AssertJUnit.assertSame; import java.awt.Color; import org.testng.annotations.Test; + public class UserColourSchemeTest { diff --git a/test/jalview/structure/Mapping.java b/test/jalview/structure/Mapping.java index 5ab43b5..9ec3a92 100644 --- a/test/jalview/structure/Mapping.java +++ b/test/jalview/structure/Mapping.java @@ -138,8 +138,8 @@ public class Mapping // Associate the 1GAQ pdb file with the subsequence 'imported' from another // source StructureFile pde = ssm.setMapping(true, new SequenceI[] { sq }, - new String[] - { "A" }, inFile = "examples/1gaq.txt", jalview.io.FormatAdapter.FILE); + 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); assertTrue("No mappings made.", mp != null && mp.length > 0); diff --git a/test/jalview/util/ArrayUtilsTest.java b/test/jalview/util/ArrayUtilsTest.java index 5a2674a..2580cab 100644 --- a/test/jalview/util/ArrayUtilsTest.java +++ b/test/jalview/util/ArrayUtilsTest.java @@ -8,8 +8,9 @@ import org.testng.annotations.Test; public class ArrayUtilsTest { - @Test(groups="Functional") - public void testReverseIntArray() { + @Test(groups = "Functional") + public void testReverseIntArray() + { // null value: should be no exception ArrayUtils.reverseIntArray((int[]) null); diff --git a/test/jalview/util/ColorUtilsTest.java b/test/jalview/util/ColorUtilsTest.java index a82b9c0..69675f7 100644 --- a/test/jalview/util/ColorUtilsTest.java +++ b/test/jalview/util/ColorUtilsTest.java @@ -122,8 +122,7 @@ public class ColorUtilsTest * value > max */ col = ColorUtils - .getGraduatedColour(40f, 10f, minColour, 30f, - maxColour); + .getGraduatedColour(40f, 10f, minColour, 30f, maxColour); assertEquals(maxColour, col); /* diff --git a/test/jalview/util/DBRefUtilsTest.java b/test/jalview/util/DBRefUtilsTest.java index 5e0683e..d1c24d1 100644 --- a/test/jalview/util/DBRefUtilsTest.java +++ b/test/jalview/util/DBRefUtilsTest.java @@ -197,8 +197,7 @@ public class DBRefUtilsTest 1 }, 1, 1))); List matches = DBRefUtils.searchRefs(new DBRefEntry[] { - ref1, - ref2, ref3, ref4, ref5 }, target); + ref1, ref2, ref3, ref4, ref5 }, target); assertEquals(3, matches.size()); assertSame(ref1, matches.get(0)); assertSame(ref2, matches.get(1)); @@ -231,8 +230,7 @@ public class DBRefUtilsTest ref3.setMap(map3); List matches = DBRefUtils.searchRefs(new DBRefEntry[] { - ref1, - ref2, ref3 }, target); + ref1, ref2, ref3 }, target); assertEquals(2, matches.size()); assertSame(ref1, matches.get(0)); assertSame(ref2, matches.get(1)); @@ -245,7 +243,7 @@ public class DBRefUtilsTest @Test(groups = { "Functional" }) public void testSearchRefs_accessionid() { - + DBRefEntry ref1 = new DBRefEntry("Uniprot", "1", "A1234"); // matches DBRefEntry ref2 = new DBRefEntry("embl", "1", "A1234"); // matches // constructor does not upper-case accession id @@ -255,9 +253,8 @@ public class DBRefUtilsTest DBRefEntry ref5 = new DBRefEntry("EMBL", "1", "A1234"); ref5.setMap(new Mapping(new MapList(new int[] { 1, 1 }, new int[] { 1, 1 }, 1, 1))); - - DBRefEntry[] dbrefs = new DBRefEntry[] { ref1, - ref2, ref3, ref4, ref5 }; + + DBRefEntry[] dbrefs = new DBRefEntry[] { ref1, ref2, ref3, ref4, ref5 }; List matches = DBRefUtils.searchRefs(dbrefs, "A1234"); assertEquals(3, matches.size()); assertSame(ref1, matches.get(0)); @@ -273,7 +270,7 @@ public class DBRefUtilsTest public void testSearchRefs_wildcardAccessionid() { DBRefEntry target = new DBRefEntry("EMBL", "2", null); - + DBRefEntry ref1 = new DBRefEntry("EMBL", "1", "A1234"); // matches // constructor changes embl to EMBL DBRefEntry ref2 = new DBRefEntry("embl", "1", "A1235"); // matches @@ -284,10 +281,9 @@ public class DBRefUtilsTest DBRefEntry ref5 = new DBRefEntry("EMBL", "1", "A1237"); ref5.setMap(new Mapping(new MapList(new int[] { 1, 1 }, new int[] { 1, 1 }, 1, 1))); - + List matches = DBRefUtils.searchRefs(new DBRefEntry[] { - ref1, - ref2, ref3, ref4, ref5 }, target); + ref1, ref2, ref3, ref4, ref5 }, target); assertEquals(4, matches.size()); assertSame(ref1, matches.get(0)); assertSame(ref2, matches.get(1)); diff --git a/test/jalview/util/MapListTest.java b/test/jalview/util/MapListTest.java index ba298c5..9a0bdd7 100644 --- a/test/jalview/util/MapListTest.java +++ b/test/jalview/util/MapListTest.java @@ -535,8 +535,7 @@ public class MapListTest MapList ml = new MapList(new int[] { 1, 5, 10, 15, 25, 20 }, new int[] { 51, 1 }, 1, 3); String s = ml.toString(); - assertEquals("[ [1, 5] [10, 15] [25, 20] ] 1:3 to [ [51, 1] ]", - s); + assertEquals("[ [1, 5] [10, 15] [25, 20] ] 1:3 to [ [51, 1] ]", s); } @Test(groups = { "Functional" }) @@ -671,8 +670,8 @@ public class MapListTest public void testIsFromForwardStrand() { // [3-9] declares forward strand - MapList ml = new MapList(new int[] { 2, 2, 3, 9, 12, 11 }, - new int[] { 20, 11 }, 1, 1); + MapList ml = new MapList(new int[] { 2, 2, 3, 9, 12, 11 }, new int[] { + 20, 11 }, 1, 1); assertTrue(ml.isFromForwardStrand()); // [11-5] declares reverse strand ([13-14] is ignored) diff --git a/test/jalview/util/MappingUtilsTest.java b/test/jalview/util/MappingUtilsTest.java index d131ed2..655aa2a 100644 --- a/test/jalview/util/MappingUtilsTest.java +++ b/test/jalview/util/MappingUtilsTest.java @@ -867,7 +867,7 @@ public class MappingUtilsTest public void testMapColumnSelection_hiddenColumns() throws IOException { setupMappedAlignments(); - + ColumnSelection proteinSelection = new ColumnSelection(); /* @@ -875,8 +875,8 @@ public class MappingUtilsTest * in dna respectively, overall 0-4 */ proteinSelection.hideColumns(0); - ColumnSelection dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, - proteinView, dnaView); + ColumnSelection dnaSelection = MappingUtils.mapColumnSelection( + proteinSelection, proteinView, dnaView); assertEquals("[]", dnaSelection.getSelected().toString()); List hidden = dnaSelection.getHiddenColumns(); assertEquals(1, hidden.size()); @@ -891,7 +891,8 @@ public class MappingUtilsTest // deselect these or hideColumns will be expanded to include 0 proteinSelection.clear(); proteinSelection.hideColumns(1); - dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, proteinView, dnaView); + dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, + proteinView, dnaView); hidden = dnaSelection.getHiddenColumns(); assertEquals(1, hidden.size()); assertEquals("[0, 3]", Arrays.toString(hidden.get(0))); @@ -902,7 +903,8 @@ public class MappingUtilsTest proteinSelection.revealAllHiddenColumns(); proteinSelection.clear(); proteinSelection.hideColumns(2); - dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, proteinView, dnaView); + dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, + proteinView, dnaView); assertTrue(dnaSelection.getHiddenColumns().isEmpty()); /* @@ -913,7 +915,8 @@ public class MappingUtilsTest proteinSelection.clear(); proteinSelection.hideColumns(3); // 5-10 hidden in dna proteinSelection.addElement(1); // 0-3 selected in dna - dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, proteinView, dnaView); + dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, + proteinView, dnaView); assertEquals("[0, 1, 2, 3]", dnaSelection.getSelected().toString()); hidden = dnaSelection.getHiddenColumns(); assertEquals(1, hidden.size()); @@ -926,7 +929,8 @@ public class MappingUtilsTest proteinSelection.clear(); proteinSelection.hideColumns(1); proteinSelection.hideColumns(3); - dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, proteinView, dnaView); + dnaSelection = MappingUtils.mapColumnSelection(proteinSelection, + proteinView, dnaView); hidden = dnaSelection.getHiddenColumns(); assertEquals(2, hidden.size()); assertEquals("[0, 3]", Arrays.toString(hidden.get(0))); @@ -1060,42 +1064,42 @@ public class MappingUtilsTest int[] adjusted = MappingUtils.removeStartPositions(0, ranges); assertEquals("[10, 1]", Arrays.toString(adjusted)); assertEquals("[10, 1]", Arrays.toString(ranges)); - + ranges = adjusted; adjusted = MappingUtils.removeStartPositions(1, ranges); assertEquals("[9, 1]", Arrays.toString(adjusted)); assertEquals("[10, 1]", Arrays.toString(ranges)); - + ranges = adjusted; adjusted = MappingUtils.removeStartPositions(1, ranges); assertEquals("[8, 1]", Arrays.toString(adjusted)); assertEquals("[9, 1]", Arrays.toString(ranges)); - + ranges = new int[] { 12, 11, 9, 6 }; adjusted = MappingUtils.removeStartPositions(1, ranges); assertEquals("[11, 11, 9, 6]", Arrays.toString(adjusted)); assertEquals("[12, 11, 9, 6]", Arrays.toString(ranges)); - + ranges = new int[] { 12, 12, 8, 4 }; adjusted = MappingUtils.removeStartPositions(1, ranges); assertEquals("[8, 4]", Arrays.toString(adjusted)); assertEquals("[12, 12, 8, 4]", Arrays.toString(ranges)); - + ranges = new int[] { 12, 12, 8, 4 }; adjusted = MappingUtils.removeStartPositions(2, ranges); assertEquals("[7, 4]", Arrays.toString(adjusted)); assertEquals("[12, 12, 8, 4]", Arrays.toString(ranges)); - + ranges = new int[] { 12, 12, 10, 10, 8, 4 }; adjusted = MappingUtils.removeStartPositions(1, ranges); assertEquals("[10, 10, 8, 4]", Arrays.toString(adjusted)); assertEquals("[12, 12, 10, 10, 8, 4]", Arrays.toString(ranges)); - + ranges = new int[] { 12, 12, 10, 10, 8, 4 }; adjusted = MappingUtils.removeStartPositions(2, ranges); assertEquals("[8, 4]", Arrays.toString(adjusted)); assertEquals("[12, 12, 10, 10, 8, 4]", Arrays.toString(ranges)); - + ranges = new int[] { 12, 11, 8, 4 }; adjusted = MappingUtils.removeStartPositions(3, ranges); assertEquals("[7, 4]", Arrays.toString(adjusted)); diff --git a/test/jalview/util/QuickSortTest.java b/test/jalview/util/QuickSortTest.java index 54e46a0..f976955 100644 --- a/test/jalview/util/QuickSortTest.java +++ b/test/jalview/util/QuickSortTest.java @@ -110,8 +110,7 @@ public class QuickSortTest "ALISON" }; QuickSort.sort(values, things); assertTrue(Arrays.equals(new String[] { "lucy", "henry", "henry", - "JOHN", - "ALISON" }, values)); + "JOHN", "ALISON" }, values)); assertTrue(Arrays.equals(new Object[] { c3, c2, c4, c1, c5 }, things)); } diff --git a/test/jalview/workers/AlignCalcManagerTest.java b/test/jalview/workers/AlignCalcManagerTest.java index 735c75d..73247ef 100644 --- a/test/jalview/workers/AlignCalcManagerTest.java +++ b/test/jalview/workers/AlignCalcManagerTest.java @@ -35,11 +35,9 @@ public class AlignCalcManagerTest { AlignCalcManagerI acm = alignFrame.getViewport().getCalcManager(); final AlignmentAnnotation ann1 = new AlignmentAnnotation("Ann1", - "desc", - new Annotation[] {}); + "desc", new Annotation[] {}); final AlignmentAnnotation ann2 = new AlignmentAnnotation("Ann2", - "desc", - new Annotation[] {}); + "desc", new Annotation[] {}); /* * make two workers for ann1, one deletable, one not @@ -68,7 +66,8 @@ public class AlignCalcManagerTest } } - List workers = acm.getRegisteredWorkersOfClass(worker1.getClass()); + List workers = acm + .getRegisteredWorkersOfClass(worker1.getClass()); assertEquals(2, workers.size()); assertTrue(workers.contains(worker1)); assertTrue(workers.contains(worker2)); @@ -119,8 +118,7 @@ public class AlignCalcManagerTest } }; return new AnnotationWorker(alignFrame.getViewport(), - alignFrame.alignPanel, - annotationProvider) + alignFrame.alignPanel, annotationProvider) { @Override public boolean isDeletable() diff --git a/test/jalview/ws/PDBSequenceFetcherTest.java b/test/jalview/ws/PDBSequenceFetcherTest.java index 1401f6a..4b9437a 100644 --- a/test/jalview/ws/PDBSequenceFetcherTest.java +++ b/test/jalview/ws/PDBSequenceFetcherTest.java @@ -63,8 +63,7 @@ public class PDBSequenceFetcherTest @Test(groups = { "Network" }, enabled = true) public void testRnaSeqRetrieve() throws Exception { - Cache.applicationProperties.setProperty("PDB_DOWNLOAD_FORMAT", - "PDB"); + Cache.applicationProperties.setProperty("PDB_DOWNLOAD_FORMAT", "PDB"); List sps = sf.getSourceProxy("PDB"); AlignmentI response = sps.get(0).getSequenceRecords("2GIS"); assertTrue(response != null); diff --git a/test/jalview/ws/SequenceFetcherTest.java b/test/jalview/ws/SequenceFetcherTest.java index 94bf979..ce0926c 100644 --- a/test/jalview/ws/SequenceFetcherTest.java +++ b/test/jalview/ws/SequenceFetcherTest.java @@ -52,8 +52,7 @@ public class SequenceFetcherTest try { testRetrieval(argv[0], sp, - argv.length > 1 ? argv[1] : sp - .getTestQuery()); + argv.length > 1 ? argv[1] : sp.getTestQuery()); } catch (Exception e) { e.printStackTrace(); diff --git a/test/jalview/ws/dbsources/UniprotTest.java b/test/jalview/ws/dbsources/UniprotTest.java index 77f8078..57980b8 100644 --- a/test/jalview/ws/dbsources/UniprotTest.java +++ b/test/jalview/ws/dbsources/UniprotTest.java @@ -148,6 +148,7 @@ public class UniprotTest assertEquals(6, seq.getDBRefs().length); // 2*Uniprot, PDB, PDBsum, 2*EMBL } + /** * Test the method that formats the sequence id */ @@ -173,7 +174,7 @@ public class UniprotTest { UniprotEntry entry = new Uniprot().getUniprotEntries( new StringReader(UNIPROT_XML)).get(0); - + /* * recommended names concatenated with space separator */ diff --git a/test/jalview/ws/jabaws/RNAStructExportImport.java b/test/jalview/ws/jabaws/RNAStructExportImport.java index 2a111ee..7bb6bdd 100644 --- a/test/jalview/ws/jabaws/RNAStructExportImport.java +++ b/test/jalview/ws/jabaws/RNAStructExportImport.java @@ -236,8 +236,8 @@ public class RNAStructExportImport public void testRnaalifoldSettingsRecovery() { List opts = new ArrayList(); - for (Argument rg : (List) rnaalifoldws - .getRunnerConfig().getArguments()) + for (Argument rg : (List) rnaalifoldws.getRunnerConfig() + .getArguments()) { if (rg.getDescription().contains("emperature")) { diff --git a/test/jalview/ws/sifts/SiftsClientTest.java b/test/jalview/ws/sifts/SiftsClientTest.java index d3b485e..8d26c45 100644 --- a/test/jalview/ws/sifts/SiftsClientTest.java +++ b/test/jalview/ws/sifts/SiftsClientTest.java @@ -68,7 +68,7 @@ public class SiftsClientTest @BeforeTest(alwaysRun = true) public void populateExpectedMapping() throws SiftsException - { + { expectedMapping.put(51, new int[] { 1, 2 }); expectedMapping.put(52, new int[] { 2, 7 }); expectedMapping.put(53, new int[] { 3, 12 }); @@ -166,8 +166,8 @@ public class SiftsClientTest expectedMapping.put(145, new int[] { 95, 714 }); expectedMapping.put(146, new int[] { 96, 722 }); expectedMapping.put(147, new int[] { 97, 729 }); - } - + } + @BeforeTest(alwaysRun = true) public void setUpSiftsClient() throws SiftsException { @@ -236,7 +236,6 @@ public class SiftsClientTest } } - @Test(groups = { "Functional" }) public void getAllMappingAccessionTest() { @@ -260,8 +259,7 @@ public class SiftsClientTest try { HashMap actualMapping = siftsClient.getGreedyMapping( - "A", testSeq, - null); + "A", testSeq, null); Assert.assertEquals(testSeq.getStart(), 1); Assert.assertEquals(testSeq.getEnd(), 147); Assert.assertEquals(actualMapping, expectedMapping); @@ -306,7 +304,7 @@ public class SiftsClientTest private void populateAtomPositionsNullTest1() throws IllegalArgumentException, SiftsException { - siftsClient.populateAtomPositions(null, null); + siftsClient.populateAtomPositions(null, null); } @Test( @@ -340,7 +338,7 @@ public class SiftsClientTest expectedExceptions = SiftsException.class) public void getValidSourceDBRefExceptionTest() throws SiftsException { - SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH"); + SequenceI invalidTestSeq = new Sequence("testSeq", "ABCDEFGH"); try { siftsClient.getValidSourceDBRef(invalidTestSeq);