Skip to content

Commit

Permalink
download samples to the current working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
endixk committed Aug 7, 2023
1 parent b74db67 commit 64ac3ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/envs/config/PathConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package envs.config;

import java.io.File;
import java.nio.file.Paths;
import java.util.Arrays;

import envs.toolkit.ANSIHandler;
Expand All @@ -12,6 +13,7 @@

public class PathConfig {
/* Environment */
public static final String CurrPath = Paths.get("").toAbsolutePath().toString() + File.separator;
public static final String JarPath = new File(UFCGMainPipeline.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent() + File.separator;
public static String EnvironmentPath = "";
public static boolean EnvironmentPathSet = false;
Expand Down
8 changes: 7 additions & 1 deletion src/module/DownloadModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ private void printManual() {
private void checkStatus(){
boolean ping = internetConnection();
if(PathConfig.EnvironmentPathSet && !dirGiven) dir = PathConfig.EnvironmentPath;
String sampleDir = dir;
if(!dirGiven) sampleDir = PathConfig.CurrPath;

System.out.println(ANSIHandler.wrapper(" System status", 'Y'));
System.out.println(ANSIHandler.wrapper(" OS : " + GenericConfig.OS, 'x'));
Expand All @@ -169,7 +171,7 @@ private void checkStatus(){
ANSIHandler.wrapper("OK", 'G') : ANSIHandler.wrapper("NO", 'R')));
System.out.println(ANSIHandler.wrapper(" busco ", 'x') + (new File(dir + "config/seq/busco/100957at4751.fa").exists() ?
ANSIHandler.wrapper("OK", 'G') : ANSIHandler.wrapper("NO", 'R')));
System.out.println(ANSIHandler.wrapper(" sample ", 'x') + (new File(dir + "sample/meta_full.tsv").exists() ?
System.out.println(ANSIHandler.wrapper(" sample ", 'x') + (new File(sampleDir + "sample/meta_full.tsv").exists() ?
ANSIHandler.wrapper("OK", 'G') : ANSIHandler.wrapper("NO", 'R')));
System.out.println();

Expand Down Expand Up @@ -288,6 +290,10 @@ private void downloadBusco(){
Prompt.print("Download success : target " + ANSIHandler.wrapper("busco", 'G'));
}
private void downloadSample(){
if(!dirGiven) {
dir = PathConfig.CurrPath;
}

// download payload
Prompt.print("Downloading sample package on " + ANSIHandler.wrapper(dir + "sample.tar.gz", 'y') + " ...");
Shell.exec(String.format("wget -q -O %ssample.tar.gz https://ufcg.steineggerlab.workers.dev/payload/sample.tar.gz", dir));
Expand Down

0 comments on commit 64ac3ee

Please sign in to comment.