PEATSA/Core/Utilities.py
def ParseStandardMutationCode(mutationCode, extended=False):

	'''Parses an mutation code returning the chain, residueIndex (as an int) and mutationName (non-extended format)
	
	If the mutationCode is in extended format this function additionally returns the residueName before the mutationName
	See CreateExtendedResidueCode for information on the extended residue code format.
	
	Raises an IndexError if the residue code is not in the correct format'''
	
	mutationCode = mutationCode.strip(" ")
	
	components = mutationCode.split(':')
	try:
		if components[1] != '0000':
			data = (components[0], int(components[1].lstrip('0'))) + tuple(components[2:])
		else:
			data = (components[0], int(components[1])) + tuple(components[2:])	
	except BaseException, data:
		raise Exceptions.MutationCodeFormatError, 'Mutation Code is %s. Invalid for standard format' % mutationCode

	if len(data) > 4 or len(data) < 3:
		raise Exceptions.MutationCodeFormatError, 'Mutation Code is %s. Invalid for standard format - incorrect number of components' % mutationCode
	
	return data
Parses an mutation code returning the chain, residueIndex (as an int) and mutationName (non-extended format)
	
	If the mutationCode is in extended format this function additionally returns the residueName before the mutationName
	See CreateExtendedResidueCode for information on the extended residue code format.
	
	Raises an IndexError if the residue code is not in the correct format
Parses an mutation code returning the chain, residueIndex (as an int) and mutationName (non-extended format)
If the mutationCode is in extended format this function additionally returns the residueName before the mutationName
See CreateExtendedResidueCode for information on the extended residue code format.

Raises an IndexError if the residue code is not in the correct format
Parses an mutation code returning the chain residueIndex ( as an int ) and mutationName ( non - extended format ) If the mutationCode is in extended format this function additionally returns the residueName before the mutationName See CreateExtendedResidueCode for information on the extended residue code format . Raises an IndexError if the residue code is not in the correct format
def ParseStandardMutationCode(mutationCode, extended=False):
	mutationCode = mutationCode.strip(" ")
	components = mutationCode.split(':')
	try:
		if components[1] != '0000':
			data = (components[0], int(components[1].lstrip('0'))) + tuple(components[2:])
		else:
			data = (components[0], int(components[1])) + tuple(components[2:])	
	except BaseException, data:
		raise Exceptions.MutationCodeFormatError, 'Mutation Code is %s. Invalid for standard format' % mutationCode
	if len(data) > 4 or len(data) < 3:
		raise Exceptions.MutationCodeFormatError, 'Mutation Code is %s. Invalid for standard format - incorrect number of components' % mutationCode
	return data
def ParseStandardMutationCode ( mutationCode , extended = False ) : mutationCode = mutationCode . strip ( " " ) components = mutationCode . split ( ':' ) try : if components [ 1 ] != '0000' : data = ( components [ 0 ] , int ( components [ 1 ] . lstrip ( '0' ) ) ) + tuple ( components [ 2 : ] ) else : data = ( components [ 0 ] , int ( components [ 1 ] ) ) + tuple ( components [ 2 : ] ) except BaseException , data : raise Exceptions . MutationCodeFormatError , 'Mutation Code is %s. Invalid for standard format' % mutationCode if len ( data ) > 4 or len ( data ) < 3 : raise Exceptions . MutationCodeFormatError , 'Mutation Code is %s. Invalid for standard format - incorrect number of components' % mutationCode return data
Parses an mutation code returning the chain, residueIndex (as an int) and mutationName (non-extended format)
If the mutationCode is in extended format this function additionally returns the residueName before the mutationName
See CreateExtendedResidueCode for information on the extended residue code format.
Parses an mutation code returning the chain residueIndex ( as an int ) and mutationName ( non - extended format ) If the mutationCode is in extended format this function additionally returns the residueName before the mutationName See CreateExtendedResidueCode for information on the extended residue code format .
'''Parses an mutation code returning the chain, residueIndex (as an int) and mutationName (non-extended format)
	
	If the mutationCode is in extended format this function additionally returns the residueName before the mutationName
	See CreateExtendedResidueCode for information on the extended residue code format.
	
	Raises an IndexError if the residue code is not in the correct format'''
mutationCode
extended