allpy
view allpy/_monomer.py @ 253:2b324332f6f7
Fixed ReST markup in allpy.data.codes
| author | Daniil Alexeyevsky <me.dendik@gmail.com> |
|---|---|
| date | Mon, 13 Dec 2010 22:16:04 +0300 |
| parents | 9369dbad919d |
| children | 994b1a44bfc3 |
line source
1 #!/usr/bin/python
6 """Class of monomer types.
8 Each MonomerType object represents a known monomer type, e.g. Valine,
9 and is referenced to by each instance of monomer in a given sequence.
11 - `name`: full name of monomer type
12 - `code1`: one-letter code
13 - `code3`: three-letter code
14 - `is_modified`: either of True or False
16 class atributes:
17 - `by_code1`: a mapping from one-letter code to MonomerType object
18 - `by_code3`: a mapping from three-letter code to MonomerType object
19 - `by_name`: a mapping from monomer name to MonomerType object
20 - `instance_type`: class of Monomer objects to use when creating new
21 objects; this must be redefined in descendent classes
23 All of the class attributes MUST be redefined when subclassing.
24 """
40 # We duplicate distinguished long names into MonomerType itself,
41 # so that we can use MonomerType.from_code3 to create the relevant
42 # type of monomer.
46 @classmethod
48 """Create all relevant instances of MonomerType.
50 `type_letter` is either of:
51 - 'p' for protein
52 - 'd' for DNA
53 - 'r' for RNA
55 `codes` is a table of monomer codes
56 """
61 @classmethod
63 """Return monomer type by one-letter code."""
66 @classmethod
68 """Return monomer type by three-letter code."""
71 @classmethod
73 """Return monomer type by name."""
77 """Create a new monomer of given type."""
86 """Monomer object.
88 attributes:
89 - `type`: type of monomer (a MonomerType object)
91 class attribute `monomer_type` is MonomerType or either of it's subclasses,
92 it is used when creating new monomers. It MUST be redefined when subclassing Monomer.
93 """
99 @classmethod
103 @classmethod
107 @classmethod
116 # vim: set ts=4 sts=4 sw=4 et:
