From: TZVanaalten Date: Mon, 21 Aug 2017 08:22:03 +0000 (+0100) Subject: JAL-2668 fix failing tests caused by HMMER-related functions X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ebcfd34054e1fb92a5fb8d1d7768239234a7a5a4;p=jalview.git JAL-2668 fix failing tests caused by HMMER-related functions --- diff --git a/test/jalview/io/FileFormatsTest.java b/test/jalview/io/FileFormatsTest.java index 7810504..724bae0 100644 --- a/test/jalview/io/FileFormatsTest.java +++ b/test/jalview/io/FileFormatsTest.java @@ -55,7 +55,7 @@ public class FileFormatsTest @Test(groups = "Functional") public void testGetReadableFormats() { - String expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview]"; + String expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, HMMER3]"; FileFormats formats = FileFormats.getInstance(); assertEquals(formats.getReadableFormats().toString(), expected); } @@ -63,25 +63,25 @@ public class FileFormatsTest @Test(groups = "Functional") public void testGetWritableFormats() { - String expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP]"; + String expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, HMMER3]"; FileFormats formats = FileFormats.getInstance(); assertEquals(formats.getWritableFormats(true).toString(), expected); - expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, Jalview]"; + expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, Jalview, HMMER3]"; assertEquals(formats.getWritableFormats(false).toString(), expected); } @Test(groups = "Functional") public void testDeregisterFileFormat() { - String writable = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP]"; - String readable = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview]"; + String writable = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, HMMER3]"; + String readable = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, HMMER3]"; FileFormats formats = FileFormats.getInstance(); assertEquals(formats.getWritableFormats(true).toString(), writable); assertEquals(formats.getReadableFormats().toString(), readable); formats.deregisterFileFormat(FileFormat.Fasta.getName()); - writable = "[PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP]"; - readable = "[PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview]"; + writable = "[PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, HMMER3]"; + readable = "[PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, HMMER3]"; assertEquals(formats.getWritableFormats(true).toString(), writable); assertEquals(formats.getReadableFormats().toString(), readable); @@ -89,8 +89,8 @@ public class FileFormatsTest * re-register the format: it gets added to the end of the list */ formats.registerFileFormat(FileFormat.Fasta); - writable = "[PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, Fasta]"; - readable = "[PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, Fasta]"; + writable = "[PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, HMMER3, Fasta]"; + readable = "[PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, HMMER3, Fasta]"; assertEquals(formats.getWritableFormats(true).toString(), writable); assertEquals(formats.getReadableFormats().toString(), readable); } diff --git a/test/jalview/io/FormatAdapterTest.java b/test/jalview/io/FormatAdapterTest.java index b500266..0d0b5c8 100644 --- a/test/jalview/io/FormatAdapterTest.java +++ b/test/jalview/io/FormatAdapterTest.java @@ -56,8 +56,17 @@ public class FormatAdapterTest { try { - AlignmentI al = new FormatAdapter().readFile("examples/uniref50.fa", + AlignmentI al; + if (format == FileFormat.HMMER3) + { + al = new FormatAdapter().readFile("examples/uniref50_hmm.hmm", + DataSourceType.FILE, FileFormat.HMMER3); + } + else + { + al = new FormatAdapter().readFile("examples/uniref50.fa", DataSourceType.FILE, FileFormat.Fasta); + } /* * 'gap' is the gap character used in the alignment data file here, @@ -73,8 +82,9 @@ public class FormatAdapterTest AlignmentI reloaded = new FormatAdapter().readFile(formatted, DataSourceType.PASTE, format); List reread = reloaded.getSequences(); - assertEquals("Wrong number of reloaded sequences", seqs.length, - reread.size()); + assertEquals("Wrong number of reloaded sequences", seqs.length, + reread.size()); + int i = 0; for (SequenceI seq : reread) @@ -131,7 +141,7 @@ public class FormatAdapterTest @DataProvider(name = "formats") static Object[][] getFormats() { - List both = new ArrayList(); + List both = new ArrayList<>(); for (FileFormatI format : FileFormats.getInstance().getFormats()) { if (format.isReadable() && format.isWritable() diff --git a/test/jalview/schemes/HMMERColourSchemeTest.java b/test/jalview/schemes/HMMERColourSchemeTest.java index b037d32..f411708 100644 --- a/test/jalview/schemes/HMMERColourSchemeTest.java +++ b/test/jalview/schemes/HMMERColourSchemeTest.java @@ -21,36 +21,31 @@ public class HMMERColourSchemeTest { HMMFile file = new HMMFile(new FileParse( "test/jalview/io/test_PKinase_hmm.txt", DataSourceType.FILE)); - file.parse(); + scheme.hmm = file.getHMM(); + Color expected; Color actual = scheme.findColour('A', 1, null, null, 0); - Color expected = new Color(1f, 1f - 0.06253430455f, 0f); - assertEquals(actual, expected); + assertEquals(actual, Color.ORANGE); actual = scheme.findColour('Y', 3, null, null, 0); - expected = new Color(1f, 1f - 0.02082023351f, 0f); - assertEquals(actual, expected); + assertEquals(actual, Color.ORANGE); actual = scheme.findColour('M', 109, null, null, 0); - expected = new Color(1f, 1f, 0); + expected = new Color(230, 0, 0); assertEquals(actual, expected); - actual = scheme.findColour('I', 128, null, null, 0); - expected = new Color(1f, 1f - 0.15097062462f, 0); + actual = scheme.findColour('I', 6, null, null, 0); + expected = new Color(171, 171, 255); assertEquals(actual, expected); - actual = scheme.findColour('D', 181, null, null, 0); - expected = new Color(1f, 1f - 0.08686935114f, 0); + actual = scheme.findColour('V', 14, null, null, 0); + expected = new Color(129, 129, 255); assertEquals(actual, expected); - actual = scheme.findColour('Z', 1, null, null, 0); - expected = new Color(1f, 1f, 0); - assertEquals(actual, expected); + actual = scheme.findColour('X', 100000000, null, null, 0); + assertEquals(actual, Color.WHITE); - actual = scheme.findColour('A', 4000, null, null, 0); - expected = new Color(1f, 1f, 0); - assertEquals(actual, expected); } diff --git a/test/jalview/util/HMMProbabilityDistributionAnalyserTest.java b/test/jalview/util/HMMProbabilityDistributionAnalyserTest.java index 3e775cc..9489efb 100644 --- a/test/jalview/util/HMMProbabilityDistributionAnalyserTest.java +++ b/test/jalview/util/HMMProbabilityDistributionAnalyserTest.java @@ -51,7 +51,7 @@ public class HMMProbabilityDistributionAnalyserTest { for (int i = 1; i < 9; i++) { HMMNode node = new HMMNode(); - node.setAlignmentColumn(i); + node.setAlignmentColumn(i - 1); nodes.add(node); }