Commit 8bdd505d authored by Thonier Florian's avatar Thonier Florian

fuse.py; add a try on add data for distributions

link to #3902
parent d54efada
......@@ -644,22 +644,28 @@ class ListWindows(VidjilJson):
obj.d["reads"] = self.d["reads"] + other.d["reads"]
obj.d["diversity"] = self.d["diversity"] + other.d["diversity"]
# verify that same file is not present twice
filename_jlist1 = self.d["distributions"]["repertoires"].keys()
filename_jlist2 = other.d["distributions"]["repertoires"].keys()
print( filename_jlist1+filename_jlist2 )
for filename in filename_jlist1:
if filename_jlist2.index(filename):
# raise
print( "error, duplicate file")
obj.d["distributions"] = {}
obj.d["distributions"]["repertoires"] = {}
for filename in filename_jlist1:
obj.d["distributions"]["repertoires"][filename] = self.d["distributions"]["repertoires"][filename]
for filename in filename_jlist2:
obj.d["distributions"]["repertoires"][filename] = other.d["distributions"]["repertoires"][filename]
try:
# verify that same file is not present twice
filename_jlist1 = list(self.d["distributions"]["repertoires"].keys())
filename_jlist2 = list(other.d["distributions"]["repertoires"].keys())
print( filename_jlist1+filename_jlist2 )
for filename in filename_jlist1:
if filename in filename_jlist2:
raise( "Error, duplicate file name (in distributions) ")
obj.d["distributions"] = {}
obj.d["distributions"]["repertoires"] = {}
obj.d["distributions"]["keys"] = ["clones", "reads"]
obj.d["distributions"]["filters"] = {}
obj.d["distributions"]["categories"] = {}
obj.d["distributions"]["metadata"] = {}
for filename in filename_jlist1:
obj.d["distributions"]["repertoires"][filename] = self.d["distributions"]["repertoires"][filename]
for filename in filename_jlist2:
obj.d["distributions"]["repertoires"][filename] = other.d["distributions"]["repertoires"][filename]
except:
pass
return obj
###
......@@ -818,8 +824,8 @@ class ListWindows(VidjilJson):
'''Serializer for json module'''
if isinstance(obj, ListWindows) or isinstance(obj, Window) or isinstance(obj, Samples) or isinstance(obj, Reads) or isinstance(obj, Diversity):
result = {}
for key in obj.d :
result[key]= obj.d[key]
for key in obj.d:
result[key] = obj.d[key]
return result
raise TypeError(repr(obj) + " fail !")
......
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