import java.util.List;\r
import java.util.Map;\r
import java.util.Scanner;\r
-import java.util.Set;\r
import java.util.SortedSet;\r
import java.util.TreeSet;\r
import java.util.logging.Level;\r
infasta.close();\r
return seqs;\r
}\r
- \r
+\r
private static float[] convertToNumber(String[] annotValues)\r
throws UnknownFileFormatException {\r
float[] annotation = new float[annotValues.length];\r
* @throws IOException\r
* @throws UnknownFileFormatException\r
*/\r
- public static Map<FastaSequence, Set<Score>> readDisembl(\r
+ public static HashMap<FastaSequence, HashSet<Score>> readDisembl(\r
final InputStream input) throws IOException,\r
UnknownFileFormatException {\r
Scanner scan = new Scanner(input);\r
+ " No such line was found!");\r
}\r
\r
- Map<FastaSequence, Set<Score>> results = new HashMap<FastaSequence, Set<Score>>();\r
+ HashMap<FastaSequence, HashSet<Score>> results = new HashMap<FastaSequence, HashSet<Score>>();\r
int seqCounter = 0;\r
while (scan.hasNext()) {\r
seqCounter++;\r
}\r
FastaSequence fs = new FastaSequence(sequenceName,\r
seqbuffer.toString());\r
- Set<Score> scores = new HashSet<Score>();\r
+ HashSet<Score> scores = new HashSet<Score>();\r
scores.add(new Score(DisemblResult.COILS, coils, coilsR));\r
scores.add(new Score(DisemblResult.HOTLOOPS, hotloops, rem465R));\r
scores.add(new Score(DisemblResult.REM465, rem, loopsR));\r
\r
scansingle.close();\r
}\r
-\r
+ scan.close();\r
input.close();\r
return results;\r
}\r
*/\r
private static SortedSet<Range> parseRanges(Enum resultType, String lines) {\r
SortedSet<Range> ranges = new TreeSet<Range>();\r
+\r
Scanner scan = new Scanner(lines);\r
\r
assert scan.hasNext();\r
- assert "#".equals(scan.next()); // pass delimiter #\r
+ String del = scan.next();\r
+ assert "#".equals(del); // pass delimiter #\r
String type = scan.next(); // pass enum name e.g. COILS\r
assert resultType.toString().equalsIgnoreCase(type) : "Unknown result type: "\r
+ resultType.toString();\r
return ranges;\r
}\r
\r
- public static Map<String, Set<Score>> removeSequences(\r
- Map<FastaSequence, Set<Score>> disemblResults) {\r
- Map<String, Set<Score>> seqNameScores = new HashMap<String, Set<Score>>();\r
- for (Map.Entry<FastaSequence, Set<Score>> dres : disemblResults\r
+ public static HashMap<String, HashSet<Score>> removeSequences(\r
+ HashMap<FastaSequence, HashSet<Score>> disemblResults) {\r
+ HashMap<String, HashSet<Score>> seqNameScores = new HashMap<String, HashSet<Score>>();\r
+ for (Map.Entry<FastaSequence, HashSet<Score>> dres : disemblResults\r
.entrySet()) {\r
seqNameScores.put(dres.getKey().getId(), dres.getValue());\r
}\r
* @throws IOException\r
* @throws UnknownFileFormatException\r
*/\r
- public static Map<FastaSequence, Set<Score>> readGlobPlot(\r
+ public static HashMap<FastaSequence, HashSet<Score>> readGlobPlot(\r
final InputStream input) throws IOException,\r
UnknownFileFormatException {\r
Scanner scan = new Scanner(input);\r
+ " No such line was found!");\r
}\r
\r
- Map<FastaSequence, Set<Score>> results = new HashMap<FastaSequence, Set<Score>>();\r
+ HashMap<FastaSequence, HashSet<Score>> results = new HashMap<FastaSequence, HashSet<Score>>();\r
int seqCounter = 0;\r
while (scan.hasNext()) {\r
seqCounter++;\r
}\r
FastaSequence fs = new FastaSequence(sequenceName,\r
seqbuffer.toString());\r
- Set<Score> scores = new HashSet<Score>();\r
+ HashSet<Score> scores = new HashSet<Score>();\r
scores.add(new Score(GlobProtResult.Disorder, disorderR));\r
scores.add(new Score(GlobProtResult.GlobDoms, domsR));\r
scores.add(new Score(GlobProtResult.Dydx, dydxScore));\r
\r
scansingle.close();\r
}\r
-\r
+ scan.close();\r
input.close();\r
return results;\r
}\r
import java.io.FileNotFoundException;\r
import java.io.IOException;\r
import java.io.InputStream;\r
-import java.util.Map;\r
-import java.util.Set;\r
+import java.util.HashMap;\r
+import java.util.HashSet;\r
\r
import org.apache.log4j.Logger;\r
\r
}\r
\r
@SuppressWarnings("unchecked")\r
- public Map<String, Set<Score>> getResults(String workDirectory)\r
+ @Override\r
+ public HashMap<String, HashSet<Score>> getResults(String workDirectory)\r
throws ResultNotAvailableException {\r
\r
InputStream inStream = null;\r
- Map<String, Set<Score>> results = null;\r
- // How about getting ranges?\r
+ HashMap<String, HashSet<Score>> results = null;\r
+\r
try {\r
inStream = new FileInputStream(new File(workDirectory, getOutput()));\r
results = SequenceUtil.removeSequences(SequenceUtil\r
log.error(e.getMessage(), e.getCause());\r
throw new ResultNotAvailableException(e);\r
}\r
-\r
+ log.trace("DRESULTS: " + results);\r
return results;\r
}\r
\r
import java.io.FileNotFoundException;\r
import java.io.IOException;\r
import java.io.InputStream;\r
-import java.util.Map;\r
-import java.util.Set;\r
+import java.util.HashMap;\r
+import java.util.HashSet;\r
\r
import org.apache.log4j.Logger;\r
\r
}\r
\r
@SuppressWarnings("unchecked")\r
- public Map<String, Set<Score>> getResults(String workDirectory)\r
+ public HashMap<String, HashSet<Score>> getResults(String workDirectory)\r
throws ResultNotAvailableException {\r
\r
InputStream inStream = null;\r
- Map<String, Set<Score>> results = null;\r
+ HashMap<String, HashSet<Score>> results = null;\r
// How about getting ranges?\r
try {\r
inStream = new FileInputStream(new File(workDirectory, getOutput()));\r
import java.io.FileOutputStream;\r
import java.io.IOException;\r
import java.io.InputStream;\r
+import java.util.HashMap;\r
import java.util.HashSet;\r
import java.util.List;\r
import java.util.Map;\r
try {\r
fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
+ "disembl.out");\r
- Map<FastaSequence, Set<Score>> aseqs = SequenceUtil\r
+ Map<FastaSequence, HashSet<Score>> aseqs = SequenceUtil\r
.readDisembl(fio);\r
assertNotNull(aseqs);\r
assertEquals(aseqs.size(), 3);\r
- System.out.println(aseqs);\r
+ // System.out.println(aseqs);\r
for (FastaSequence fs : aseqs.keySet()) {\r
assertTrue(" Foobar_dundeefriends Foobar dundeefriends "\r
.contains(fs.getId()));\r
try {\r
fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
+ "globplot.out");\r
- Map<FastaSequence, Set<Score>> aseqs = SequenceUtil\r
+ HashMap<FastaSequence, HashSet<Score>> aseqs = SequenceUtil\r
.readGlobPlot(fio);\r
assertNotNull(aseqs);\r
assertEquals(aseqs.size(), 3);\r
assertEquals(scores.size(), 5);\r
}\r
for (Score score : scores) {\r
- \r
+\r
if (score.getMethod() == (Enum<?>) GlobProtResult.Disorder) {\r
assertEquals(score.getRanges().size(), 7);\r
assertTrue(score.getScores().isEmpty());\r
}\r
- if (score.getMethod() == (Enum<?>)GlobProtResult.Dydx) {\r
+ if (score.getMethod() == (Enum<?>) GlobProtResult.Dydx) {\r
assertFalse(score.getScores().isEmpty());\r
assertTrue(score.getRanges().isEmpty());\r
}\r
> Foobar_dundeefriends
# COILS 34-41, 50-58, 83-91, 118-127, 160-169, 191-220, 243-252, 287-343, 350-391, 429-485, 497-506, 539-547
# REM465 355-368
-# HOTLOOPS
+# HOTLOOPS 190-204
# RESIDUE COILS REM465 HOTLOOPS
M 0.86010 0.88512 0.37094
T 0.79983 0.85864 0.44331
import java.net.MalformedURLException;\r
import java.net.URL;\r
import java.util.Arrays;\r
+import java.util.HashMap;\r
import java.util.HashSet;\r
import java.util.List;\r
import java.util.Map;\r
// std.out will not be\r
outStream = System.out;\r
}\r
- if (service == Services.AAConWS) {\r
+ if (service.getServiceType() == SequenceAnnotation.class) {\r
Map<String, HashSet<Score>> result = analize(inputFile,\r
((SequenceAnnotation<T>) msaws), preset, customOptions);\r
+ assert result != null && !result.values().isEmpty() : "No Result reported!";\r
IOHelper.writeOut(outStream, result);\r
} else {\r
alignment = align(inputFile, (MsaWS<T>) msaws, preset,\r
customOptions);\r
IOHelper.writeOut(outStream, alignment);\r
}\r
-\r
- // stream is closed in the method no need to close it here\r
+ outStream.close();\r
}\r
\r
boolean listParameters = CmdHelper.listParameters(cmd);\r
* @return Set<Score> the conservation scores\r
* @throws UnknownFileFormatException\r
*/\r
- <T> Map<String, HashSet<Score>> analize(File file,\r
+ <T> HashMap<String, HashSet<Score>> analize(File file,\r
SequenceAnnotation<T> wsproxy, Preset<T> preset,\r
List<Option<T>> customOptions) {\r
\r
List<FastaSequence> fastalist = null;\r
- Map<String, HashSet<Score>> scores = null;\r
+ HashMap<String, HashSet<Score>> scores = null;\r
try {\r
fastalist = SequenceUtil.openInputStream(file.getAbsolutePath());\r
\r
} else {\r
jobId = wsproxy.analize(fastalist);\r
}\r
- Thread.sleep(1000);\r
+ Thread.sleep(2000);\r
scores = wsproxy.getAnnotation(jobId);\r
+ assert scores != null && !scores.values().isEmpty() : "Scores are NULL";\r
\r
} catch (IOException e) {\r
System.err\r
serv = service.getService(url, V2_QUALIFIED_SERVICE_NAME);\r
}\r
}\r
+ if (serv == null) {\r
+ System.err.println("Could not connect to " + url);\r
+ // FIXME\r
+ }\r
JABAService serviceIF = service.getInterface(serv);\r
log.log(Level.FINE, "Connected successfully!");\r
\r
\r
/**\r
* Starts command line client, if no parameter are supported print help. Two\r
- * parameters are required for successfull call the JWS2 host name and a\r
+ * parameters are required for successful call the JWS2 host name and a\r
* service name.\r
* \r
* @param args\r
* \r
*/\r
public enum Services {\r
- MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS, AAConWS;\r
+ MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS;\r
\r
public static Services getService(String servName) {\r
servName = servName.trim().toLowerCase();\r
if (servName.equalsIgnoreCase(AAConWS.toString())) {\r
return AAConWS;\r
}\r
+ if (servName.equalsIgnoreCase(JronnWS.toString())) {\r
+ return JronnWS;\r
+ }\r
+ if (servName.equalsIgnoreCase(DisemblWS.toString())) {\r
+ return DisemblWS;\r
+ }\r
+ if (servName.equalsIgnoreCase(GlobPlotWS.toString())) {\r
+ return GlobPlotWS;\r
+ }\r
return null;\r
}\r
\r
return Service.create(url, qname);\r
}\r
\r
- JABAService getInterface(Service service) {\r
- assert service != null;\r
-\r
- QName portName = new QName(service.getServiceName().getNamespaceURI(),\r
- this.toString() + "Port");\r
-\r
+ Class<? extends JABAService> getServiceType() {\r
switch (this) {\r
+ // deliberate leaking\r
case AAConWS :\r
- return service.getPort(portName, SequenceAnnotation.class);\r
+ case JronnWS :\r
+ case DisemblWS :\r
+ case GlobPlotWS :\r
+\r
+ return SequenceAnnotation.class;\r
\r
// deliberate leaking\r
case ClustalWS :\r
case MuscleWS :\r
case ProbconsWS :\r
case TcoffeeWS :\r
- // TODO remove\r
- System.out.println("Qname from serv: " + portName);\r
-\r
- return service.getPort(portName, MsaWS.class);\r
\r
+ return MsaWS.class;\r
default :\r
- throw new RuntimeException("Should never happened!");\r
+ throw new RuntimeException("Unrecognised Web Service Type "\r
+ + this + " - Should never happened!");\r
}\r
}\r
+\r
+ JABAService getInterface(Service service) {\r
+ assert service != null;\r
+\r
+ QName portName = new QName(service.getServiceName().getNamespaceURI(),\r
+ this.toString() + "Port");\r
+ return service.getPort(portName, this.getServiceType());\r
+ }\r
}
\ No newline at end of file
throws ResultNotAvailableException {\r
WSUtil.validateJobId(jobId);\r
AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
- ConfiguredExecutable<Disembl> aacon = (ConfiguredExecutable<Disembl>) asyncEngine\r
+ ConfiguredExecutable<Disembl> disembl = (ConfiguredExecutable<Disembl>) asyncEngine\r
.getResults(jobId);\r
- HashMap<String, HashSet<Score>> mas = aacon.getResults();\r
- log.trace(jobId + " getConservation : " + mas);\r
+ HashMap<String, HashSet<Score>> mas = disembl.getResults();\r
+ log.trace(jobId + " getDisorder : " + mas);\r
return mas;\r
}\r
\r