fix: ref and gen conflict & " issue & splitfasta path
This commit is contained in:
parent
caf80feabf
commit
51630f7006
1 changed files with 13 additions and 7 deletions
20
RGBEPP.d
20
RGBEPP.d
|
@ -426,7 +426,7 @@ void processCombFasta(string[] ARG_G, string[] ARG_L, string DirConsensus) {
|
||||||
writeln("ConvertFasta::End");
|
writeln("ConvertFasta::End");
|
||||||
}
|
}
|
||||||
|
|
||||||
void splitFasta(const string inputFasta) {
|
void splitFasta(string inputFasta, string DirOut) {
|
||||||
File infile;
|
File infile;
|
||||||
try {
|
try {
|
||||||
infile = File(inputFasta, "r");
|
infile = File(inputFasta, "r");
|
||||||
|
@ -449,7 +449,7 @@ void splitFasta(const string inputFasta) {
|
||||||
outfile.close(); // previous output file
|
outfile.close(); // previous output file
|
||||||
}
|
}
|
||||||
seqName = cast(string)lineContent[1 .. $]; // Remove '>'
|
seqName = cast(string)lineContent[1 .. $]; // Remove '>'
|
||||||
string outputFile = seqName ~ ".fasta"; // suitable to many os
|
string outputFile = buildPath(DirOut, seqName ~ ".fasta"); // suitable to many os
|
||||||
outfile = File(outputFile, "w");
|
outfile = File(outputFile, "w");
|
||||||
outfile.writeln(">", getBaseName(inputFasta));
|
outfile.writeln(">", getBaseName(inputFasta));
|
||||||
// will enter sequence
|
// will enter sequence
|
||||||
|
@ -480,21 +480,27 @@ void processCodon(string[] ARG_G, string ARG_R, string DirConsensus, string Path
|
||||||
string ARG_R_Base = getBaseName(ARG_R);
|
string ARG_R_Base = getBaseName(ARG_R);
|
||||||
string ARG_R_Ref = buildPath(DirConsensus, ARG_R_Base ~ ".fasta");
|
string ARG_R_Ref = buildPath(DirConsensus, ARG_R_Base ~ ".fasta");
|
||||||
copy(ARG_R, ARG_R_Ref);
|
copy(ARG_R, ARG_R_Ref);
|
||||||
splitFasta(ARG_R_Ref);
|
splitFasta(ARG_R_Ref, DirConsensus);
|
||||||
|
|
||||||
moveDir(DirConGene, DirConGene ~ "_bak");
|
|
||||||
|
|
||||||
|
if (!exists(DirConGene ~ "_bak")) {
|
||||||
|
moveDir(DirConGene, DirConGene ~ "_bak");
|
||||||
|
}
|
||||||
|
if (!exists(DirConGene)) {
|
||||||
|
createDir(DirConGene);
|
||||||
|
}
|
||||||
|
|
||||||
writeln("GetCodon::Start");
|
writeln("GetCodon::Start");
|
||||||
|
|
||||||
foreach (gene; ARG_G) {
|
foreach (gene; ARG_G) {
|
||||||
string inputFile = buildPath(DirConGene ~ "_bak", gene ~ ".fasta");
|
string inputFile = buildPath(DirConGene ~ "_bak", gene ~ ".fasta");
|
||||||
string outputFile = buildPath(DirConGene, gene ~ ".fasta");
|
string outputFile = buildPath(DirConGene, gene ~ ".fasta");
|
||||||
string referFile = buildPath(DirConsensus, gene ~ ".fasta");
|
string referFile = buildPath(DirConsensus, gene ~ ".fasta");
|
||||||
|
|
||||||
if (!exists(inputFile)) {
|
if (!exists(inputFile)) {
|
||||||
writeln("File not found: ", inputFile);
|
writeln("File not found: ", inputFile);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
string[] cmdExonerate = [PathExonerate, inputFile, referFile, "--showalignment", "no", "--showvulgar", "no", "--showtargetgff", "no", "--ryo", "\">%qi\n%qcs\n\"", "--verbose", "0"];
|
string[] cmdExonerate = [PathExonerate, inputFile, referFile, "--showalignment", "no", "--showvulgar", "no", "--showtargetgff", "no", "--ryo", ">%qi\n%qcs\n", "--verbose", "0"];
|
||||||
executeCommandToFile(cmdExonerate, outputFile);
|
executeCommandToFile(cmdExonerate, outputFile);
|
||||||
}
|
}
|
||||||
std.file.remove(referFile);
|
std.file.remove(referFile);
|
||||||
|
@ -692,7 +698,7 @@ void main(string[] args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get gene from ARG_R reference fasta
|
// get gene from ARG_R reference fasta
|
||||||
if (ARG_R.length != 0 ){
|
if (ARG_R.length != 0 && ARG_R.length == 0 ){
|
||||||
ARG_G = getARG_G(ARG_R);
|
ARG_G = getARG_G(ARG_R);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue