X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=runner%2Fcompbio%2Frunner%2Fdisorder%2FDisembl.java;h=7c54af10bd0ab259b45d6b810a7c1454e148e349;hb=9072bd850138bedbd005509e5b14bb5e104574b4;hp=337395c708eb688fca1507504ec437a69c26cd74;hpb=4d6083e0cf39c4989e08bdaf9384e9d44c0da607;p=jabaws.git diff --git a/runner/compbio/runner/disorder/Disembl.java b/runner/compbio/runner/disorder/Disembl.java index 337395c..7c54af1 100644 --- a/runner/compbio/runner/disorder/Disembl.java +++ b/runner/compbio/runner/disorder/Disembl.java @@ -20,45 +20,37 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.util.Map; -import java.util.Set; - import org.apache.log4j.Logger; - -import compbio.data.sequence.Score; +import compbio.data.sequence.ScoreManager; import compbio.data.sequence.SequenceUtil; import compbio.data.sequence.UnknownFileFormatException; - -import compbio.engine.client.Executable; import compbio.engine.client.PipedExecutable; import compbio.engine.client.SkeletalExecutable; -import compbio.metadata.Limit; -import compbio.metadata.LimitsManager; import compbio.metadata.ResultNotAvailableException; import compbio.runner.Util; /** - * DisEMBL.py smooth_frame peak_frame join_frame fold_coils fold_hotloops - * fold_rem465 sequence_file print - * - * 'A default run would be: ./DisEMBL.py 8 8 4 1.2 1.4 1.2 fasta_file > out' - * - * This version of DisEMBL is 1.4 (latest available for download in Feb 2011) - * capable of outputting raw values - * - * The values of the parameters are hard coded in DisEMBL.py script. - * smooth_frame=8 peak_frame=8 join_frame=4 fold_coils=1.2 fold_hotloops=1.4 - * fold_rem465=1.2 - * - * Changing these values are not recommended by developers, apart from smoothing window. - * However, 5 orders of magnitude changes in this parameter does not change the output - * so allowing this change also seems pointless. Finally, the binary, DisEMBL depends on - * - Tisean is not happy with arbitruary changes to these values, so changing them can - * lead to problems. - * + * DisEMBL.py smooth_frame peak_frame join_frame fold_coils fold_hotloops + * fold_rem465 sequence_file print + * + * 'A default run would be: ./DisEMBL.py 8 8 4 1.2 1.4 1.2 fasta_file > out' + * + * This version of DisEMBL is 1.4 (latest available for download in Feb 2011) + * capable of outputting raw values + * + * The values of the parameters are hard coded in DisEMBL.py script. + * smooth_frame=8 peak_frame=8 join_frame=4 fold_coils=1.2 fold_hotloops=1.4 + * fold_rem465=1.2 + * + * Changing these values are not recommended by developers, apart from smoothing + * window. However, 5 orders of magnitude changes in this parameter does not + * change the output so allowing this change also seems pointless. Finally, the + * binary, DisEMBL depends on - Tisean is not happy with arbitruary changes to + * these values, so changing them can lead to problems. * - * This is not a standard DisEMBL! The script has been modified! + * + * This is not a standard DisEMBL! The script has been modified! * */ public class Disembl extends SkeletalExecutable @@ -67,11 +59,15 @@ public class Disembl extends SkeletalExecutable private static Logger log = Logger.getLogger(Disembl.class); - // Cache for Limits information - private static LimitsManager limits; - public static final String KEY_VALUE_SEPARATOR = Util.SPACE; + /** + * For the region to be considered disordered the values must exceed these + */ + public final double COILS_EXPECTATION_THRESHOLD = 0.43; + public final double REM_EXPECTATION_THRESHOLD = 0.5; + public final double LOOPS_EXPECTATION_THRESHOLD = 0.086; + /* The parameter list there must not contain same values! */ public Disembl() { // remove default input to prevent it to appear in the parameters list @@ -80,33 +76,34 @@ public class Disembl extends SkeletalExecutable } @SuppressWarnings("unchecked") - public Map> getResults(String workDirectory) + @Override + public ScoreManager getResults(String workDirectory) throws ResultNotAvailableException { InputStream inStream = null; - Map> results= null; - try { - inStream = new FileInputStream(new File(workDirectory, - getOutput())); - results = SequenceUtil.removeSequences(SequenceUtil.readDisembl(inStream)); - inStream.close(); - } catch (FileNotFoundException e) { - log.error(e.getMessage(), e.getCause()); - throw new ResultNotAvailableException(e); - } catch (IOException e) { - log.error(e.getMessage(), e.getCause()); - throw new ResultNotAvailableException(e); - } catch (UnknownFileFormatException e) { - log.error(e.getMessage(), e.getCause()); - throw new ResultNotAvailableException(e); - } catch (NullPointerException e) { - log.error(e.getMessage(), e.getCause()); - throw new ResultNotAvailableException(e); - } - + ScoreManager results = null; + + try { + inStream = new FileInputStream(new File(workDirectory, getOutput())); + results = ScoreManager.newInstance(SequenceUtil + .readDisembl(inStream)); + inStream.close(); + } catch (FileNotFoundException e) { + log.error(e.getMessage(), e.getCause()); + throw new ResultNotAvailableException(e); + } catch (IOException e) { + log.error(e.getMessage(), e.getCause()); + throw new ResultNotAvailableException(e); + } catch (UnknownFileFormatException e) { + log.error(e.getMessage(), e.getCause()); + throw new ResultNotAvailableException(e); + } catch (NullPointerException e) { + log.error(e.getMessage(), e.getCause()); + throw new ResultNotAvailableException(e); + } + log.trace("DRESULTS: " + results); return results; } - @Override public Disembl setInput(String inFile) { super.setInput(inFile); @@ -114,41 +111,10 @@ public class Disembl extends SkeletalExecutable return this; } + @SuppressWarnings("unchecked") @Override - public Limit getLimit(String presetName) { - if (limits == null) { - limits = getLimits(); - } - - Limit limit = null; - if (limits != null) { - // this returns default limit if preset is undefined! - limit = limits.getLimitByName(presetName); - } - // If limit is not defined for a particular preset, then return default - // limit - if (limit == null) { - log.debug("Limit for the preset " + presetName - + " is not found. Using default"); - limit = limits.getDefaultLimit(); - } - return limit; - } - - @Override - public LimitsManager getLimits() { - // synchronise on static field - synchronized (log) { - if (limits == null) { - limits = Util.getLimits(this.getClass()); - } - } - return limits; - } - - @Override - public Class> getType() { - return this.getClass(); + public Class getType() { + return (Class) this.getClass(); } }