Compare commits

...

2 commits

Author SHA1 Message Date
7641fd7ed3 add: spades de novo 2024-09-09 12:25:32 +10:00
51db2c767f add: more path args 2024-09-09 11:45:55 +10:00

View file

@ -16,6 +16,7 @@ void show_help(string pkgver) {
Version: ", pkgver, "
License: GPL-2.0-only
Author: Guoyi Zhang
-c\t--config\tconfig file for software path (optional)
-g\t--genes\t\tgene file path (optional, if -r is specified)
-f\t--functions\tfunctions type (optional): all clean map
\t \tpostmap varcall consen align
@ -24,7 +25,13 @@ void show_help(string pkgver) {
-m\t--memory\tmemory settings (optional, default 16 GB)
-r\t--reference\treference genome path
-t\t--threads\tthreads setting (optional, default 8 threads)
--macse\t\tMacse jarfile path
--fastp\t\tFastp path (optional)
--bowtie2\t\tBowtie2 path (optional)
--samtools\t\tSamtools path (optional)
--bcftools\t\tBcftools path (optional)
--macse\t\tMacse jarfile path (optional)
--trimal\t\tTrimal path (optional)
--spades\t\tSpades python path (optional)
for example: ./RGBEPP -f all -l list -t 8 -r reference.fasta \n");
}
@ -108,7 +115,22 @@ string[] getARG_G(string ARG_R){
return ARG_G;
}
void processQualityControl(string[] ARG_L, int ARG_T, string DirRaw, string DirQcTrim, string PathFastp) {
string getValueFromConfig(string file, string key) {
string content = readText(file);
string value;
auto regex = regex(key ~ r"\s*=\s*(.+)");
foreach (line; content.splitter("\n")) {
if (auto match = matchFirst(line, regex)) {
value = match.captures[1];
break;
}
}
return value;
}
void processQcTrim(string[] ARG_L, int ARG_T, string DirRaw, string DirQcTrim, string PathFastp) {
// Prepare directory
createDir(DirQcTrim);
writeln("QcTrimming::Start");
@ -313,22 +335,19 @@ void processAlign(string[] ARG_G, string DirConsensus, string DirAlign, string P
}
string getValueFromConfig(string file, string key) {
string content = readText(file);
string value;
auto regex = regex(key ~ r"\s*=\s*(.+)");
foreach (line; content.splitter("\n")) {
if (auto match = matchFirst(line, regex)) {
value = match.captures[1];
break;
}
void processAssembly(string[] ARG_L, int ARG_M, int ARG_T, string DirQcTrim, string DirAssembly, string PathSpades){
createDir(DirAssembly);
foreach (string file; ARG_L) {
string baseName = getBaseName(file);
string DirAss = DirAssembly ~ "/" ~ baseName;
createDir(DirAss);
string inputFileR1 = DirQcTrim ~ "/" ~ baseName ~ "_R1.fastq.gz";
string inputFileR2 = DirQcTrim ~ "/" ~ baseName ~ "_R2.fastq.gz";
string[] cmdAssembly = [PathSpades, "--pe1-1", inputFileR1, "--pe1-2", inputFileR2, "-t", ARG_T.to!string, "-m", ARG_M.to!string, "--careful", "--phred-offset", "33", "-o", DirAss];
executeCommand(cmdAssembly);
}
return value;
}
void main(string[] args) {
string pkgver = "0.0.3";
@ -336,6 +355,7 @@ void main(string[] args) {
string DirRaw = DirHome ~ "/00_raw";
string DirQcTrim = DirHome ~ "/01_fastp";
string DirMap = DirHome ~ "/02_bowtie2";
string DirAssembly = DirHome ~ "/02_spades";
string DirBam = DirHome ~ "/03_bam";
string DirVcf = DirHome ~ "/04_vcf";
string DirConsensus = DirHome ~ "/05_consen";
@ -347,8 +367,10 @@ void main(string[] args) {
string PathBcftools = "/usr/bin/bcftools";
string PathMacse = "/usr/share/java/macse.jar";
string PathTrimal = "/usr/bin/trimal";
string PathSpades = "/usr/bin/spades.py";
int ARG_T = 8;
int ARG_M = 16;
string[] ARG_G;
string[] ARG_L;
string ARG_C;
@ -385,10 +407,34 @@ void main(string[] args) {
i++;
ARG_T = args[i].to!int;
break;
case "--fastp":
i++;
PathFastp = args[i];
break;
case "--bowtie2":
i++;
PathBowtie2 = args[i];
break;
case "--samtools":
i++;
PathSamtools = args[i];
break;
case "--bcftools":
i++;
PathBcftools = args[i];
break;
case "--macse":
i++;
PathMacse = args[i];
break;
case "--trimal":
i++;
PathTrimal = args[i];
break;
case "--spades":
i++;
PathSpades = args[i];
break;
default:
break;
}
@ -418,7 +464,11 @@ void main(string[] args) {
writeln("RGBEPP::Start");
// Perform steps based on provided function argument
if (ARG_F == "all" || ARG_F == "clean") {
processQualityControl(ARG_L, ARG_T, DirRaw, DirQcTrim, PathFastp);
processQcTrim(ARG_L, ARG_T, DirRaw, DirQcTrim, PathFastp);
}
if (ARG_F == "assembly") {
processAlign(ARG_G, DirConsensus, DirAlign, PathMacse);
}
if (ARG_F == "all" || ARG_F == "map") {
@ -442,6 +492,8 @@ void main(string[] args) {
processAlign(ARG_G, DirConsensus, DirAlign, PathMacse);
}
writeln("RGBEPP::End");
}