Commit e4ba843e authored by Mathieu Giraud's avatar Mathieu Giraud

analysis.py, fuse.py: more stats (timestamps, clone lengths)

parent 9ea06239
......@@ -5,6 +5,8 @@ import json
from utils import *
from defs import *
from collections import defaultdict
class Analysis(VidjilJson):
......@@ -20,8 +22,14 @@ class Analysis(VidjilJson):
self.d = tmp
self.check_version(file_path)
self.id_lengths = defaultdict(int)
for clone in self.d['clones']:
self.clones[clone['id']] = clone
self.id_lengths[len(clone['id'])] += 1
print "%% run_t ->", self.d['samples']['producer'], self.d['samples']['run_timestamp'], self.d['samples']['commandline']
print "%% lengths ->", self.id_lengths
def missing_clones(self, lw):
'''Return a set of the clones described in this .analysis but not present into the .vidjil'''
......
......@@ -41,6 +41,7 @@ import tempfile
from operator import itemgetter
from utils import *
from defs import *
from collections import defaultdict
FUSE_VERSION = "vidjil fuse"
......@@ -115,6 +116,9 @@ class Window:
return obj
def get_nb_reads(self, id, point=0):
return self[id]["reads"][point]
def latex(self, point=0, base_germline=10000, base=10000, tag=''):
reads = self.d["reads"][point]
ratio_germline = float(reads)/base_germline
......@@ -344,6 +348,17 @@ class ListWindows(VidjilJson):
time = os.path.getmtime(file_path)
self.d["samples"].d["timestamp"] = [datetime.datetime.fromtimestamp(time).strftime("%Y-%m-%d %H:%M:%S")]
self.id_lengths = defaultdict(int)
print("%%")
for clone in self:
self.id_lengths[len(clone.d['id'])] += 1
print ("%% lengths .vidjil -> ", self.id_lengths)
try:
print("%% run_v ->", self.d["samples"].d["producer"], self.d["samples"].d["run_timestamp"])
except KeyError:
pass
def getTop(self, top):
result = []
......
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