Commit b8bc97c3 authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-a/3136-3137-warnings-algo' into 'dev'

Feature a/3136 3137 warnings algo

Closes #3136 and #3137

See merge request !179
parents 5e1d04cc d959cd6d
Pipeline #22592 failed with stages
in 52 seconds
......@@ -414,10 +414,10 @@ void output_label_average(ostream &out, string label, long long int nb, double a
}
void json_add_warning(json &clone, string code, string msg)
void json_add_warning(json &clone, string code, string msg, string level)
{
if (!clone.count("warn"))
clone["warn"] = {} ;
clone["warn"] += { {"code", code}, {"msg", msg} } ;
clone["warn"] += { {"code", code}, {"level", level}, {"msg", msg} } ;
}
......@@ -20,6 +20,12 @@
*/
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define LEVEL_DEBUG "debug"
#define LEVEL_INFO "info"
#define LEVEL_WARN "warn"
#define LEVEL_ERROR "error"
#define LEVEL_FATAL "fatal"
#include <sstream>
#include <iostream>
#include <iomanip>
......@@ -255,7 +261,7 @@ bool operator!=(const Sequence &s1, const Sequence &s2);
void output_label_average(ostream &out, string label, long long int nb, double average, int precision=1);
void json_add_warning(json &clone, string code, string msg);
void json_add_warning(json &clone, string code, string msg, string level=LEVEL_WARN);
//////////////////////////////////////////////////
......
......@@ -3,5 +3,5 @@
$ No clustering due to -w all
1: considering all analyzed reads as windows
$ Warning on similar clones in json
1: "code": "W53", "msg": "Similar to another clone IGHV3-48.01 .* IGHJ4.02"
$ Warning on similar clones in json ('warn' because this is a clone in the first 10 clones)
1: "code": "W53", "level": "warn", "msg": "Similar to another clone IGHV3-48.01 .* IGHJ4.02"
......@@ -64,4 +64,4 @@ $ All 'start' fields are 1-based, they never equal to zero
0: "start": 0
$ Warning on low coverage
1: "code": "W51", "msg": "Low coverage: 0.442"
1: "code": "W51", "level": "warn", "msg": "Low coverage: 0.442"
......@@ -4,7 +4,7 @@ $ Warning, -A
1:WARNING
$ Warning in json output
1: "code": "W20", "msg": "Very few V.D.J recombinations found: 0.00."
1: "code": "W20", "level": "warn", "msg": "Very few V.D.J recombinations found: 0.00."
$ Link to documentation
1:algo.org
......
......@@ -124,6 +124,7 @@ enum { CMD_WINDOWS, CMD_CLONES, CMD_SEGMENT, CMD_GERMLINES } ;
#define WARN_MAX_CLONES 100
#define WARN_PERCENT_SEGMENTED 40
#define WARN_COVERAGE 0.6
#define WARN_NUM_CLONES_SIMILAR 10
// display
#define WIDTH_NB_READS 7
......@@ -1431,7 +1432,8 @@ int main (int argc, char **argv)
if (cc)
{
cout << " (similar to Clone #" << setfill('0') << setw(WIDTH_NB_CLONES) << cc << setfill(' ') << ")";
json_add_warning(json_clone, "W53", "Similar to another clone " + code);
json_add_warning(json_clone, "W53", "Similar to another clone " + code,
num_clone <= WARN_NUM_CLONES_SIMILAR ? LEVEL_WARN : LEVEL_INFO);
nb_edges++ ;
out_edges << clones_map_windows[code] + " " + it->first + " " ;
......
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