Compare commits

..

No commits in common. "7641fd7ed3d8778f977987149e2a79147b0e1272" and "391dc5c17dd39be4e438557cc0231c0efebd043f" have entirely different histories.

View file

@ -16,7 +16,6 @@ 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
@ -25,13 +24,7 @@ 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)
--fastp\t\tFastp path (optional) --macse\t\tMacse jarfile path
--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");
} }
@ -115,22 +108,7 @@ string[] getARG_G(string ARG_R){
return ARG_G; return ARG_G;
} }
string getValueFromConfig(string file, string key) { void processQualityControl(string[] ARG_L, int ARG_T, string DirRaw, string DirQcTrim, string PathFastp) {
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");
@ -335,19 +313,22 @@ void processAlign(string[] ARG_G, string DirConsensus, string DirAlign, string P
} }
void processAssembly(string[] ARG_L, int ARG_M, int ARG_T, string DirQcTrim, string DirAssembly, string PathSpades){ string getValueFromConfig(string file, string key) {
createDir(DirAssembly); string content = readText(file);
foreach (string file; ARG_L) { string value;
string baseName = getBaseName(file); auto regex = regex(key ~ r"\s*=\s*(.+)");
string DirAss = DirAssembly ~ "/" ~ baseName;
createDir(DirAss); foreach (line; content.splitter("\n")) {
string inputFileR1 = DirQcTrim ~ "/" ~ baseName ~ "_R1.fastq.gz"; if (auto match = matchFirst(line, regex)) {
string inputFileR2 = DirQcTrim ~ "/" ~ baseName ~ "_R2.fastq.gz"; value = match.captures[1];
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]; break;
executeCommand(cmdAssembly); }
} }
return value;
} }
void main(string[] args) { void main(string[] args) {
string pkgver = "0.0.3"; string pkgver = "0.0.3";
@ -355,7 +336,6 @@ 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";
@ -367,10 +347,8 @@ 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;
@ -407,34 +385,10 @@ 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;
} }
@ -464,11 +418,7 @@ 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") {
processQcTrim(ARG_L, ARG_T, DirRaw, DirQcTrim, PathFastp); processQualityControl(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") {
@ -492,8 +442,6 @@ void main(string[] args) {
processAlign(ARG_G, DirConsensus, DirAlign, PathMacse); processAlign(ARG_G, DirConsensus, DirAlign, PathMacse);
} }
writeln("RGBEPP::End"); writeln("RGBEPP::End");
} }