2 * Copyright (c) 2011 Peter Troshin JAva Bioinformatics Analysis Web Services
\r
3 * (JABAWS) @version: 2.0 This library is free software; you can redistribute it
\r
4 * and/or modify it under the terms of the Apache License version 2 as published
\r
5 * by the Apache Software Foundation This library is distributed in the hope
\r
6 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
\r
7 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
8 * Apache License for more details. A copy of the license is in
\r
9 * apache_license.txt. It is also available here:
\r
10 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt Any republication or
\r
11 * derived work distributed in source code form must include this copyright and
\r
15 package compbio.runner.disorder;
\r
17 import java.io.File;
\r
18 import java.io.FileInputStream;
\r
19 import java.io.FileNotFoundException;
\r
20 import java.io.IOException;
\r
21 import java.io.InputStream;
\r
23 import org.apache.log4j.Logger;
\r
25 import compbio.data.sequence.ScoreManager;
\r
26 import compbio.data.sequence.SequenceUtil;
\r
27 import compbio.data.sequence.UnknownFileFormatException;
\r
28 import compbio.engine.client.Executable;
\r
29 import compbio.engine.client.PipedExecutable;
\r
30 import compbio.engine.client.SkeletalExecutable;
\r
31 import compbio.metadata.ResultNotAvailableException;
\r
32 import compbio.runner.Util;
\r
35 * ./GlobPipe.py SmoothFrame DOMjoinFrame DOMpeakFrame DISjoinFrame DISpeakFrame
\r
37 * FASTAfile' Optimised for ELM: ./GlobPlot.py 10 8 75 8 8 sequence_file'
\r
38 * Webserver settings: ./GlobPlot.py 10 15 74 4 5 sequence_file'
\r
40 * Hard-coded values are 10 15 74 4 5.
\r
42 * Changing these values are not recommended by developers, apart from smoothing
\r
43 * window. However, the binary, GlobPlot depends on - Tisean which is not happy
\r
44 * with arbitrary changes to these values, so changing them can lead to
\r
45 * problems. May be we can offer preset?
\r
47 * This is not a standard GlobPlot! The script has been modified!
\r
50 public class GlobPlot extends SkeletalExecutable<GlobPlot>
\r
52 PipedExecutable<GlobPlot> {
\r
54 private static Logger log = Logger.getLogger(GlobPlot.class);
\r
56 public static final String KEY_VALUE_SEPARATOR = Util.SPACE;
\r
58 /* The parameter list there must not contain same values! */
\r
60 // remove default input to prevent it to appear in the parameters list
\r
61 // that could happen if the parameters are set first
\r
62 // super.setInput("");
\r
65 @SuppressWarnings("unchecked")
\r
66 public ScoreManager getResults(String workDirectory)
\r
67 throws ResultNotAvailableException {
\r
69 InputStream inStream = null;
\r
70 ScoreManager results = null;
\r
71 // How about getting ranges?
\r
73 inStream = new FileInputStream(new File(workDirectory, getOutput()));
\r
74 results = ScoreManager.newInstance(SequenceUtil
\r
75 .readGlobPlot(inStream));
\r
77 } catch (FileNotFoundException e) {
\r
78 log.error(e.getMessage(), e.getCause());
\r
79 throw new ResultNotAvailableException(e);
\r
80 } catch (IOException e) {
\r
81 log.error(e.getMessage(), e.getCause());
\r
82 throw new ResultNotAvailableException(e);
\r
83 } catch (UnknownFileFormatException e) {
\r
84 log.error(e.getMessage(), e.getCause());
\r
85 throw new ResultNotAvailableException(e);
\r
86 } catch (NullPointerException e) {
\r
87 log.error(e.getMessage(), e.getCause());
\r
88 throw new ResultNotAvailableException(e);
\r
95 public GlobPlot setInput(String inFile) {
\r
96 super.setInput(inFile);
\r
97 cbuilder.setLast(inFile);
\r
101 @SuppressWarnings("unchecked")
\r
103 public Class<Executable<GlobPlot>> getType() {
\r
104 return (Class<Executable<GlobPlot>>) this.getClass();
\r