Commit 0ce12ff5 authored by Mathieu Giraud's avatar Mathieu Giraud

core/windowExtractor.cpp: do not halt when there is an error in a .fastq file

The .fastq parser in OnlineFasta() is rigourous. When the file was truncated somewhere,
there can be a non-valid sequence at the end of the file.

Previously Vidjil was halting in this case, and this could be quite frustating
when a large number of sequences were already processed. Now we just warn the user,
stop the analysis at this point, and properly output the clones.

Note that this does not affect the initial scan done on at most SAMPLE_APPROX_NB_SEQUENCES
sequences (currently 200): Vidjil will still halt on any error in these first sequences.
parent 486842bd
......@@ -2,6 +2,11 @@
#define TOOLS_H
// error
#define ERROR_STRING "[error] "
#define WARNING_STRING "[warning] "
#define NO_LIMIT_VALUE -1 // Value for 'all' on command-line options
......@@ -28,7 +28,17 @@ WindowsStorage *WindowExtractor::extract(OnlineFasta *reads,
unsigned long long int bp_total = 0;
while (reads->hasNext()) {
try {
catch (const invalid_argument e) {
cout << endl;
cerr << WARNING_STRING << "Error in getting a new read: " << e.what() << endl;
cerr << WARNING_STRING << "Vidjil stops the analysis here, after " << nb_reads << " reads." << endl;
break ;
if (out_affects) {
......@@ -120,9 +120,6 @@ enum { CMD_WINDOWS, CMD_CLONES, CMD_SEGMENT, CMD_GERMLINES } ;
#define DEFAULT_TRIM 100
// error
#define ERROR_STRING "[error] "
// warn
#define WARN_MAX_CLONES 100
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment