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))
def CCP4SpaceGroup(space_group_name): '''From a space group name, construct and populate a CCP4SpaceGroup object. N.B. that this will parse the spacegroup information from CCTBX to get the required information.''' string_type = type(' ') assert(type(space_group_name) is string_type) space_group_symbols = cctbx_space_group_symbols(space_group_name) space_group_number = space_group_symbols.number() space_group_name = space_group_symbols.hermann_mauguin() ccp4_space_group = _CCP4SpaceGroup( name = _XSDataString(space_group_name), number = _XSDataInteger(space_group_number)) # now unpack and populate the symmetry operations space_group = cctbx_space_group(space_group_symbols) for ltr in space_group.ltr(): for smx in space_group.smx(): symop = smx + ltr ccp4_space_group.addSymmetryOperations( CCP4SymmetryOperation(symop.as_xyz())) return ccp4_space_group
def CCP4SpaceGroup(space_group_name): '''From a space group name, construct and populate a CCP4SpaceGroup object. N.B. that this will parse the spacegroup information from CCTBX to get the required information.''' string_type = type(' ') assert (type(space_group_name) is string_type) space_group_symbols = cctbx_space_group_symbols(space_group_name) space_group_number = space_group_symbols.number() space_group_name = space_group_symbols.hermann_mauguin() ccp4_space_group = _CCP4SpaceGroup( name=_XSDataString(space_group_name), number=_XSDataInteger(space_group_number)) # now unpack and populate the symmetry operations space_group = cctbx_space_group(space_group_symbols) for ltr in space_group.ltr(): for smx in space_group.smx(): symop = smx + ltr ccp4_space_group.addSymmetryOperations( CCP4SymmetryOperation(symop.as_xyz())) return ccp4_space_group
def CCP4ReturnStatus(code = 0, message = ''): '''Generate a ccp4 return status - by default assumes all is well.''' integer_type = type(0) string_type = type(' ') assert(type(code) is integer_type) assert(type(message) is string_type) return _CCP4ReturnStatus(code = _XSDataInteger(code), message = _XSDataString(message))
def CCP4ReturnStatus(code=0, message=''): '''Generate a ccp4 return status - by default assumes all is well.''' integer_type = type(0) string_type = type(' ') assert (type(code) is integer_type) assert (type(message) is string_type) return _CCP4ReturnStatus(code=_XSDataInteger(code), message=_XSDataString(message))
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))