Commit 35f11698 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

Merge branch 'feature-ct/5102-fuse-bad-merge-of-sample-warnings' into 'dev'

Resolve "Fuse, bad merge of sample warnings"

Closes #5102

See merge request !1265
parents c94f03fa bad5f0a2
Pipeline #734987 failed with stages
in 66 minutes and 36 seconds
......@@ -200,7 +200,7 @@ class Window:
def __add__(self, other):
"""Concat two windows, extending lists such as 'reads'"""
#data we don't need to duplicate
myList = [ "seg", "top", "id", "sequence", "name", "id", "stats", "germline", "mrd"]
myList = [ "seg", "top", "id", "sequence", "name", "id", "stats", "germline", "mrd", "warn"]
obj = Window(1)
# 'id' and 'top' will be taken from 'topmost' clone
......@@ -218,6 +218,14 @@ class Window:
"R2": [0],
"family": ["None"],
"norm_coeff": [0]}
if "warn" in self.d or "warn" in other.d:
obj.d["warn"] = []
for source in [self, other]:
if "warn" in source.d:
for warn in source.d["warn"]:
obj.d["warn"].append(warn)
if "mrd" in self.d or "mrd" in other.d:
if "mrd" in self.d:
first = self.d["mrd"]
......@@ -868,7 +876,7 @@ class ListWindows(VidjilJson):
concatenate_with_padding(obj.d,
self.d, l1,
other.d, l2,
["clones", "links", "germlines",
["clones", "links", "germlines", "warn",
"vidjil_json_version"])
obj.d["clones"]=self.fuseWindows(self.d["clones"], other.d["clones"], l1, l2)
......@@ -904,6 +912,22 @@ class ListWindows(VidjilJson):
except:
pass
### Warnings
if "warn" in self.d:
if ("warn" not in obj.d):
obj.d["warn"] = []
for warn in self.d["warn"]:
if not "sample" in warn:
warn["sample"] = l1-1
obj.d["warn"].append(warn)
if "warn" in other.d:
if ("warn" not in obj.d):
obj.d["warn"] = []
for warn in other.d["warn"]:
if not "sample" in warn:
warn["sample"] = l1
obj.d["warn"].append(warn)
return obj
###
......
{
"notes": "Sample with clone 1-3; clone 3 have a variation in his name",
"clones": [
],
"clusters": [],
"germlines": {},
"producer": "vidjil fuse",
"reads": {
"germline": {"IGK": [9500 ] }, "segmented": [9500 ], "total": [9500 ]
},
"samples": {
"commandline": ["cmdline_2"],
"log": ["log_2"],
"number": 1,
"original_names": ["seq_2"],
"producer": ["vidjil-algo 2018.02"],
"run_timestamp": ["2018-03-28 10:26:11"],
"timestamp": ["2018-04-06 13:48:48"]
},
"timestamp": "2019-04-08 15:18:00",
"vidjil_json_version": "2016b",
"warn": []
}
\ No newline at end of file
......@@ -25,5 +25,14 @@
"timestamp": ["2018-04-06 13:48:48"]},
"timestamp": "2019-04-08 15:18:00",
"vidjil_json_version": "2016b",
"warn": []
"warn": [{
"msg": "Bad e-value multiplier.",
"code": "W21",
"level": "warn"
},
{
"msg": "Very few V(D)J recombinations found: 0.10%",
"code": "W20",
"level": "warn"
}]
}
......@@ -30,5 +30,9 @@
},
"timestamp": "2019-04-08 15:18:00",
"vidjil_json_version": "2016b",
"warn": []
}
\ No newline at end of file
"warn": [{
"msg": "Bad e-value multiplier.",
"code": "W21",
"level": "warn"
}]
}
!LAUNCH: python ../../fuse.py $FUSE_OPTIONS ../data/warnings/w81_sample_1.vidjil ../data/warnings/w81_sample_2.vidjil -o fuse_warnings.vidjil ; cat fuse_warnings.vidjil
!OUTPUT_FILE: fuse_warnings_clone.vidjil
!LAUNCH: python ../../fuse.py $FUSE_OPTIONS ../data/warnings/w81_sample_1.vidjil ../data/warnings/w81_sample_2.vidjil -o fuse_warnings_clone.vidjil
$ Fuse the three files
2: ListWindows: .9500, 9500.
j: reads.total: [9500, 9500]
$ Middle file has the good 40-bp windows
......@@ -10,7 +11,9 @@ $ Middle file has the good 40-bp windows
1: "id": "clone_3"
$ fields 'warn' present 2 times (w81 & w82)
2: "level": "warn"
j: clones[0].warn[0].code: W82
j: clones[1].warn[0].code: W81
$ Correct warning is present: W81 (designation)
1: W81
......@@ -22,9 +25,10 @@ $ Correct warning is present: W82 (productivity)
1: .* different productivities.*\(pos 1\): not productive
#################################
### Same tests but with 4 samples
!LAUNCH: python ../../fuse.py $FUSE_OPTIONS ../data/warnings/w81_sample_1.vidjil ../data/warnings/w81_sample_2.vidjil ../data/warnings/w81_sample_1.vidjil ../data/warnings/w81_sample_2.vidjil -o fuse_warnings_many_samples.vidjil ; cat fuse_warnings_many_samples.vidjil
!OUTPUT_FILE: fuse_warnings_clones_many_samples.vidjil
!LAUNCH: python ../../fuse.py $FUSE_OPTIONS ../data/warnings/w81_sample_1.vidjil ../data/warnings/w81_sample_2.vidjil ../data/warnings/w81_sample_1.vidjil ../data/warnings/w81_sample_2.vidjil -o fuse_warnings_clones_many_samples.vidjil
$ Middle file has the good 40-bp windows
......@@ -32,8 +36,24 @@ $ Middle file has the good 40-bp windows
1: "id": "clone_2"
1: "id": "clone_3"
$ fields 'warn' present 2 times (w81 & w82)
4: "level": "warn"
$ fields 'warn' in clone 0
$ 2 warns present in clone 0, warn 1
j: clones[0].warn[0].code: W82
$ 2 warns present in clone 0, warn 2
j: clones[0].warn[1].code: W82
$ 2 warns present in clone 0, correct message
j: clones[0].warn[0].msg: Merged clone has different productivities in some samples \(pos 1\)
$ fields 'warn' present 2 times (w81) in clone 1
$ 2 warns present in clone 1, warn 1
j: clones[1].warn[0].code: W81
$ 2 warns present in clone 1, warn 2
j: clones[1].warn[1].code: W81
$ 2 warns present in clone 1, correct message
j: clones[1].warn[0].msg: Merged clone has different V\(D\)J designations in some samples \(pos 1\)
$ Correct warning is present: W81 (name)
2: W81
......
!OUTPUT_FILE: fuse_warnings_sample.vidjil
!LAUNCH: python ../../fuse.py $FUSE_OPTIONS ../data/warnings/w81_sample_1.vidjil ../data/warnings/sample_3_no_warn.vidjil ../data/warnings/w81_sample_2.vidjil -o fuse_warnings_sample.vidjil
j:warn
# two warns in sample 0, one in sample 2
$ Correct number of warnings in sample level
j3:warn
$ Correct sample value for each warnings in sample level
j:warn[0].sample: 0
j:warn[2].sample: 2
Supports Markdown
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