allpy
view lib/block.py @ 150:f7dead025719
documentation improvements
author | boris (netbook) <bnagaev@gmail.com> |
---|---|
date | Mon, 25 Oct 2010 13:30:11 +0400 |
parents | 85fc264975a2 |
children | 675b402094be |
line source
1 #!usr/bin/python
15 """ Block of alignment
17 Mandatory data:
18 * self.project -- project object, which the block belongs to
19 * self.sequences - set of sequence objects that contain monomers
20 and/or gaps, that constitute the block
21 * self.positions -- sorted list of positions of the project.alignment that
22 are included in the block
24 Don't change self.sequences -- it may be a link to other block.sequences
26 How to create a new block:
27 >>> import project
28 >>> import block
29 >>> proj = project.Project(open("test.fasta"))
30 >>> block1 = block.Block(proj)
31 """
34 """ Builds new block from project
36 if sequences==None, all sequences are used
37 if positions==None, all positions are used
38 """
48 """ Saves alignment to given file in fasta-format
50 Splits long lines to substrings of length=long_line
51 To prevent this, set long_line=None
53 No changes in the names, descriptions or order of the sequences
54 are made.
55 """
71 """ Returns length-sorted list of blocks, representing GCs
73 max_delta -- threshold of distance spreading
74 timeout -- Bron-Kerbosh timeout (then fast O(n ln n) algorithm)
75 minsize -- min size of each core
76 ac_new_atoms -- min part or new atoms in new alternative core
77 current GC is compared with each of already selected GCs
78 if difference is less then ac_new_atoms, current GC is skipped
79 difference = part of new atoms in current core
80 ac_count -- max number of cores (including main core)
81 -1 means infinity
82 If more than one pdb chain for some sequence provided, consider all of them
83 cost is calculated as 1 / (delta + 1)
84 delta in [0, +inf) => cost in (0, 1]
85 """
111 break
115 break
119 """ Returns string consisting of gap chars and chars x at self.positions
121 Length of returning string = length of project
122 """
129 """ Save xstring and name in fasta format """
136 """ Iterates monomers of this sequence from this block """
141 """ Iterates Ca-atom of monomers of this sequence from this block """
145 """ Iterates pairs (sequence, chain) """
151 """ Superimpose all pdb_chains in this block """
160 # Apply rotation/translation to the moving atoms
164 """ Save all sequences
166 Returns {(sequence, chain): CHAIN}
167 CHAIN is chain letter in new file
168 """
174 # TODO: read from tmp_file.name
175 # change CHAIN
176 # add to out_file