X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=runner%2Fcompbio%2Frunner%2Fconservation%2FAACon.java;h=0f96077ee97280ae8c0e5c4a6fb4f87ab6f804fa;hb=c9680e9b3771037dcb4c92e821a628c8dc6b1684;hp=5d20d5d10cb8c55ece0ee457b42d8f16b67a7ea6;hpb=fab6bab770b548a0c99ed6f5dfb46f5aa99f67c7;p=jabaws.git diff --git a/runner/compbio/runner/conservation/AACon.java b/runner/compbio/runner/conservation/AACon.java index 5d20d5d..0f96077 100644 --- a/runner/compbio/runner/conservation/AACon.java +++ b/runner/compbio/runner/conservation/AACon.java @@ -1,15 +1,19 @@ -/* - * Copyright (c) 2009 Peter Troshin JAva Bioinformatics Analysis Web Services - * (JABAWS) @version: 1.0 This library is free software; you can redistribute it - * and/or modify it under the terms of the Apache License version 2 as published - * by the Apache Software Foundation This library is distributed in the hope - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Apache License for more details. A copy of the license is in - * apache_license.txt. It is also available here: - * @see: http://www.apache.org/licenses/LICENSE-2.0.txt Any republication or - * derived work distributed in source code form must include this copyright and - * license notice. +/* Copyright (c) 2011 Peter Troshin + * + * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 + * + * This library is free software; you can redistribute it and/or modify it under the terms of the + * Apache License version 2 as published by the Apache Software Foundation + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache + * License for more details. + * + * A copy of the license is in apache_license.txt. It is also available here: + * @see: http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Any republication or derived work distributed in source code form + * must include this copyright and license notice. */ package compbio.runner.conservation; @@ -24,16 +28,13 @@ import java.util.List; import org.apache.log4j.Logger; -import compbio.conservation.Method; -import compbio.conservation.ResultReader; -import compbio.data.sequence.MultiAnnotatedSequence; +import compbio.data.sequence.SMERFSConstraints; +import compbio.data.sequence.ScoreManager; +import compbio.data.sequence.SequenceUtil; import compbio.engine.client.CommandBuilder; import compbio.engine.client.Executable; import compbio.engine.client.SkeletalExecutable; -import compbio.metadata.Limit; -import compbio.metadata.LimitsManager; import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; /** * Command line @@ -53,28 +54,29 @@ public class AACon extends SkeletalExecutable { */ private int ncoreNumber = 0; - private final String ncorePrm = "-n="; - - // Cache for Limits information - private static LimitsManager limits; + private final String ncorePrm = "-t="; - public static final String KEY_VALUE_SEPARATOR = Util.SPACE; + public static final String KEY_VALUE_SEPARATOR = "="; public static final String STAT_FILE = "stat.txt"; + private final int windowWidth = SMERFSConstraints.DEFAULT_WINDOW_SIZE; + private final SMERFSConstraints colScoreMethod = SMERFSConstraints.MID_SCORE; + private final double gapTreshold = SMERFSConstraints.DEFAULT_GAP_THRESHOLD; + public AACon() { addParameters(Arrays.asList("-jar", getLibPath(), "-d=" + STAT_FILE, "-f=RESULT_NO_ALIGNMENT")); } - - @SuppressWarnings("unchecked") + // HashMap @Override - public MultiAnnotatedSequence getResults(String workDirectory) + public ScoreManager getResults(String workDirectory) throws ResultNotAvailableException { - MultiAnnotatedSequence annotations = null; + ScoreManager annotations = null; try { InputStream inStream = new FileInputStream(new File(workDirectory, getOutput())); - annotations = ResultReader.readResults(inStream); + annotations = ScoreManager.newInstanceSingleSequence(SequenceUtil + .readAAConResults(inStream)); inStream.close(); } catch (FileNotFoundException e) { log.error(e.getMessage(), e.getCause()); @@ -98,7 +100,7 @@ public class AACon extends SkeletalExecutable { + "and initialize it with the location of jronn jar file"); } if (new File(settings).isAbsolute()) { - // Jronn jar can be found so no actions necessary + // the jar can be found so no actions necessary // no further actions is necessary return settings; } @@ -124,40 +126,10 @@ public class AACon 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(); } public static String getStatFile() {