Compare commits
No commits in common. "1697e38b976c5a154192df998e444d172f6387b1" and "2968698cdab5e545bf05d78d51a70b2049d4c5d0" have entirely different histories.
1697e38b97
...
2968698cda
1 changed files with 2 additions and 81 deletions
83
RGBEPP.d
83
RGBEPP.d
|
@ -175,40 +175,6 @@ void processQcTrim(string[] ARG_L, int ARG_T, string DirRaw, string DirQcTrim, s
|
||||||
writeln("QcTrimming::End");
|
writeln("QcTrimming::End");
|
||||||
}
|
}
|
||||||
|
|
||||||
void processMappingDenovo(string[] ARG_L, int ARG_T, string DirQcTrim, string DirAssembly, string DirMap, string PathBowtie2, string PathSamtools){
|
|
||||||
// Prepare directory
|
|
||||||
createDir(DirMap);
|
|
||||||
createDir(DirMap ~ "/index");
|
|
||||||
string DirAssemblySca = DirAssembly ~ "/" ~ "scaffolds";
|
|
||||||
string DirAssemblyFas = DirAssembly ~ "/" ~ "fasta";
|
|
||||||
createDir(DirAssemblySca);
|
|
||||||
createDir(DirAssemblyFas);
|
|
||||||
string ReferDmnd = DirAssemblySca ~ "/" ~ "Reference.dmnd";
|
|
||||||
string PathBowtie2_build = PathBowtie2 ~ "-build";
|
|
||||||
|
|
||||||
foreach (string file; ARG_L) {
|
|
||||||
string baseName = getBaseName(file);
|
|
||||||
string inputM8 = DirAssemblySca ~ "/" ~ baseName ~ ".m8";
|
|
||||||
string inputFasta = DirAssemblySca ~ "/" ~ baseName ~ ".fasta";
|
|
||||||
string outputSort = DirAssemblyFas ~ "/" ~ baseName ~ ".fasta";
|
|
||||||
string outputIndex = DirAssemblyFas ~ "/" ~ baseName;
|
|
||||||
string inputFileR1 = DirQcTrim ~ "/" ~ baseName ~ "_R1.fastq.gz";
|
|
||||||
string inputFileR2 = DirQcTrim ~ "/" ~ baseName ~ "_R2.fastq.gz";
|
|
||||||
string outputBam = DirMap ~ "/" ~ baseName ~ ".bam";
|
|
||||||
|
|
||||||
string[] cmdDiamond = ["diamond", "blastx", "-d", "Reference.dmnd", "-q", inputFasta, "-o", inputM8, "--outfmt", "6", "qseqid", "sseqid", "pident", "length", "mismatch", "gapopen", "qstart", "qend", "sstart", "send", "evalue", "bitscore", "qlen", "slen", "gaps", "ppos", "qframe", "qseq"];
|
|
||||||
string[] cmdSortDiamond = ["sortdiamond", inputM8, outputSort];
|
|
||||||
string[] cmdBuildDB = [PathBowtie2_build, "--threads", ARG_T.to!string, outputSort, outputIndex];
|
|
||||||
string[] cmdMap = [PathBowtie2, "-x", outputIndex, "-1", inputFileR1, "-2", inputFileR2, "-p", ARG_T.to!string];
|
|
||||||
string[] cmdSam2Bam = [PathSamtools, "view", "-bS", "-@", ARG_T.to!string, "-o", outputBam];
|
|
||||||
executeCommand(cmdDiamond);
|
|
||||||
executeCommand(cmdSortDiamond);
|
|
||||||
executeCommand(cmdBuildDB);
|
|
||||||
executeCommandPipe([cmdMap, cmdSam2Bam]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void processMapping(string[] ARG_L, string ARG_R, int ARG_T, string DirQcTrim, string DirMap, string PathBowtie2, string PathSamtools) {
|
void processMapping(string[] ARG_L, string ARG_R, int ARG_T, string DirQcTrim, string DirMap, string PathBowtie2, string PathSamtools) {
|
||||||
writeln("Mapping::Start");
|
writeln("Mapping::Start");
|
||||||
|
|
||||||
|
@ -266,29 +232,6 @@ void processPostMap(string[] ARG_L, int ARG_T, string DirMap, string DirBam, str
|
||||||
writeln("PostMapping::End");
|
writeln("PostMapping::End");
|
||||||
}
|
}
|
||||||
|
|
||||||
void processVarCallDenovo(string[] ARG_L, int ARG_T, string DirAssembly, string DirMap, string DirBam, string DirVcf, string PathBcftools) {
|
|
||||||
writeln("VarCalling::Start");
|
|
||||||
|
|
||||||
string DirAssemblyFas = DirAssembly ~ "/" ~ "fasta";
|
|
||||||
createDir(DirVcf);
|
|
||||||
|
|
||||||
foreach (string file; parallel(ARG_L, 1)) {
|
|
||||||
string baseName = getBaseName(file);
|
|
||||||
string inputBam = DirBam ~ "/" ~ baseName ~ ".bam";
|
|
||||||
string outputVcf = DirVcf ~ "/" ~ baseName ~ ".vcf.gz";
|
|
||||||
string referFasta = DirAssemblyFas ~ "/" ~ baseName ~ ".fasta";
|
|
||||||
// Variant calling using bcftools
|
|
||||||
string[] cmdPileup = [PathBcftools, "mpileup", "-Oz", "--threads", ARG_T.to!string, "-f", referFasta, inputBam];
|
|
||||||
string[] cmdVarCall = [PathBcftools, "call", "-mv", "-Oz", "--threads", ARG_T.to!string];
|
|
||||||
string[] cmdNorm = [PathBcftools, "norm", "--threads", ARG_T.to!string, "-f", referFasta, "-Oz"];
|
|
||||||
string[] cmdFilter = [PathBcftools, "filter", "--threads", ARG_T.to!string, "--IndelGap", "5", "-Oz", "-o", outputVcf];
|
|
||||||
executeCommandPipe([cmdPileup, cmdVarCall, cmdNorm, cmdFilter]);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeln("VarCalling::End");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void processVarCall(string[] ARG_L, string ARG_R, int ARG_T, string DirMap, string DirBam, string DirVcf, string PathBcftools) {
|
void processVarCall(string[] ARG_L, string ARG_R, int ARG_T, string DirMap, string DirBam, string DirVcf, string PathBcftools) {
|
||||||
writeln("VarCalling::Start");
|
writeln("VarCalling::Start");
|
||||||
|
@ -315,23 +258,6 @@ void processVarCall(string[] ARG_L, string ARG_R, int ARG_T, string DirMap, stri
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void processConSam(string[] ARG_L, string DirBam, string DirConsensus, string PathSamtools){
|
|
||||||
writeln("Consensus::Start");
|
|
||||||
|
|
||||||
string DirConTaxa = DirConsensus ~ "/" ~ "taxa";
|
|
||||||
createDir(DirConsensus);
|
|
||||||
createDir(DirConTaxa);
|
|
||||||
|
|
||||||
foreach (string file; parallel(ARG_L,1)) {
|
|
||||||
string baseName = getBaseName(file);
|
|
||||||
string inputBam = DirBam ~ "/" ~ baseName ~ ".bam";
|
|
||||||
string outputFasta = DirConTaxa ~ "/" ~ baseName ~ ".fasta";
|
|
||||||
string [] cmdConsen1 = [PathSamtools, "consensus", "-f", "fasta", inputBam, "-o", outputFasta];
|
|
||||||
executeCommand(cmdConsen1);
|
|
||||||
}
|
|
||||||
writeln("Consensus::End");
|
|
||||||
}
|
|
||||||
|
|
||||||
void processCon(string[] ARG_G, string[] ARG_L, string ARG_R, int ARG_T, string DirMap, string DirVcf, string DirConsensus, string PathBcftools) {
|
void processCon(string[] ARG_G, string[] ARG_L, string ARG_R, int ARG_T, string DirMap, string DirVcf, string DirConsensus, string PathBcftools) {
|
||||||
createDir(DirConsensus);
|
createDir(DirConsensus);
|
||||||
|
|
||||||
|
@ -497,7 +423,6 @@ void main(string[] args) {
|
||||||
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";
|
||||||
string DirConsensus1 = DirHome ~ "/05_consen1";
|
|
||||||
string DirAlign = DirHome ~ "/06_macse";
|
string DirAlign = DirHome ~ "/06_macse";
|
||||||
string DirTrim = DirHome ~ "/07_trimal";
|
string DirTrim = DirHome ~ "/07_trimal";
|
||||||
|
|
||||||
|
@ -623,8 +548,7 @@ void main(string[] args) {
|
||||||
|
|
||||||
if (ARG_F == "all" || ARG_F == "map") {
|
if (ARG_F == "all" || ARG_F == "map") {
|
||||||
if(testFiles([PathBowtie2, PathSamtools])){
|
if(testFiles([PathBowtie2, PathSamtools])){
|
||||||
//processMapping(ARG_L, ARG_R, ARG_T, DirQcTrim, DirMap, PathBowtie2, PathSamtools);
|
processMapping(ARG_L, ARG_R, ARG_T, DirQcTrim, DirMap, PathBowtie2, PathSamtools);
|
||||||
processMappingDenovo(ARG_L, ARG_T, DirQcTrim, DirAssembly, DirMap, PathBowtie2, PathSamtools);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,16 +560,13 @@ void main(string[] args) {
|
||||||
|
|
||||||
if (ARG_F == "all" || ARG_F == "varcall") {
|
if (ARG_F == "all" || ARG_F == "varcall") {
|
||||||
if(testFiles([PathBcftools])){
|
if(testFiles([PathBcftools])){
|
||||||
//processVarCall(ARG_L, ARG_R, ARG_T, DirMap, DirBam, DirVcf, PathBcftools);
|
processVarCall(ARG_L, ARG_R, ARG_T, DirMap, DirBam, DirVcf, PathBcftools);
|
||||||
processVarCallDenovo(ARG_L, ARG_T, DirAssembly, DirMap, DirBam, DirVcf, PathBcftools);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARG_F == "all" || ARG_F == "consen") {
|
if (ARG_F == "all" || ARG_F == "consen") {
|
||||||
if(testFiles([PathBcftools])){
|
if(testFiles([PathBcftools])){
|
||||||
processCon(ARG_G, ARG_L, ARG_R, ARG_T, DirMap, DirVcf, DirConsensus, PathBcftools);
|
processCon(ARG_G, ARG_L, ARG_R, ARG_T, DirMap, DirVcf, DirConsensus, PathBcftools);
|
||||||
//processConSam(ARG_L, DirBam, DirConsensus, PathSamtools);
|
|
||||||
processCombFasta(ARG_G, ARG_L, DirConsensus);
|
processCombFasta(ARG_G, ARG_L, DirConsensus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue