allpy
changeset 150:f7dead025719
documentation improvements
author | boris (netbook) <bnagaev@gmail.com> |
---|---|
date | Mon, 25 Oct 2010 13:30:11 +0400 |
parents | 85fc264975a2 |
children | 675b402094be |
files | lib/block.py lib/graph.py lib/monomer.py lib/project.py lib/sequence.py |
diffstat | 5 files changed, 20 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/lib/block.py Mon Oct 25 00:03:35 2010 +0400 1.2 +++ b/lib/block.py Mon Oct 25 13:30:11 2010 +0400 1.3 @@ -68,7 +68,7 @@ 1.4 timeout=config.timeout, minsize=config.minsize, 1.5 ac_new_atoms=config.ac_new_atoms, 1.6 ac_count=config.ac_count): 1.7 - """ returns length-sorted list of blocks, representing GCs 1.8 + """ Returns length-sorted list of blocks, representing GCs 1.9 1.10 max_delta -- threshold of distance spreading 1.11 timeout -- Bron-Kerbosh timeout (then fast O(n ln n) algorithm)
2.1 --- a/lib/graph.py Mon Oct 25 00:03:35 2010 +0400 2.2 +++ b/lib/graph.py Mon Oct 25 13:30:11 2010 +0400 2.3 @@ -51,9 +51,11 @@ 2.4 2.5 @staticmethod 2.6 def line(k1, k2): 2.7 + """ Construct object, representing line of graph """ 2.8 return frozenset([k1, k2]) 2.9 2.10 def bounded(self, k1, k2): 2.11 + """ Return if these two nodes of the graph are bounded with line """ 2.12 return k1 == k2 or Graph.line(k1, k2) in self.lines 2.13 2.14 def count_one(self, node): 2.15 @@ -94,6 +96,7 @@ 2.16 2.17 def drop_nodes(self, nodes): 2.18 """ Run drop_node for each of given nodes 2.19 + 2.20 Returns if nodes was not empty (ugly beauty) 2.21 """ 2.22 for node in nodes:
3.1 --- a/lib/monomer.py Mon Oct 25 00:03:35 2010 +0400 3.2 +++ b/lib/monomer.py Mon Oct 25 13:30:11 2010 +0400 3.3 @@ -73,6 +73,7 @@ 3.4 def from_code1(code1): 3.5 return index_code1_protein[code1.upper()] 3.6 def instance(self): 3.7 + """ Returns new AminoAcid object of this type """ 3.8 return AminoAcid(self) 3.9 3.10 3.11 @@ -86,4 +87,7 @@ 3.12 for code3, data in AAdict.items(): 3.13 code1, m_type, is_modified, none, name = data 3.14 if m_type == 'p': 3.15 - aat = AminoAcidType(name, code1, code3, is_modified) 3.16 + AminoAcidType(name, code1, code3, is_modified) 3.17 + 3.18 +del code3, data, code1, m_type, is_modified, none, name 3.19 +
4.1 --- a/lib/project.py Mon Oct 25 00:03:35 2010 +0400 4.2 +++ b/lib/project.py Mon Oct 25 13:30:11 2010 +0400 4.3 @@ -52,6 +52,7 @@ 4.4 self.sequences,self.alignment=Project.from_fasta(args[0]) 4.5 4.6 def __len__(self): 4.7 + """ Returns width, ie length of each sequence with gaps """ 4.8 return max([len(line) for line in self.alignment.values()]) 4.9 4.10 def thickness(self):
5.1 --- a/lib/sequence.py Mon Oct 25 00:03:35 2010 +0400 5.2 +++ b/lib/sequence.py Mon Oct 25 13:30:11 2010 +0400 5.3 @@ -33,9 +33,14 @@ 5.4 return len(self.monomers) 5.5 5.6 def __str__(self): 5.7 + """ Returns sequence in one-letter code """ 5.8 return ''.join([monomer.type.code1 for monomer in self.monomers]) 5.9 5.10 def __eq__(self, other): 5.11 + """ Returns if all corresponding monomers of this sequences are equal 5.12 + 5.13 + If lengths of sequences are not equal, returns False 5.14 + """ 5.15 return len(self) == len(other) and \ 5.16 all([a==b for a, b in zip(self.monomers, other.monomers)]) 5.17 5.18 @@ -61,12 +66,16 @@ 5.19 5.20 @staticmethod 5.21 def from_str(fasta_str, name='', description='', monomer_kind=AminoAcidType): 5.22 + """ Import data from one-letter code 5.23 + 5.24 + monomer_kind is class, inherited from MonomerType 5.25 + """ 5.26 monomers = [monomer_kind.from_code1(aa).instance() for aa in fasta_str] 5.27 return Sequence(monomers, name, description) 5.28 5.29 @staticmethod 5.30 def from_pdb_chain(chain): 5.31 - """ returns Sequence with Monomers with link to Bio.PDB.Residue 5.32 + """ Returns Sequence with Monomers with link to Bio.PDB.Residue 5.33 5.34 chain is Bio.PDB.Chain 5.35 """