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 @@
"clones" : [
{
"id" : "id-1",
"valA" : "12",
"valC" : "12",
"name": "name-1",
"sequence" : "seq-1",
"reads" : [ 800 ] ,
"top" : 1,
"reads" : [ 100 ] ,
"top" : 2,
"germline" : "IGH"
},
{
......@@ -33,8 +35,8 @@
"name" : "name-2",
"sequence": "seq-2",
"reads" : [ 100 ] ,
"top" : 2,
"reads" : [ 800 ] ,
"top" : 1,
"germline" : "IGH"
}
] ,
......
......@@ -21,6 +21,8 @@
"clones" : [
{
"id" : "id-1",
"valB" : "13",
"valC" : "13",
"name": "name-1",
"sequence" : "seq-1",
......
......@@ -98,21 +98,25 @@ class Window:
myList = [ "seg", "top", "id", "sequence", "name", "id", "stats", "germline"]
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,
self.d, len(self.d["reads"]),
other.d, len(other.d["reads"]),
myList)
#keep other data who don't need to be concat
if other.d["top"] < self.d["top"] :
for key in other.d :
if key in myList :
obj.d[key] = other.d[key]
else :
for key in self.d :
if key in myList :
obj.d[key] = self.d[key]
# All other data, including 'top'
# When there are conflicting keys, keep data from the 'topmost' clone
order = [other, self] if other.d["top"] < self.d["top"] else [self, other]
for source in order:
for key in source.d:
if key not in obj.d:
obj.d[key] = source.d[key]
return obj
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
$ 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
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
$ 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
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
2: ListWindows: .1000, 1000, 1000.
2: ListWindows: .0, 1000, 500.
$ Check the producer string in output file
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
2: data/results-two-clones-1-2.vidjil
$ 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