allpy
view lib/block.py @ 158:2ed0c183867a
fix. delete sequence.pdb_files on pdb_unload. however memory leak remains
author | boris <bnagaev@gmail.com> |
---|---|
date | Thu, 28 Oct 2010 08:14:23 +0400 |
parents | 675b402094be |
children | 854e33626cbe |
line source
1 #!usr/bin/python
16 """ Block of alignment
18 Mandatory data:
19 * self.project -- project object, which the block belongs to
20 * self.sequences - set of sequence objects that contain monomers
21 and/or gaps, that constitute the block
22 * self.positions -- sorted list of positions of the project.alignment that
23 are included in the block
25 Don't change self.sequences -- it may be a link to other block.sequences
27 How to create a new block:
28 >>> import project
29 >>> import block
30 >>> proj = project.Project(open("test.fasta"))
31 >>> block1 = block.Block(proj)
32 """
35 """ Builds new block from project
37 if sequences==None, all sequences are used
38 if positions==None, all positions are used
39 """
49 """ Saves alignment to given file in fasta-format
51 No changes in the names, descriptions or order of the sequences
52 are made.
53 """
64 """ Returns length-sorted list of blocks, representing GCs
66 max_delta -- threshold of distance spreading
67 timeout -- Bron-Kerbosh timeout (then fast O(n ln n) algorithm)
68 minsize -- min size of each core
69 ac_new_atoms -- min part or new atoms in new alternative core
70 current GC is compared with each of already selected GCs
71 if difference is less then ac_new_atoms, current GC is skipped
72 difference = part of new atoms in current core
73 ac_count -- max number of cores (including main core)
74 -1 means infinity
75 If more than one pdb chain for some sequence provided, consider all of them
76 cost is calculated as 1 / (delta + 1)
77 delta in [0, +inf) => cost in (0, 1]
78 """
106 break
110 break
114 """ Returns string consisting of gap chars and chars x at self.positions
116 Length of returning string = length of project
117 """
124 """ Save xstring and name in fasta format """
128 """ Iterates monomers of this sequence from this block """
133 """ Iterates Ca-atom of monomers of this sequence from this block """
137 """ Iterates pairs (sequence, chain) """
144 """ Superimpose all pdb_chains in this block """
153 # Apply rotation/translation to the moving atoms
157 """ Save all sequences
159 Returns {(sequence, chain): CHAIN}
160 CHAIN is chain letter in new file
161 """
167 # TODO: read from tmp_file.name
168 # change CHAIN
169 # add to out_file