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

Merge branch 'feature-ts/3585-fuse-keep-metadata' into 'dev'

Feature ts/3585 fuse keep metadata

Closes #3585

See merge request !371
parents e830e520 48ff68af
Pipeline #53085 passed with stages
in 7 minutes and 16 seconds
...@@ -21,11 +21,13 @@ ...@@ -21,11 +21,13 @@
"clones" : [ "clones" : [
{ {
"id" : "id-1", "id" : "id-1",
"valA" : "12",
"valC" : "12",
"name": "name-1", "name": "name-1",
"sequence" : "seq-1", "sequence" : "seq-1",
"reads" : [ 800 ] , "reads" : [ 100 ] ,
"top" : 1, "top" : 2,
"germline" : "IGH" "germline" : "IGH"
}, },
{ {
...@@ -33,8 +35,8 @@ ...@@ -33,8 +35,8 @@
"name" : "name-2", "name" : "name-2",
"sequence": "seq-2", "sequence": "seq-2",
"reads" : [ 100 ] , "reads" : [ 800 ] ,
"top" : 2, "top" : 1,
"germline" : "IGH" "germline" : "IGH"
} }
] , ] ,
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
"clones" : [ "clones" : [
{ {
"id" : "id-1", "id" : "id-1",
"valB" : "13",
"valC" : "13",
"name": "name-1", "name": "name-1",
"sequence" : "seq-1", "sequence" : "seq-1",
......
...@@ -98,21 +98,25 @@ class Window: ...@@ -98,21 +98,25 @@ class Window:
myList = [ "seg", "top", "id", "sequence", "name", "id", "stats", "germline"] myList = [ "seg", "top", "id", "sequence", "name", "id", "stats", "germline"]
obj = Window(1) obj = Window(1)
# 'id' and 'top' will be taken from 'topmost' clone
del obj.d["id"]
del obj.d["top"]
# Data of type 'list'
concatenate_with_padding(obj.d, concatenate_with_padding(obj.d,
self.d, len(self.d["reads"]), self.d, len(self.d["reads"]),
other.d, len(other.d["reads"]), other.d, len(other.d["reads"]),
myList) myList)
#keep other data who don't need to be concat # All other data, including 'top'
if other.d["top"] < self.d["top"] : # When there are conflicting keys, keep data from the 'topmost' clone
for key in other.d : order = [other, self] if other.d["top"] < self.d["top"] else [self, other]
if key in myList :
obj.d[key] = other.d[key] for source in order:
else : for key in source.d:
for key in self.d : if key not in obj.d:
if key in myList : obj.d[key] = source.d[key]
obj.d[key] = self.d[key]
return obj return obj
def get_nb_reads(self, cid, point=0): def get_nb_reads(self, cid, point=0):
......
!LAUNCH: python ../../diff.py ../../../algo/tests/data/results-two-clones-1-2.vidjil ../../../algo/tests/data/results-two-clones-1-3.vidjil -c !LAUNCH: python ../../diff.py ../../../algo/tests/data/results-two-clones-1-2.vidjil ../../../algo/tests/data/results-two-clones-1-3.vidjil -c
$ Clone id-1 is a common clone, with a different number of reads $ Clone id-1 is a common clone, with a different number of reads
1:id-1 .* 800 .* 300 1:id-1 .* 100 .* 300
$ Clone id-2 is not a common clone $ Clone id-2 is not a common clone
0:id-2 0:id-2
......
!LAUNCH: python ../../diff.py ../../../algo/tests/data/results-two-clones-1-2.vidjil ../../../algo/tests/data/results-two-clones-1-3.vidjil !LAUNCH: python ../../diff.py ../../../algo/tests/data/results-two-clones-1-2.vidjil ../../../algo/tests/data/results-two-clones-1-3.vidjil
$ Clone id-1 has a different number of reads $ Clone id-1 has a different number of reads
1:Not the same number or reads: id-1 1:[+] .* Not the same number or reads: id-1
$ Clone id-2 is not in the second file $ Clone id-2 is not in the second file
1:[-] .* Clone not present: .* id-2 1:[-] .* Clone not present: .* id-2
......
!LAUNCH: python ../../fuse.py $FUSE_OPTIONS ../../../algo/tests/data/results-two-clones-1-2.vidjil ../../../algo/tests/data/results-two-clones-1-2.vidjil ../../../algo/tests/data/results-two-clones-1-2.vidjil ; cat fused.vidjil !LAUNCH: python ../../fuse.py $FUSE_OPTIONS ../../../algo/tests/data/no_clones.vidjil ../../../algo/tests/data/results-two-clones-1-2.vidjil ../../../algo/tests/data/results-two-clones-1-3.vidjil ; cat fused.vidjil
$ Fuse the three files $ Fuse the three files
2: ListWindows: .1000, 1000, 1000. 2: ListWindows: .0, 1000, 500.
$ Check the producer string in output file $ Check the producer string in output file
1: "producer": "vidjil fuse" 1: "producer": "vidjil fuse"
$ Clone 'id-1' metadata is copied from both files
1: "valA": "12"
1: "valB": "13"
$ A common metadata is copied from where the clone is the most abundant
1: "valC": "13"
...@@ -4,4 +4,4 @@ $ Display the name of the .vidjil file ...@@ -4,4 +4,4 @@ $ Display the name of the .vidjil file
2: data/results-two-clones-1-2.vidjil 2: data/results-two-clones-1-2.vidjil
$ Output a row of a LaTeX table $ Output a row of a LaTeX table
1: & .* 800 & 84..*\% .* of IGH .* 80.00.% & name-1 .* id-1 1: & .* 800 & 84..*\% .* of IGH .* 80.00.% & name-2 .* id-2
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