allpy
view lib/block.py @ 147:db9d116e979f
documentation improvements
author | boris <bnagaev@gmail.com> |
---|---|
date | Sun, 24 Oct 2010 23:12:15 +0400 |
parents | 8f1d8ece31af |
children | bc4c291cc2b0 |
line source
1 #!usr/bin/python
13 """ Block of alignment
15 Mandatory data:
16 * self.project -- project object, which the block belongs to
17 * self.sequences - set of sequence objects that contain monomers
18 and/or gaps, that constitute the block
19 * self.positions -- sorted list of positions of the project.alignment that
20 are included in the block
22 Don't change self.sequences -- it may be a link to other block.sequences
24 How to create a new block:
25 >>> import project
26 >>> import block
27 >>> proj = project.Project(open("test.fasta"))
28 >>> block1 = block.Block(proj)
29 """
32 """ Builds new block from project
34 if sequences==None, all sequences are used
35 if positions==None, all positions are used
36 """
46 """
47 Saves alignment to given file in fasta-format
48 Splits long lines to substrings of length=long_line
49 To prevent this, set long_line=None
51 No changes in the names, descriptions or order of the sequences
52 are made.
53 """
69 """
70 returns length-sorted list of blocks, representing GCs
72 max_delta -- threshold of distance spreading
73 timeout -- Bron-Kerbosh timeout (then fast O(n ln n) algorithm)
74 minsize -- min size of each core
75 ac_new_atoms -- min part or new atoms in new alternative core
76 current GC is compared with each of already selected GCs
77 if difference is less then ac_new_atoms, current GC is skipped
78 difference = part of new atoms in current core
79 ac_count -- max number of cores (including main core)
80 -1 means infinity
81 If more than one pdb chain for some sequence provided, consider all of them
82 cost is calculated as 1 / (delta + 1)
83 delta in [0, +inf) => cost in (0, 1]
84 """
110 break
114 break
118 """
119 Returns string consisting of gap chars and chars x at self.positions
120 Length of returning string = length of project
121 """
128 """
129 Save xstring and name in fasta format
130 """
137 """ Iterates monomers of this sequence from this block """
142 """ Iterates Ca-atom of monomers of this sequence from this block """
146 """ Iterates pairs (sequence, chain) """
152 """ Superimpose all pdb_chains in this block """
161 # Apply rotation/translation to the moving atoms
165 """ Superimpose all pdb_chains in this block """