Commit 49046ca6 authored by Marc Duez's avatar Marc Duez

fuse.py : build stats about reads distribution / mute "others" artificial clones

TODO : auto-compute others clones with javascript
parent ed2596aa
...@@ -205,8 +205,26 @@ class ListWindows: ...@@ -205,8 +205,26 @@ class ListWindows:
return return
raise IOError ("File '%s' is too old -- please regenerate it with a newer version of Vidjil" % filepath) raise IOError ("File '%s' is too old -- please regenerate it with a newer version of Vidjil" % filepath)
### compute statistics about clones
def build_stat(self):
ranges = [1000, 100, 10, 1]
result = [[0 for col in range(len(self.d['reads_segmented']))] for row in range(len(ranges))]
for w in self.d["windows"]:
for i, s in enumerate(w.d["size"]):
for r in range(len(ranges)):
if s >= ranges[r]:
break
result[r][i] += s
print result
for r in range(len(ranges)):
self.d["reads-distribution-"+str(ranges[r])] = result[r]
#TODO V/D/J distrib and more
### save / load to .json ### save / load to .json
def save_json(self, output): def save_json(self, output):
'''save ListWindows in .json format''' '''save ListWindows in .json format'''
print "==>", output print "==>", output
...@@ -363,8 +381,8 @@ class ListWindows: ...@@ -363,8 +381,8 @@ class ListWindows:
win = self.d["windows"][index] win = self.d["windows"][index]
if (int(win.d["top"]) < limit or limit == 0) : if (int(win.d["top"]) < limit or limit == 0) :
w.append(win) w.append(win)
else: #else:
others += win #others += win
self.d["windows"] = w + list(others) self.d["windows"] = w + list(others)
self.d["germline"]=self.d["germline"][0] self.d["germline"]=self.d["germline"][0]
...@@ -754,6 +772,7 @@ def main(): ...@@ -754,6 +772,7 @@ def main():
jlist_fused.d["point"] = ll jlist_fused.d["point"] = ll
print print
jlist_fused.build_stat()
jlist_fused.cut(args.top, len(l)) jlist_fused.cut(args.top, len(l))
print "\t", jlist_fused print "\t", jlist_fused
print print
......
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