allpy
view lib/block.py @ 140:e10310ed076c
geometrical_core.py: run building of GCs
author | boris <bnagaev@gmail.com> |
---|---|
date | Sun, 24 Oct 2010 18:15:41 +0400 |
parents | d2b53635be05 |
children | a0ff92b78b6a |
line source
1 #!usr/bin/python
12 """
13 Mandatory data:
14 * self.project -- project object, which the block belongs to
15 * self.sequences - set of sequence objects that contain monomers
16 and/or gaps, that constitute the block
17 * self.positions -- sorted list of positions of the project.alignment that
18 are included in the block
20 Don't change self.sequences -- it may be a link to other block.sequences
22 How to create a new block:
23 >>> import project
24 >>> import block
25 >>> proj = project.Project(open("test.fasta"))
26 >>> block1 = block.Block(proj)
27 """
30 """
31 Builds new block from project
32 if sequences==None, all sequences are used
33 if positions==None, all positions are used
34 """
44 """
45 Saves alignment to given file in fasta-format
46 Splits long lines to substrings of length=long_line
47 To prevent this, set long_line=None
49 No changes in the names, descriptions or order of the sequences
50 are made.
51 """
67 """
68 returns length-sorted list of blocks, representing GCs
70 max_delta -- threshold of distance spreading
71 timeout -- Bron-Kerbosh timeout (then fast O(n ln n) algorithm)
72 minsize -- min size of each core
73 ac_new_atoms -- min part or new atoms in new alternative core
74 current GC is compared with each of already selected GCs
75 if difference is less then ac_new_atoms, current GC is skipped
76 difference = part of new atoms in current core
77 ac_count -- max number of cores (including main core)
78 -1 means infinity
79 If more than one pdb chain for some sequence provided, consider all of them
80 cost is calculated as 1 / (delta + 1)
81 delta in [0, +inf) => cost in (0, 1]
82 """
108 break
112 break
116 """
117 Returns string consisting of gap chars and chars x at self.positions
118 Length of returning string = length of project
119 """
126 """
127 Save xstring and name in fasta format
128 """