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.PipedExecutable;
\r
29 import compbio.engine.client.SkeletalExecutable;
\r
30 import compbio.metadata.ResultNotAvailableException;
\r
31 import compbio.runner.RunnerUtil;
\r
34 * ./GlobPipe.py SmoothFrame DOMjoinFrame DOMpeakFrame DISjoinFrame DISpeakFrame
\r
36 * FASTAfile' Optimised for ELM: ./GlobPlot.py 10 8 75 8 8 sequence_file'
\r
37 * Webserver settings: ./GlobPlot.py 10 15 74 4 5 sequence_file'
\r
39 * Hard-coded values are 10 15 74 4 5.
\r
41 * Changing these values are not recommended by developers, apart from smoothing
\r
42 * window. However, the binary, GlobPlot depends on - Tisean which is not happy
\r
43 * with arbitrary changes to these values, so changing them can lead to
\r
44 * problems. May be we can offer preset?
\r
46 * This is not a standard GlobPlot! The script has been modified!
\r
49 public class GlobPlot extends SkeletalExecutable<GlobPlot> implements PipedExecutable<GlobPlot> {
\r
51 private static Logger log = Logger.getLogger(GlobPlot.class);
\r
53 /* The parameter list there must not contain same values! */
\r
55 // remove default input to prevent it to appear in the parameters list
\r
56 // that could happen if the parameters are set first
\r
57 // super.setInput("");
\r
61 @SuppressWarnings("unchecked")
\r
62 public ScoreManager getResults(String workDirectory)
\r
63 throws ResultNotAvailableException {
\r
65 InputStream inStream = null;
\r
66 ScoreManager results = null;
\r
67 // How about getting ranges?
\r
69 inStream = new FileInputStream(new File(workDirectory, getOutput()));
\r
70 results = ScoreManager.newInstance(SequenceUtil
\r
71 .readGlobPlot(inStream));
\r
73 } catch (FileNotFoundException e) {
\r
74 log.error(e.getMessage(), e.getCause());
\r
75 throw new ResultNotAvailableException(e);
\r
76 } catch (IOException e) {
\r
77 log.error(e.getMessage(), e.getCause());
\r
78 throw new ResultNotAvailableException(e);
\r
79 } catch (UnknownFileFormatException e) {
\r
80 log.error(e.getMessage(), e.getCause());
\r
81 throw new ResultNotAvailableException(e);
\r
82 } catch (NullPointerException e) {
\r
83 log.error(e.getMessage(), e.getCause());
\r
84 throw new ResultNotAvailableException(e);
\r
91 public GlobPlot setInput(String inFile) {
\r
92 super.setInput(inFile);
\r
93 cbuilder.setLast(inFile);
\r
97 @SuppressWarnings("unchecked")
\r
99 public Class<GlobPlot> getType() {
\r
100 return (Class<GlobPlot>) this.getClass();
\r