Mercurial > repos > iuc > ngsutils_bam_filter
diff ngsutils/support/__init__.py @ 2:7a68005de299 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ngsutils commit 9a243c616a4a3156347e38fdb5f35863ae5133f9
author | iuc |
---|---|
date | Sun, 27 Nov 2016 15:01:21 -0500 |
parents | 4e4e4093d65d |
children |
line wrap: on
line diff
--- a/ngsutils/support/__init__.py Sun Dec 06 05:03:12 2015 -0500 +++ b/ngsutils/support/__init__.py Sun Nov 27 15:01:21 2016 -0500 @@ -1,13 +1,14 @@ import collections import gzip import os +import re import sys -import re try: from eta import ETA except: pass + class FASTARead(collections.namedtuple('FASTARecord', 'name comment seq')): def __repr__(self): if self.comment: @@ -142,28 +143,30 @@ class Symbolize(object): 'Converts strings to symbols - basically a cache of strings' + def __init__(self): self.__cache = {} def __getitem__(self, k): - if not k in self.__cache: + if k not in self.__cache: self.__cache[k] = k return self.__cache[k] + symbols = Symbolize() _compliments = { -'a': 't', -'A': 'T', -'c': 'g', -'C': 'G', -'g': 'c', -'G': 'C', -'t': 'a', -'T': 'A', -'n': 'n', -'N': 'N' + 'a': 't', + 'A': 'T', + 'c': 'g', + 'C': 'G', + 'g': 'c', + 'G': 'C', + 't': 'a', + 'T': 'A', + 'n': 'n', + 'N': 'N' } @@ -186,6 +189,7 @@ Setup simple binning. Bins are continuous 0->max. Values are added to bins and then means / distributions can be calculated. ''' + def __init__(self): self.bins = [] @@ -214,9 +218,10 @@ return func __cache = {} + def inner(*args, **kwargs): k = (args, tuple(kwargs.iteritems())) - if k not in __cache: + if k not in __cache: __cache[k] = func(*args, **kwargs) return __cache[k]