From 76844c43faeeeba369deaf42f1998ca0fb33d956 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 5 Dec 2016 21:58:29 +0000 Subject: [PATCH] JAL-1950 update constants to DataSourceType and FileFormat enums. --- src/jalview/ws/ebi/hmmerClient.java | 7 ++++--- test/jalview/ws/ebi/HmmerJSONProcessTest.java | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/jalview/ws/ebi/hmmerClient.java b/src/jalview/ws/ebi/hmmerClient.java index 37e6775..41cd0d8 100644 --- a/src/jalview/ws/ebi/hmmerClient.java +++ b/src/jalview/ws/ebi/hmmerClient.java @@ -2,8 +2,9 @@ package jalview.ws.ebi; import jalview.datamodel.AlignmentI; import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; import jalview.io.FileParse; -import jalview.io.FormatAdapter; import java.io.File; import java.io.IOException; @@ -243,7 +244,7 @@ public class hmmerClient searchResult = new AppletFormatAdapter().readFile(baseUrl + "/download/" + jobid + "/score?format=afa&t=.gz", - FormatAdapter.URL, "FASTA"); + DataSourceType.URL, FileFormat.Fasta); // TODO extract gapped columns as '.' - inserts to query profile @@ -251,7 +252,7 @@ public class hmmerClient // do scores FileParse jsonsource = new FileParse(baseUrl + "/download/" + jobid - + "/score?format=json", FormatAdapter.URL); + + "/score?format=json", DataSourceType.URL); if (!jsonsource.isValid()) { throw new IOException("Couldn't access scores for Jackhammer results"); diff --git a/test/jalview/ws/ebi/HmmerJSONProcessTest.java b/test/jalview/ws/ebi/HmmerJSONProcessTest.java index efd33f0..bf68906 100644 --- a/test/jalview/ws/ebi/HmmerJSONProcessTest.java +++ b/test/jalview/ws/ebi/HmmerJSONProcessTest.java @@ -3,6 +3,8 @@ package jalview.ws.ebi; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; import jalview.io.FileParse; import jalview.io.FormatAdapter; @@ -20,8 +22,8 @@ public class HmmerJSONProcessTest { private AlignmentI getSearchResultFragmentAlignment() throws Exception { AlignmentI alf = new FormatAdapter().readFile( - alignmentFragFile.getAbsolutePath(), FormatAdapter.FILE, - "FASTA"); + alignmentFragFile.getAbsolutePath(), DataSourceType.FILE, + FileFormat.Fasta); return alf; } @@ -32,8 +34,8 @@ public class HmmerJSONProcessTest { private AlignmentI getSearchResultAlignment() throws Exception { AlignmentI alf = new FormatAdapter().readFile( - alignmentResultFile.getAbsolutePath(), FormatAdapter.FILE, - "FASTA"); + alignmentResultFile.getAbsolutePath(), DataSourceType.FILE, + FileFormat.Fasta); return alf; } @@ -52,7 +54,7 @@ public class HmmerJSONProcessTest { JSONParser jp = new JSONParser(); // read JSON in same way - via fileparse Object hitfragment = jp.parse(new FileParse(hitTestFile, - FormatAdapter.FILE).getReader()); + DataSourceType.FILE).getReader()); Assert.assertTrue((hitfragment instanceof JSONObject), "Didn't find a JSON object map in " + hitTestFile); AlignmentI searchResult = getSearchResultFragmentAlignment(); @@ -79,7 +81,7 @@ public class HmmerJSONProcessTest { "Didn't read search result alignment from " + alignmentFragFile); HmmerJSONProcessor hjsp = new HmmerJSONProcessor(searchResult); - hjsp.parseFrom(new FileParse(hmmerResultFile, FormatAdapter.FILE)); + hjsp.parseFrom(new FileParse(hmmerResultFile, DataSourceType.FILE)); AlignmentAnnotation[] aa = searchResult.getSequenceAt(5) .getAnnotation(); Assert.assertNotNull(aa); -- 1.7.10.2