Commit 6741af65 authored by Thonier Florian's avatar Thonier Florian

fuse.py; add function to clones to get specifi values

Allow to easily get value by axe for distributions
link to #3902
parent aff60475
......@@ -123,6 +123,83 @@ class Window:
def get_nb_reads(self, cid, point=0):
return self[cid]["reads"][point]
def get_reads(self, t=-1):
if t== -1:
return self.d["reads"]
else:
return self.d["reads"][t]
def get_axes_values(self, axes):
""" une liste pour recuperer la valeur d'un champs du clone """
values = []
for axe in axes:
values.append(self.get_values(axe))
return values
def get_values(self, axe):
try:
if axe == "name":
return self.d["name"]
if axe == "seg5":
return self.d["seg"]["5"]["name"]
if axe == "seg4":
return self.d["seg"]["4"]["name"]
if axe == "seg3":
return self.d["seg"]["3"]["name"]
if axe == "germline" or axe == "reagmt":
return self.d["germline"]
if axe == "lenSeq":
return len(self.d["sequence"])
if axe == "evalue":
return self.d["evalue"]["val"]
if axe == "top":
return self.d["top"]
if axe == "seg5_delRight":
return self.d["seg"]["5"]["delRight"]
if axe == "seg3_delLeft":
return self.d["seg"]["3"]["delLeft"]
if axe == "seg4_delRight":
return self.d["seg"]["4"]["delRight"]
if axe == "seg3_delLeft":
return self.d["seg"]["4"]["delLeft"]
### length
if axe == "insert_53":
return self.get_values("seg3_start") - self.get_values("seg5_stop") -1
if axe == "insert_54":
return self.get_values("seg4_start") - self.get_values("seg5_stop") -1
if axe == "insert_43":
return self.get_values("seg3_start") - self.get_values("seg4_stop") -1
if axe == "lenCDR3":
return self.get_values("cdr3_stop") - self.get_values("cdr3_start")
if axe == "lenJunction":
return self.get_values("junction_stop") - self.get_values("junction_start")
### Positions
if axe == "seg5_stop":
return self.d["seg"]["5"]["stop"]
if axe == "seg3_start":
return self.d["seg"]["3"]["start"]
if axe == "seg4_stop":
return self.d["seg"]["4"]["stop"]
if axe == "seg4_start":
return self.d["seg"]["4"]["start"]
if axe == "cdr3_stop":
return self.d["seg"]["cdr3"]["stop"]
if axe == "cdr3_start":
return self.d["seg"]["cdr3"]["start"]
if axe == "junction_stop":
return self.d["seg"]["junction"]["stop"]
if axe == "junction_start":
return self.d["seg"]["junction"]["start"]
if axe == "productive":
return self.d["seg"]["junction"]["productive"]
return "todo"
except:
return "?"
def latex(self, point=0, base_germline=10000, base=10000, tag=''):
reads = self.d["reads"][point]
ratio_germline = float(reads)/base_germline
......
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