Commit fc0afd36 authored by Mathieu Giraud's avatar Mathieu Giraud

vidjil.cpp: seq/clone-*.fa output disabled by default, new advanced option --out-clone-files

see #4386
parent 9116f21b
......@@ -587,6 +587,11 @@ int main (int argc, char **argv)
bool out_gz = false;
app.add_flag("--gz", out_gz, "output compressed .tsv.gz, .vdj.fa.gz, and .vidjil.gz files") -> group(group) -> level();
bool output_clone_files = false;
app.add_flag("--out-clone-files", output_clone_files,
"output clones in individual files (in " CLONE_DIR "/" CLONE_FILENAME "* files)")
-> group(group) -> level();
bool no_airr = false;
bool no_vidjil = false;
app.add_flag("--no-airr", no_airr, "do not output AIRR .tsv") -> group(group) -> level();
......@@ -732,10 +737,14 @@ int main (int argc, char **argv)
return 2;
}
const char *outseq_cstr = out_seqdir.c_str();
if (mkpath(outseq_cstr, 0755) == -1) {
cerr << ERROR_STRING << "Directory creation: " << out_seqdir << endl; perror("");
return 2;
if (output_clone_files)
{
const char *outseq_cstr = out_seqdir.c_str();
if (mkpath(outseq_cstr, 0755) == -1) {
cerr << ERROR_STRING << "Directory creation: " << out_seqdir << endl; perror("");
return 2;
}
}
// Compute basename if not given as an option
......@@ -1306,8 +1315,11 @@ int main (int argc, char **argv)
cout << " ==> " << f_clones << " \t(for post-processing with other software)" << endl ;
ostream* out_clones = new_ofgzstream(f_clones.c_str(), out_gz) ;
cout << " ==> " << out_seqdir + CLONE_FILENAME + "*" << "\t(detail, by clone)" << endl ;
cout << endl ;
if (output_clone_files)
{
cout << " ==> " << out_seqdir + CLONE_FILENAME + "*" << "\t(detail, by clone)" << endl ;
cout << endl ;
}
global_interrupted = false;
signal(SIGINT, sigintHandler);
......@@ -1392,15 +1404,21 @@ int main (int argc, char **argv)
//$$ Open CLONE_FILENAME
ofstream *out_clone = NULL;
string clone_file_name = out_seqdir+ CLONE_FILENAME + string_of_int(num_clone) ;
ofstream out_clone(clone_file_name.c_str());
if (output_clone_files)
{
string clone_file_name = out_seqdir+ CLONE_FILENAME + string_of_int(num_clone) ;
out_clone = new ofstream(clone_file_name.c_str());
*out_clone << window_str ;
}
//$$ Output window
if (clone_on_stdout)
{
cout << window_str ;
out_clone << window_str ;
}
//$$ Compute a representative sequence
// Display statistics on auditionned sequences
......@@ -1466,6 +1484,13 @@ int main (int argc, char **argv)
if (clone_on_stdout)
cout << representative << endl ;
*out_clones << representative << endl ;
if (output_clone_files)
{
out_clone->close();
delete out_clone;
}
continue;
}
......@@ -1491,8 +1516,11 @@ int main (int argc, char **argv)
// to stdout, CLONES_FILENAME, and CLONE_FILENAME-*
if (clone_on_stdout)
cout << seg << endl ;
out_clone << seg << endl ;
*out_clones << seg << endl ;
if (output_clone_files)
*out_clone << seg << endl ;
*out_clones << seg << endl ;
seg.toOutput(clone);
......@@ -1520,13 +1548,16 @@ int main (int argc, char **argv)
}
// Output best V, (D) and J germlines to CLONE_FILENAME-*
if (output_clone_files)
{
if ((segmented_germline->seg_method == SEG_METHOD_53) || (segmented_germline->seg_method == SEG_METHOD_543))
out_clone << ">" << seg.box_V->ref_label << endl << seg.box_V->ref << endl ;
*out_clone << ">" << seg.box_V->ref_label << endl << seg.box_V->ref << endl ;
if ((segmented_germline->seg_method == SEG_METHOD_543) || (segmented_germline->seg_method == SEG_METHOD_ONE))
out_clone << ">" << seg.box_D->ref_label << endl << seg.box_D->ref << endl ;
*out_clone << ">" << seg.box_D->ref_label << endl << seg.box_D->ref << endl ;
if ((segmented_germline->seg_method == SEG_METHOD_53) || (segmented_germline->seg_method == SEG_METHOD_543))
out_clone << ">" << seg.box_J->ref_label << endl << seg.box_J->ref << endl ;
out_clone << endl;
*out_clone << ">" << seg.box_J->ref_label << endl << seg.box_J->ref << endl ;
*out_clone << endl;
}
} // end if (seg.isSegmented())
seg.checkWarnings(clone, clone_on_stdout);
......@@ -1537,13 +1568,19 @@ int main (int argc, char **argv)
for (list<Sequence>::const_iterator itt = sequences.begin(); itt != sequences.end(); ++itt)
{
out_clone << *itt ;
*out_clone << *itt ;
}
}
if (clone_on_stdout)
cout << endl ;
out_clone.close();
if (output_clone_files)
{
out_clone->close();
delete out_clone;
}
} // end for clones
signal(SIGINT, SIG_DFL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment