Permalink
Browse files

Version 3.4.2

Search for PhyML binaries in path
Removed BrowserLauncher
Improved header output
Added launch script for Linux
Added GUI Icon
  • Loading branch information...
ddarriba committed May 9, 2016
1 parent c5b14f6 commit 03eb34e6ccd0b8c335e8ad6700082d81e73a7a74
View
@@ -31,6 +31,12 @@ https://drive.google.com/folderview?id=0ByrkKOPtF_n_dVBBbDVBOEM5b1U
News!
--------
08/05/2016 - ProtTest 3.4.2 is out. It includes the following updates:
Removed dependency on Netbeans libraries
Check for global binaries on PATH env variable
Added prottest3 script for running both GUI and console interfaces
25/10/2015 - ProtTest 3.4.1 is out. It includes the following updates:
Fixed bug with number of categories which might induce an error with certain PhyML versions.
View
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="prottest-3.4.1" default="jar" basedir=".">
<project name="prottest-3.4.2" default="jar" basedir=".">
<property name="src.dir" location="src/main/java" />
<property name="build.base.dir" location="build" />
@@ -62,7 +62,7 @@
</fileset>
</copy>
<mkdir dir="${log.dir}" />
<chmod perm="755" dir="${dist.dir}" includes="*.sh *.bat" />
<chmod perm="755" dir="${dist.dir}" includes="*.sh *.bat prottest3" />
<chmod perm="644" dir="${exe.dir}" includes="*" />
</target>
@@ -17,10 +17,18 @@
*/
package es.uvigo.darwin.prottest;
import static es.uvigo.darwin.prottest.global.ApplicationGlobals.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.logging.Handler;
import java.util.logging.Level;
import es.uvigo.darwin.prottest.consensus.Consensus;
import mpi.MPI;
import pal.misc.Identifier;
import pal.tree.Tree;
import es.uvigo.darwin.prottest.consensus.Consensus;
import es.uvigo.darwin.prottest.exe.PhyMLv3AminoAcidRunEstimator;
import es.uvigo.darwin.prottest.facade.ProtTestFacade;
import es.uvigo.darwin.prottest.facade.ProtTestFacadeMPJ;
import es.uvigo.darwin.prottest.facade.ProtTestFacadeSequential;
@@ -46,14 +54,6 @@
import es.uvigo.darwin.prottest.util.factory.ProtTestFactory;
import es.uvigo.darwin.prottest.util.logging.ProtTestLogger;
import es.uvigo.darwin.prottest.util.printer.ProtTestPrinter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.logging.Handler;
import java.util.logging.Level;
import pal.misc.Identifier;
import pal.tree.Tree;
/**
* This is the main class of ProtTest. It calls the methods in the
@@ -64,9 +64,9 @@
public class ProtTest {
/** The Constant versionNumber. */
public static final String versionNumber = "3.4.1";
public static final String versionNumber = "3.4.2";
/** The Constant versionDate. */
public static final String versionDate = "23th January 2014";
public static final String versionDate = "8th May 2016";
/** The MPJ rank of the process. It is only useful if MPJ is running.*/
public static int MPJ_ME;
/** The MPJ size of the communicator. It is only useful if MPJ is running.*/
@@ -75,6 +75,10 @@
public static boolean MPJ_RUN;
/** The ProtTest factory. */
private static ProtTestFactory factory;
public static final String URL_MANUAL = "http://darwin.uvigo.es/download/prottest_manual.pdf";
public static final String URL_HOMEPAGE = "http://github.com/ddarriba/prottest3";
public static final String URL_DISCUSSION_GROUP = "https://groups.google.com/group/prottest";
/**
* The main method. It initializes the MPJ runtime environment, parses
@@ -85,14 +89,20 @@
*/
public static void main(String[] args) {
try {
try {
args = ProtTestFactory.initialize(args);
} catch (IllegalArgumentException e) {
System.out.println("Illegal argument: " + e.getMessage());
finalize(1);
}
factory = ProtTestFactory.getInstance();
// Checking PhyML binary
if (!PhyMLv3AminoAcidRunEstimator.checkBinary())
{
finalize(1);
}
// initializing MPJ environment (if available)
try {
String[] argsApp = MPI.Init(args);
@@ -120,8 +130,8 @@ public static void main(String[] args) {
getValue(ProtTestArgumentParser.PARAM_NUM_THREADS));
} catch (IllegalArgumentException e) {
if (MPJ_ME == 0) {
System.err.println("\n" + e.getMessage() + "\n");
ApplicationOptions.usage();
System.err.println("\n" + e.getMessage());
System.err.println("Run with -h for help.\n");
}
finalize(1);
} catch (ProtTestInternalException e) {
@@ -55,7 +55,7 @@
* @since 3.0
*/
public class PhyMLv3AminoAcidRunEstimator extends AminoAcidRunEstimator {
/** The PhyML implemented matrices. */
public static String[] IMPLEMENTED_MATRICES = {
"JTT",
@@ -74,14 +74,65 @@
"HIVw"
};
/** Suffix for temporary statistic files. */
private static final String STATS_FILE_SUFFIX = "_phyml_stats.txt";
private static final String STATS_FILE_SUFFIX = "_phyml_stats";
/** Suffix for temporary tree files. */
private static final String TREE_FILE_SUFFIX = "_phyml_tree.txt";
private static final String TREE_FILE_SUFFIX = "_phyml_tree";
/** Alignment filename. */
private String workAlignment;
/** Custom model substitution matrix file**/
private File modelFile;
public static File phymlBinary;
public static String phymlBinaryStr;
private File statsFile;
private File treeFile;
public static boolean checkBinary() {
boolean canExecute = false;
if (!PhyMLv3AminoAcidRunEstimator.phymlBinary.exists()) {
System.err.println("ERROR: PhyML binary not found: " +
PhyMLv3AminoAcidRunEstimator.phymlBinary.getAbsolutePath() + "\n");
} else if (!PhyMLv3AminoAcidRunEstimator.phymlBinary.canExecute()) {
System.err.println("ERROR: PhyML binary exists, but it cannot be executed: " +
PhyMLv3AminoAcidRunEstimator.phymlBinary.getAbsolutePath() + "\n");
} else {
canExecute = true;
}
return canExecute;
}
static {
boolean phymlGlobal = APPLICATION_PROPERTIES.getProperty("global-phyml-exe", "false").equalsIgnoreCase("true");
File exeFilesDir = new File(APPLICATION_PROPERTIES.getProperty("exe-dir", ApplicationGlobals.PATH));
if (!exeFilesDir.isAbsolute()) {
exeFilesDir = new File(ApplicationGlobals.PATH + File.separator + APPLICATION_PROPERTIES.getProperty("exe-dir", "bin"));
}
phymlBinary = new File(exeFilesDir.getAbsolutePath() + File.separator + "phyml");
if (phymlGlobal) {
String[] pathList = System.getenv("PATH").split(":");
for (String path : pathList)
{
phymlBinary = new File(path + "/phyml");
if (phymlBinary.exists() && phymlBinary.canExecute()) {
phymlBinaryStr = phymlBinary.getAbsolutePath();
break;
}
}
} else {
if (phymlBinary.exists() && phymlBinary.canExecute()) {
phymlBinaryStr = phymlBinary.getAbsolutePath();
} else {
phymlBinaryStr = exeFilesDir.getAbsolutePath() + File.separator + getPhymlVersion();
}
phymlBinary = new File(phymlBinaryStr);
}
}
/**
* Instantiates a new optimizer for amino-acid models
* using PhyML.
@@ -164,6 +215,7 @@ public boolean runEstimator()
tr = TemporaryFileManager.getInstance().getTreeFilename(Thread.currentThread());
topo = "lr";
}
try {
Runtime runtime = Runtime.getRuntime();
@@ -322,6 +374,27 @@ public boolean runEstimator()
throw new PhyMLExecutionException("I/O error: " + e.getMessage());
}
statsFile = new File(workAlignment + STATS_FILE_SUFFIX);
if (!(statsFile.exists() && statsFile.canRead()))
{
/* try with txt suffix */
statsFile = new File(workAlignment + STATS_FILE_SUFFIX + "txt");
if (!(statsFile.exists() && statsFile.canRead()))
throw new StatsFileFormatException("PhyML",
"Stats file does not exist. Please check if PhyML is working.");
}
statsFile.deleteOnExit();
treeFile = new File(workAlignment + TREE_FILE_SUFFIX);
if (!(treeFile.exists() && treeFile.canRead()))
{
/* try with txt suffix */
treeFile = new File(workAlignment + TREE_FILE_SUFFIX + "txt");
if (!(treeFile.exists() && treeFile.canRead()))
throw new TreeFormatException(
"Tree file does not exist. Please check if PhyML is working correctly.");
}
treeFile.deleteOnExit();
if (!(readStatsFile() && readTreeFile())) {
return false;
@@ -341,7 +414,7 @@ private boolean readStatsFile()
String line;
try {
FileReader input = new FileReader(workAlignment + STATS_FILE_SUFFIX);
FileReader input = new FileReader(statsFile.getAbsolutePath());
BufferedReader br = new BufferedReader(input);
while ((line = br.readLine()) != null) {
pfinerln("[DEBUG] PHYML: " + line);
@@ -405,16 +478,17 @@ private boolean readStatsFile()
*/
private boolean readTreeFile()
throws TreeFormatException {
try {
model.setTree(new ReadTree(workAlignment + TREE_FILE_SUFFIX));
model.setTree(new ReadTree(treeFile.getAbsolutePath()));
} catch (TreeParseException e) {
String errorMsg = "ProtTest: wrong tree format, exiting...";
throw new TreeFormatException(errorMsg);
} catch (IOException e) {
String errorMsg = "Error: File not found (IO error), exiting...";
throw new TreeFormatException(errorMsg);
}
return true;
}
@@ -425,22 +499,16 @@ private boolean readTreeFile()
*/
@Override
protected boolean deleteTemporaryFiles() {
File f;
f = new File(workAlignment + STATS_FILE_SUFFIX);
f.delete();
f = new File(workAlignment + TREE_FILE_SUFFIX);
f.delete();
f = new File(TemporaryFileManager.getInstance().getLogFilename(Thread.currentThread()));
f.delete();
return true;
File f = new File(TemporaryFileManager.getInstance().getLogFilename(Thread.currentThread()));
return f.delete();
}
/**
* Gets the PhyML executable name for the current Operating System.
*
* @return the PhyML executable name
*/
private String getPhymlVersion() {
private static String getPhymlVersion() {
String os = System.getProperty("os.name");
String oa = System.getProperty("os.arch");
if (os.startsWith("Mac")) {
@@ -30,11 +30,13 @@
import es.uvigo.darwin.prottest.util.exception.ModelOptimizationException.StatsFileFormatException;
import es.uvigo.darwin.prottest.util.exception.ProtTestInternalException;
import es.uvigo.darwin.prottest.util.exception.TreeFormatException;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import pal.tree.ReadTree;
import pal.tree.TreeParseException;
@@ -100,7 +102,8 @@ public RaxMLAminoAcidRunEstimator(ApplicationOptions options, Model model, int n
/* (non-Javadoc)
* @see es.uvigo.darwin.prottest.exe.RunEstimator#optimizeModel(es.uvigo.darwin.prottest.global.options.ApplicationOptions)
*/
@Override
@SuppressWarnings("unused")
@Override
public boolean runEstimator() throws ModelOptimizationException {
//let's call Phyml with the proper command line
@@ -163,16 +166,7 @@ public boolean runEstimator() throws ModelOptimizationException {
// the model
str[3] = "-m";
// if (!Arrays.asList(RAXML_MATRICES).contains(model.getMatrix())) {
// // check matrix file
// if (!modelFile.exists()) {
// throw new ModelNotFoundException(model.getMatrix());
// }
// str[9] = "custom";
// } else {
str[4] = modelName.toString();
// }
str[4] = modelName.toString();
// if (APPLICATION_PROPERTIES.getProperty("phyml_thread_scheduling", "false").equalsIgnoreCase("true")) {
// str[24] = "-t";
// str[25] = String.valueOf(numberOfThreads);
@@ -71,4 +71,6 @@
public static final String PARAM_LOGGING = "log";
/** Verbose mode parameter token. */
public static final String PARAM_VERBOSE = "verbose";
/** Show usage help */
public static final String PARAM_HELP = "h";
}
@@ -578,6 +578,12 @@ public ApplicationOptions() {
*/
public void fillIn(ProtTestArgumentParser arguments) {
if(arguments.exists(ProtTestArgumentParser.PARAM_HELP))
{
usage();
System.exit(0);
}
if (arguments.exists(ProtTestArgumentParser.PARAM_ALIGNMENT_FILE)) {
try {
setAlignment(arguments.getValue(ProtTestArgumentParser.PARAM_ALIGNMENT_FILE));
@@ -718,9 +724,10 @@ public static void usage() {
println("-------------------------------------------------------------------------------------------------");
println("Basic usage: ");
println(" - Sequential version: ");
println(" java -jar prottest-2.1.jar -i alignm_file [OPTIONS]");
println(" java -jar prottest-"+ProtTest.versionNumber+".jar -i align_file [OPTIONS]");
println(" ./prottest3 -i align_file [OPTIONS]");
println(" - Parallel version: ");
println(" mpjrun.sh -wdir $PWD/ -np [NUM_PROCS] -jar prottest-"+ProtTest.versionNumber+".jar -i alignm_file [OPTIONS]");
println(" mpjrun.sh -wdir $PWD/ -np [NUM_PROCS] -jar prottest-"+ProtTest.versionNumber+".jar -i align_file [OPTIONS]");
println("OPTIONS:");
println(" -i alignment_filename");
println(" Alignment input file (required)");
@@ -790,9 +797,9 @@ public static void usage() {
println("-------------------------------------------------------------------------------------------------");
println("Example: ");
println("- Sequential version:");
println(" java -jar prottest-"+ProtTest.versionNumber+".jar -i alignm_file -t tree_file -S 0 -all-distributions -F -AIC -BIC -tc 0.5 > output");
println(" java -jar prottest-"+ProtTest.versionNumber+".jar -i align_file -t tree_file -S 0 -all-distributions -F -AIC -BIC -tc 0.5 > output");
println("- Parallel version:");
println(" mpjrun.sh -wdir $PWD/ -np 2 -jar prottest-"+ProtTest.versionNumber+".jar -i alignm_file -t tree_file -S 0 -all-distributions -F -AIC -BIC -tc 0.5");
println(" mpjrun.sh -wdir $PWD/ -np 2 -jar prottest-"+ProtTest.versionNumber+".jar -i align_file -t tree_file -S 0 -all-distributions -F -AIC -BIC -tc 0.5");
}
public void reportModelOptimization() {
@@ -850,7 +857,7 @@ public void reportComplete() {
if (!(doAIC|doBIC|doAICc|doDT))
sb.append(" lnL");
println(" " + sb.toString());
println(" Sample size.................: " + sampleSize + " (not calculated yet)");
println(" Sample size.................: " + sampleSize);
println(" Other options:");
println(" Display best tree in ASCII..: " + displayASCIITree);
println(" Display best tree in Newick.: " + displayNewickTree);
Oops, something went wrong.

0 comments on commit 03eb34e

Please sign in to comment.