def stats(self): result = {} result['raw'] = tail(self.p.out) # Special cases # if "by concatenation not pandaseq" in result['raw']: result['noalign'] = 0 result['lowqual'] = 0 result['loss'] = 0 return result # Normal case # if "pandaseq: error" in result['raw']: raise Exception("Pandaseq did not run properly") if result['raw'].startswith("ERR\t"): raise Exception("Pandaseq did not run properly") result['distrib'] = re.findall('STAT\tOVERLAPS\t(.+)$', result['raw'], re.M) result['distrib'] = map(int, result['distrib'][0].split()) result['lengths'] = flatter([[i+1]*v for i,v in enumerate(result['distrib'])]) result['noalign'] = int(re.findall('STAT\tNOALGN\t(.+)$', result['raw'], re.M)[0]) result['lowqual'] = int(re.findall('STAT\tLOWQ\t(.+)$', result['raw'], re.M)[0]) result['loss'] = 100 * sum(result['distrib'][100:]) / sum(result['distrib']) return result
def log_tail(self): """If we have a log file, what is its tail""" if not self.kwargs['out_file'].exists: return False else: return tail(self.slurm_params['out_file'])