allpy
changeset 649:e3f06e45de03
Merge between pickled monomers and non-sequence-wise blocks_finder.
author | Boris Burkov <BurkovBA@gmail.com> |
---|---|
date | Fri, 10 Jun 2011 15:37:20 +0400 |
parents | f4f658d86ca1 88c246f20918 |
children | 95185a216b97 |
files | allpy/base.py allpy/data/monomers.py |
diffstat | 6 files changed, 28 insertions(+), 12 deletions(-) [+] |
line diff
1.1 --- a/allpy/base.py Fri Jun 10 15:33:16 2011 +0400 1.2 +++ b/allpy/base.py Fri Jun 10 15:37:20 2011 +0400 1.3 @@ -37,8 +37,9 @@ 1.4 name = name.strip().capitalize() 1.5 code1 = code1.upper() 1.6 code3 = code3.upper() 1.7 + module = vars(data.monomers)[cls.type] 1.8 TheMonomer.__name__ = re.sub(r"\W", "_", name) 1.9 - TheMonomer.__module__ = data.monomers.__name__ 1.10 + TheMonomer.__module__ = module.__name__ 1.11 TheMonomer.name = name 1.12 TheMonomer.code1 = code1 1.13 TheMonomer.code3 = code3 1.14 @@ -46,11 +47,9 @@ 1.15 # Save the class in data.monomers so that it can be pickled 1.16 # Some names are not unique, we append underscores to them 1.17 # in order to fix it. 1.18 - # XXX: this WILL fail with dna 0AV != rna A2M, which both have 1.19 - # name "2'-O-METHYLADENOSINE 5'-(DIHYDROGEN PHOSPHATE)" 1.20 - while TheMonomer.__name__ in vars(data.monomers): 1.21 + while TheMonomer.__name__ in vars(module): 1.22 TheMonomer.__name__ += "_" 1.23 - vars(data.monomers)[TheMonomer.__name__] = TheMonomer 1.24 + vars(module)[TheMonomer.__name__] = TheMonomer 1.25 if not is_modified: 1.26 cls.by_code1[code1] = TheMonomer 1.27 cls.by_code3[code3] = TheMonomer
2.1 --- a/allpy/data/monomers.py Fri Jun 10 15:33:16 2011 +0400 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,7 +0,0 @@ 2.4 -"""This module stores classes for all monomer objects. 2.5 - 2.6 -These classes are currently created on-the-fly and not stored here directly. 2.7 -For implementation details please see base.Monomer._subclass and 2.8 -base.Monomer.initialize. 2.9 -""" 2.10 -pass
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/allpy/data/monomers/__init__.py Fri Jun 10 15:37:20 2011 +0400 3.3 @@ -0,0 +1,9 @@ 3.4 +"""This package stores classes for all monomer objects. 3.5 + 3.6 +These classes are currently created on-the-fly and not stored here directly. 3.7 +For implementation details please see base.Monomer._subclass and 3.8 +base.Monomer.initialize. 3.9 +""" 3.10 +import protein 3.11 +import dna 3.12 +import rna
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/allpy/data/monomers/dna.py Fri Jun 10 15:37:20 2011 +0400 4.3 @@ -0,0 +1,5 @@ 4.4 +"""Classes for DNA monomers. 4.5 + 4.6 +Contents of this module are created on-the-fly, see `allpy.base.Monomer`. 4.7 +""" 4.8 +pass