Esempio n. 1
0
def CCP4Sequence(aa_sequence):
    '''From a list of amino acids as three letter codes construct the
    one-letter code, number of residues and total mass.'''

    list_type = type([])

    assert(type(aa_sequence) is list_type)

    three_to_one = {'CYS': 'C', 'ASP': 'D', 'SER': 'S', 'GLN': 'Q',
                    'LYS': 'K', 'ILE': 'I', 'PRO': 'P', 'THR': 'T',
                    'PHE': 'F', 'ALA': 'A', 'GLY': 'G', 'HIS': 'H',
                    'GLU': 'E', 'LEU': 'L', 'ARG': 'R', 'TRP': 'W',
                    'VAL': 'V', 'ASN': 'N', 'TYR': 'Y', 'MET': 'M',
                    'MSE': 'M'}

    three_to_mass = {'CYS': 121, 'ASP': 133, 'SER': 105, 'GLN': 146,
                     'LYS': 146, 'ASN': 132, 'PRO': 115, 'THR': 119,
                     'PHE': 165, 'ALA': 89,  'HIS': 155, 'GLY': 75,
                     'ILE': 131, 'LEU': 131, 'ARG': 174, 'TRP': 204,
                     'VAL': 117, 'GLU': 147, 'TYR': 181, 'MET': 149,
                     'MSE': 149}
    
    sequence = ''
    mass = 0
    number = 0

    for aa in aa_sequence:
        sequence += three_to_one[aa]
        mass += three_to_mass[aa]
        number += 1

    return _CCP4Sequence(oneLetterCode = _XSDataString(sequence),
                         numberOfResidues = _XSDataInteger(number),
                         molecularMass = _XSDataFloat(mass))
Esempio n. 2
0
def CCP4ResolutionLimit(resolution_limit):
    '''Construct a resolution limit object.'''

    float_type = type(0.0)

    assert (type(resolution_limit) is float_type)

    return _CCP4ResolutionLimit(resolution=_XSDataFloat(resolution_limit))
Esempio n. 3
0
def CCP4ResolutionLimit(resolution_limit):
    '''Construct a resolution limit object.'''

    float_type = type(0.0)

    assert(type(resolution_limit) is float_type)

    return _CCP4ResolutionLimit(
        resolution = _XSDataFloat(resolution_limit))
Esempio n. 4
0
def CCP4UnitCell(a, b, c, alpha, beta, gamma):
    '''Usefully create a unit cell object from the Python floats for the
    cell constants. N.B. for reasons unclear this must first pun the floats.'''

    float_type = type(0.0)

    assert (type(a) is float_type)
    assert (type(b) is float_type)
    assert (type(c) is float_type)
    assert (type(alpha) is float_type)
    assert (type(beta) is float_type)
    assert (type(gamma) is float_type)

    _a = _XSDataFloat(a)
    _b = _XSDataFloat(b)
    _c = _XSDataFloat(c)
    _alpha = _XSDataFloat(alpha)
    _beta = _XSDataFloat(beta)
    _gamma = _XSDataFloat(gamma)

    return _CCP4UnitCell(a=_a,
                         b=_b,
                         c=_c,
                         alpha=_alpha,
                         beta=_beta,
                         gamma=_gamma)
Esempio n. 5
0
def CCP4UnitCell(a, b, c, alpha, beta, gamma):
    '''Usefully create a unit cell object from the Python floats for the
    cell constants. N.B. for reasons unclear this must first pun the floats.'''

    float_type = type(0.0)

    assert(type(a) is float_type)
    assert(type(b) is float_type)
    assert(type(c) is float_type)
    assert(type(alpha) is float_type)
    assert(type(beta) is float_type)
    assert(type(gamma) is float_type)

    _a = _XSDataFloat(a)
    _b = _XSDataFloat(b)
    _c = _XSDataFloat(c)
    _alpha = _XSDataFloat(alpha)
    _beta = _XSDataFloat(beta)
    _gamma = _XSDataFloat(gamma)

    return _CCP4UnitCell(a = _a, b = _b, c = _c,
                         alpha = _alpha, beta = _beta, gamma = _gamma)
Esempio n. 6
0
def CCP4RTMatrix(e11, e12, e13,
                 e21, e22, e23,
                 e31, e32, e33,
                 e41, e42, e43):
    '''A useful constructor for RT matrices.'''
    
    float_type = type(0.0)

    assert(type(e11) is float_type)
    assert(type(e12) is float_type)
    assert(type(e13) is float_type)
    assert(type(e21) is float_type)
    assert(type(e22) is float_type)
    assert(type(e23) is float_type)
    assert(type(e31) is float_type)
    assert(type(e32) is float_type)
    assert(type(e33) is float_type)
    assert(type(e41) is float_type)
    assert(type(e42) is float_type)
    assert(type(e43) is float_type)

    _e11 = _XSDataFloat(e11)
    _e12 = _XSDataFloat(e12)
    _e13 = _XSDataFloat(e13)
    _e21 = _XSDataFloat(e21)
    _e22 = _XSDataFloat(e22)
    _e23 = _XSDataFloat(e23)
    _e31 = _XSDataFloat(e31)
    _e32 = _XSDataFloat(e32)
    _e33 = _XSDataFloat(e33)
    _e41 = _XSDataFloat(e41)
    _e42 = _XSDataFloat(e42)
    _e43 = _XSDataFloat(e43)

    return _CCP4RTMatrix(e11 = _e11,  e12 = _e12,  e13 = _e13,
                         e21 = _e21,  e22 = _e22,  e23 = _e23,
                         e31 = _e31,  e32 = _e32,  e33 = _e33,
                         e41 = _e41,  e42 = _e42,  e43 = _e43)
Esempio n. 7
0
def CCP4RTMatrix(e11, e12, e13, e21, e22, e23, e31, e32, e33, e41, e42, e43):
    '''A useful constructor for RT matrices.'''

    float_type = type(0.0)

    assert (type(e11) is float_type)
    assert (type(e12) is float_type)
    assert (type(e13) is float_type)
    assert (type(e21) is float_type)
    assert (type(e22) is float_type)
    assert (type(e23) is float_type)
    assert (type(e31) is float_type)
    assert (type(e32) is float_type)
    assert (type(e33) is float_type)
    assert (type(e41) is float_type)
    assert (type(e42) is float_type)
    assert (type(e43) is float_type)

    _e11 = _XSDataFloat(e11)
    _e12 = _XSDataFloat(e12)
    _e13 = _XSDataFloat(e13)
    _e21 = _XSDataFloat(e21)
    _e22 = _XSDataFloat(e22)
    _e23 = _XSDataFloat(e23)
    _e31 = _XSDataFloat(e31)
    _e32 = _XSDataFloat(e32)
    _e33 = _XSDataFloat(e33)
    _e41 = _XSDataFloat(e41)
    _e42 = _XSDataFloat(e42)
    _e43 = _XSDataFloat(e43)

    return _CCP4RTMatrix(e11=_e11,
                         e12=_e12,
                         e13=_e13,
                         e21=_e21,
                         e22=_e22,
                         e23=_e23,
                         e31=_e31,
                         e32=_e32,
                         e33=_e33,
                         e41=_e41,
                         e42=_e42,
                         e43=_e43)
Esempio n. 8
0
def CCP4Sequence(aa_sequence):
    '''From a list of amino acids as three letter codes construct the
    one-letter code, number of residues and total mass.'''

    list_type = type([])

    assert (type(aa_sequence) is list_type)

    three_to_one = {
        'CYS': 'C',
        'ASP': 'D',
        'SER': 'S',
        'GLN': 'Q',
        'LYS': 'K',
        'ILE': 'I',
        'PRO': 'P',
        'THR': 'T',
        'PHE': 'F',
        'ALA': 'A',
        'GLY': 'G',
        'HIS': 'H',
        'GLU': 'E',
        'LEU': 'L',
        'ARG': 'R',
        'TRP': 'W',
        'VAL': 'V',
        'ASN': 'N',
        'TYR': 'Y',
        'MET': 'M',
        'MSE': 'M'
    }

    three_to_mass = {
        'CYS': 121,
        'ASP': 133,
        'SER': 105,
        'GLN': 146,
        'LYS': 146,
        'ASN': 132,
        'PRO': 115,
        'THR': 119,
        'PHE': 165,
        'ALA': 89,
        'HIS': 155,
        'GLY': 75,
        'ILE': 131,
        'LEU': 131,
        'ARG': 174,
        'TRP': 204,
        'VAL': 117,
        'GLU': 147,
        'TYR': 181,
        'MET': 149,
        'MSE': 149
    }

    sequence = ''
    mass = 0
    number = 0

    for aa in aa_sequence:
        sequence += three_to_one[aa]
        mass += three_to_mass[aa]
        number += 1

    return _CCP4Sequence(oneLetterCode=_XSDataString(sequence),
                         numberOfResidues=_XSDataInteger(number),
                         molecularMass=_XSDataFloat(mass))