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