Skip to content

Commit

Permalink
mmseqs detection for interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
endixk committed Mar 2, 2023
1 parent 6fefa1b commit 35e52bb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
5 changes: 4 additions & 1 deletion src/envs/config/PathConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,24 @@ public static int setHmmsearchPath(String path) {
}

public static String MMseqsPath = "mmseqs";
public static void setMMseqsPath(String path) {
public static int setMMseqsPath(String path) {
try {
Prompt.talk("MMseqs binary check : " + ANSIHandler.wrapper(path, 'B'));
String[] exec = Shell.exec("file -b " + path);
if(!exec[0].contains("exec") && !exec[0].contains("link")) {
ExceptionHandler.pass(path);
ExceptionHandler.handle(ExceptionHandler.INVALID_BINARY);
return 1;
}
}
catch(Exception e) {
e.printStackTrace();
ExceptionHandler.handle(ExceptionHandler.EXCEPTION);
return 2;
}

MMseqsPath = path;
return 0;
}

public static String TrinityPath = "Trinity";
Expand Down
18 changes: 9 additions & 9 deletions src/module/ProfileModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private static void solveDependency() {
if(AugustusWrapper.checkConfigFile()) {
ExceptionHandler.handle(ExceptionHandler.INVALID_PPX_CONFIG);
}
if(MMseqsWrapper.solve()) {
if(!MMseqsWrapper.solve()) {
ExceptionHandler.pass(PathConfig.MMseqsPath);
ExceptionHandler.handle(ExceptionHandler.DEPENDENCY_UNSOLVED);
}
Expand Down Expand Up @@ -467,18 +467,18 @@ else if(buf.startsWith("n") || buf.startsWith("N")) {
}
proceed = false;
if(solvedPath != null) command.append(" --augustus ").append(solvedPath);
/*
// --hmmsearch

// --mmseqs
solvedPath = null;
while(!proceed) {
if(HmmsearchWrapper.solve()) proceed = true;
if(MMseqsWrapper.solve()) proceed = true;
else {
Prompt.print("Failed to solve : " + PathConfig.HmmsearchPath);
Prompt.print("Failed to solve : " + PathConfig.MMseqsPath);
while(!proceed) {
Prompt.print_nnc("Enter the location of hmmsearch binary (--hmmsearch) : ");
Prompt.print_nnc("Enter the location of MMseqs2 binary (--mmseqs) : ");
buf = stream.readLine();
if(buf.length() == 0) continue;
if(PathConfig.setHmmsearchPath(buf) == 0) {
if(PathConfig.setMMseqsPath(buf) == 0) {
solvedPath = buf;
proceed = true;
}
Expand All @@ -487,8 +487,8 @@ else if(buf.startsWith("n") || buf.startsWith("N")) {
}
}
proceed = false;
if(solvedPath != null) command += " --hmmsearch " + solvedPath;
*/
if(solvedPath != null) command.append(" --mmseqs ").append(solvedPath);

/* set runtime configurations */
// --cpu
while(!proceed) {
Expand Down
2 changes: 1 addition & 1 deletion src/module/ProfileProModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private static int parseArgument(String[] args) throws ParseException {
private static void solveDependency() {
Prompt.talk("Solving dependencies...");

if(MMseqsWrapper.solve()) {
if(!MMseqsWrapper.solve()) {
ExceptionHandler.pass(PathConfig.MMseqsPath);
ExceptionHandler.handle(ExceptionHandler.DEPENDENCY_UNSOLVED);
}
Expand Down
2 changes: 1 addition & 1 deletion src/module/ProfileRnaModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private static void solveDependency() {
if(AugustusWrapper.checkConfigFile()) {
ExceptionHandler.handle(ExceptionHandler.INVALID_PPX_CONFIG);
}
if(MMseqsWrapper.solve()) {
if(!MMseqsWrapper.solve()) {
ExceptionHandler.pass(PathConfig.MMseqsPath);
ExceptionHandler.handle(ExceptionHandler.DEPENDENCY_UNSOLVED);
}
Expand Down
6 changes: 3 additions & 3 deletions src/wrapper/MMseqsWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ public String[] exec() {
public static boolean solve() {
String cmd = PathConfig.MMseqsPath + " 2>&1";
String[] raw = Shell.exec(cmd);
if(raw[0].contains("not found")) return true;
if(raw[0].contains("not found")) return false;
for(int error_loc = 0; !raw[error_loc].contains("MMseqs2"); error_loc++) {
if(error_loc + 1 == raw.length) return true;
if(error_loc + 1 == raw.length) return false;
}
return false;
return true;
}
}

0 comments on commit 35e52bb

Please sign in to comment.