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.Util;
\r
34 * DisEMBL.py smooth_frame peak_frame join_frame fold_coils fold_hotloops
\r
35 * fold_rem465 sequence_file print
\r
37 * 'A default run would be: ./DisEMBL.py 8 8 4 1.2 1.4 1.2 fasta_file > out'
\r
39 * This version of DisEMBL is 1.4 (latest available for download in Feb 2011)
\r
40 * capable of outputting raw values
\r
42 * The values of the parameters are hard coded in DisEMBL.py script.
\r
43 * smooth_frame=8 peak_frame=8 join_frame=4 fold_coils=1.2 fold_hotloops=1.4
\r
46 * Changing these values are not recommended by developers, apart from smoothing
\r
47 * window. However, 5 orders of magnitude changes in this parameter does not
\r
48 * change the output so allowing this change also seems pointless. Finally, the
\r
49 * binary, DisEMBL depends on - Tisean is not happy with arbitruary changes to
\r
50 * these values, so changing them can lead to problems.
\r
53 * This is not a standard DisEMBL! The script has been modified!
\r
56 public class Disembl extends SkeletalExecutable<Disembl>
\r
58 PipedExecutable<Disembl> {
\r
60 private static Logger log = Logger.getLogger(Disembl.class);
\r
62 public static final String KEY_VALUE_SEPARATOR = Util.SPACE;
\r
65 * For the region to be considered disordered the values must exceed these
\r
67 public final double COILS_EXPECTATION_THRESHOLD = 0.43;
\r
68 public final double REM_EXPECTATION_THRESHOLD = 0.5;
\r
69 public final double LOOPS_EXPECTATION_THRESHOLD = 0.086;
\r
71 /* The parameter list there must not contain same values! */
\r
73 // remove default input to prevent it to appear in the parameters list
\r
74 // that could happen if the parameters are set first
\r
75 // super.setInput("");
\r
78 @SuppressWarnings("unchecked")
\r
80 public ScoreManager getResults(String workDirectory)
\r
81 throws ResultNotAvailableException {
\r
83 InputStream inStream = null;
\r
84 ScoreManager results = null;
\r
87 inStream = new FileInputStream(new File(workDirectory, getOutput()));
\r
88 results = ScoreManager.newInstance(SequenceUtil
\r
89 .readDisembl(inStream));
\r
91 } catch (FileNotFoundException e) {
\r
92 log.error(e.getMessage(), e.getCause());
\r
93 throw new ResultNotAvailableException(e);
\r
94 } catch (IOException e) {
\r
95 log.error(e.getMessage(), e.getCause());
\r
96 throw new ResultNotAvailableException(e);
\r
97 } catch (UnknownFileFormatException e) {
\r
98 log.error(e.getMessage(), e.getCause());
\r
99 throw new ResultNotAvailableException(e);
\r
100 } catch (NullPointerException e) {
\r
101 log.error(e.getMessage(), e.getCause());
\r
102 throw new ResultNotAvailableException(e);
\r
104 log.trace("DRESULTS: " + results);
\r
108 public Disembl setInput(String inFile) {
\r
109 super.setInput(inFile);
\r
110 cbuilder.setLast(inFile);
\r
114 @SuppressWarnings("unchecked")
\r
116 public Class<Disembl> getType() {
\r
117 return (Class<Disembl>) this.getClass();
\r