Ejemplo n.º 1
0
 def __init__(self, points, len1, len2, p3_result):
     self.p0, self.p1, self.p5, self.p6 = tuple(points)
     self.d12, self.d23, self.d34, self.d45 = tuple(len1)
     self.d02, self.d13, self.d24, self.d35, self.d46 = tuple(len2)
     self.p3o, self.p3x, self.p3y = p3_result
     self.threshold = config.get('Mezei_p24_threshold', -0.01*0.01)
     self.mode = -1
Ejemplo n.º 2
0
    def _calc_p2_p4(self, points, len1, len2, p3_result, angle):
        p0, p1, p5, p6 = tuple(points)
        d12, d23, d34, d45 = tuple(len1)
        d02, d13, d24, d35, d46 = tuple(len2)

        threshold = config.get('Mezei_p24_threshold', -0.01*0.01)

        p3o, p3x, p3y = p3_result
        p3 = p3o + p3x * cos(angle) + p3y * sin(angle)
        p2s, z2s = pyramid(p0, p1, p3, d02, d12, d23)
        if z2s < threshold:
            return None
        p4s, z4s = pyramid(p6, p5, p3, d46, d45, d34)
        if z4s < threshold:
            return None
        return (p2s, p4s)
Ejemplo n.º 3
0
    def r6_base(self, points, len1, len2, error=0.1):
        """r6_base(points, len1, len2) -> iterator

        len(points) == 4
        len(len1) == 4
        len(len2) == 5

        return all results fulfill following conditions in a iterator,
        len(result) will be 3.

        distance(points[1], result[0]) = len1[0];
        distance(result[0], result[1]) = len1[1];
        distance(result[1], result[2]) = len1[2];
        distance(result[2], points[2]) = len1[3];
        distance(points[0], result[0]) = len2[0];
        distance(points[1], result[1]) = len2[1];
        distance(result[0], result[2]) = len2[2];
        distance(result[1], points[2]) = len2[3];
        distance(result[2], points[3]) = len2[4];
        """

        assert(len(points) == 4 and
               len(len1) == 4 and
               len(len2) == 5)
        p0, p1, p5, p6 = tuple(points)
        d12, d23, d34, d45 = tuple(len1)
        d02, d13, d24, d35, d46 = tuple(len2)

        p3_result = self._calc_p3((p0, p1, p5), d13, d35)
        if p3_result is None:
            return
        p3o, p3x, p3y = p3_result

        steps = config.get('Mezei_R6_steps', 36)
        step = 2 * pi / steps

        d24s = numpy.zeros((4, steps+1), float)
        for i in range(steps):
            angle = i * step
            p24_result = self._calc_p2_p4(points, len1, len2, p3_result, angle)
            if p24_result:
                p2s, p4s = p24_result
                d24s[0][i] = tools.length(p2s[0] - p4s[0])
                d24s[1][i] = tools.length(p2s[0] - p4s[1])
                d24s[2][i] = tools.length(p2s[1] - p4s[0])
                d24s[3][i] = tools.length(p2s[1] - p4s[1])
        d24s[0][steps] = d24s[0][0]
        d24s[1][steps] = d24s[1][0]
        d24s[2][steps] = d24s[2][0]
        d24s[3][steps] = d24s[3][0]

        p24_res = self.p24_Resolver(points, len1, len2, p3_result)
        for i in range(4):
            p24_res.switch(i)
            for j in range(steps):
                if d24s[i][j] and d24s[i][j+1] and \
                       (d24s[i][j] - d24)*(d24s[i][j+1] - d24) <= 0:
                    try:
                        angle = rtbis.rtbis(p24_res, j*step, (j+1)*step, error)
                        yield (i, angle, p24_res.p2, p24_res.p3, p24_res.p4)
                    except rtbis.Error:
                        pass
Ejemplo n.º 4
0
# $Id$

from itcc.ccs2.pyramid import pyramid as _pyramid
from itcc.ccs2.config import config
from itcc.core import tools

threshold = config.get('Mezei_p24_threshold', -0.1*0.1)

def pyramid(a, b, c, rax, rbx, rcx):
    if a is None or b is None or c is None:
        return (None, None)
    res1, res2 = _pyramid(a, b, c, rax, rbx, rcx)
    if res2 < threshold:
        return (None, None)
    return res1

class Kentsis2004(object):
    def __init__(self):
        self.dismat = None
        self.atmidx = None
        
    def r(self, i1, i2):
        return self.dismat[self.atmidx[i1-1]][self.atmidx[i2-1]]
        
    def R6(self, coords, atmidx, dismat):
        '''resolve a fragment of protein:
N1-C2-C3(=O)-N4-C5-C6(=O)-N7-C8-C9(=O)

known the coords of p1, p2, p8, p9, and all the bond length and
bond length and bond angles, to calculate the coords from p3 to p7
'''