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> implements PipedExecutable<Disembl> {
\r
58 private static Logger log = Logger.getLogger(Disembl.class);
\r
61 * For the region to be considered disordered the values must exceed these
\r
63 public final double COILS_EXPECTATION_THRESHOLD = 0.43;
\r
64 public final double REM_EXPECTATION_THRESHOLD = 0.5;
\r
65 public final double LOOPS_EXPECTATION_THRESHOLD = 0.086;
\r
67 /* The parameter list there must not contain same values! */
\r
69 // remove default input to prevent it to appear in the parameters list
\r
70 // that could happen if the parameters are set first
\r
71 // super.setInput("");
\r
74 @SuppressWarnings("unchecked")
\r
76 public ScoreManager getResults(String workDirectory)
\r
77 throws ResultNotAvailableException {
\r
79 InputStream inStream = null;
\r
80 ScoreManager results = null;
\r
83 inStream = new FileInputStream(new File(workDirectory, getOutput()));
\r
84 results = ScoreManager.newInstance(SequenceUtil
\r
85 .readDisembl(inStream));
\r
87 } catch (FileNotFoundException e) {
\r
88 log.error(e.getMessage(), e.getCause());
\r
89 throw new ResultNotAvailableException(e);
\r
90 } catch (IOException e) {
\r
91 log.error(e.getMessage(), e.getCause());
\r
92 throw new ResultNotAvailableException(e);
\r
93 } catch (UnknownFileFormatException e) {
\r
94 log.error(e.getMessage(), e.getCause());
\r
95 throw new ResultNotAvailableException(e);
\r
96 } catch (NullPointerException e) {
\r
97 log.error(e.getMessage(), e.getCause());
\r
98 throw new ResultNotAvailableException(e);
\r
100 log.trace("DRESULTS: " + results);
\r
105 public Disembl setInput(String inFile) {
\r
106 super.setInput(inFile);
\r
107 cbuilder.setLast(inFile);
\r
111 @SuppressWarnings("unchecked")
\r
113 public Class<Disembl> getType() {
\r
114 return (Class<Disembl>) this.getClass();
\r