Skip to content

Commit

Permalink
remove tree.cfg dependency of align module
Browse files Browse the repository at this point in the history
  • Loading branch information
endixk committed May 30, 2023
1 parent ba92cde commit 03f11ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM ubuntu:jammy
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH

ARG VERSION=1.0.4
ARG BUILD=0

# Install dependencies
RUN apt-get update --fix-missing && \
apt-get install -y wget zip bzip2 curl git file vim iputils-ping && \
Expand Down Expand Up @@ -30,8 +33,8 @@ RUN /bin/bash -c "source activate && \
RUN wget --quiet https://ufcg.steineggerlab.workers.dev/payload/config.tar.gz && \
wget --quiet https://ufcg.steineggerlab.workers.dev/payload/core.tar.gz && \
wget --quiet https://ufcg.steineggerlab.workers.dev/payload/sample.tar.gz && \
tar -xzf config.tar.gz -C /opt/conda/share/ufcg-1.0.3c-0/ && \
tar -xzf core.tar.gz -C /opt/conda/share/ufcg-1.0.3c-0/ && \
tar -xzf config.tar.gz -C /opt/conda/share/ufcg-${VERSION}-${BUILD}/ && \
tar -xzf core.tar.gz -C /opt/conda/share/ufcg-${VERSION}-${BUILD}/ && \
tar -xzf sample.tar.gz -C ~ && \
rm *.tar.gz

Expand Down
31 changes: 5 additions & 26 deletions src/module/AlignModule.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package module;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -31,6 +29,7 @@ public class AlignModule {
private static List<String> leaves = null;
private static boolean allowMultiple = false;
private static boolean useCheckpoint = false;
private static String mafftPath = "mafft-linsi";

/* Argument parsing route */
private static void parseArgument(String[] args) throws ParseException {
Expand All @@ -47,6 +46,7 @@ private static void parseArgument(String[] args) throws ParseException {
opts.addOption("f", "filter", true, "gap-rich filter");
opts.addOption("c", "copy", false, "allow multiple copies");
opts.addOption("k", "ckp", false, "checkpoint");
opts.addOption("m", "mafft", true, "mafft path");

opts.addOption(null, "notime", false, "no timestamp with prompt");
opts.addOption(null, "nocolor", false, "disable ANSI escapes");
Expand Down Expand Up @@ -134,34 +134,12 @@ private static void parseArgument(String[] args) throws ParseException {
}
allowMultiple = cmd.hasOption("-c");
useCheckpoint = cmd.hasOption("-k");
if(cmd.hasOption("-m")) mafftPath = cmd.getOptionValue("-m");

/* successfully parsed */
Prompt.talk(ANSIHandler.wrapper("SUCCESS", 'g') + " : Option parsing");
}

private static String getMafftPath() {
String mafftPath = null;
try {
BufferedReader pathBR = new BufferedReader(
new FileReader(PathConfig.EnvironmentPath + "config/tree.cfg"));
String line;
while ((line = pathBR.readLine()) != null) {
if (line.startsWith("mafft")) {
mafftPath = line.substring(line.indexOf("=") + 1);
}
}

pathBR.close();

if (mafftPath == null) {
ExceptionHandler.handle(ExceptionHandler.INVALID_PROGRAM_PATH);
}
} catch (IOException e) {
ExceptionHandler.handle(e);
}
return mafftPath;
}

public static void run(String[] args) {
try {
parseArgument(args);
Expand All @@ -171,7 +149,7 @@ public static void run(String[] args) {

TreeBuilder module = new TreeBuilder(
PathConfig.InputPath, PathConfig.OutputPath, name,
getMafftPath(), null, null, null,
mafftPath, null, null, null,
alignMode, filter, null, 0, leaves, 0,
allowMultiple, useCheckpoint);

Expand Down Expand Up @@ -206,6 +184,7 @@ private static void printAlignHelp() {
System.out.println(ANSIHandler.wrapper(" -f INT Gap-rich filter percentage threshold {0 - 100} [50]", 'x'));
System.out.println(ANSIHandler.wrapper(" -c Align multiple copied genes [0]", 'x'));
System.out.println(ANSIHandler.wrapper(" -k Continue from the checkpoint [0]", 'x'));
System.out.println(ANSIHandler.wrapper(" -m STR Path to MAFFT binary [mafft-linsi]", 'x'));
System.out.println();

UFCGMainPipeline.printGeneral();
Expand Down

0 comments on commit 03f11ae

Please sign in to comment.