Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Creates a residue code from a chain id and residue number and optionally a name

A normal residue code has the form ChainID:ResidueIndex where the residue index is a
string of length 4 left padded with zeros.
For example passing A, 4 return A:0004.

If a name is passed an extended residue code is returned. This has the format
ChainID:ResidueIndex(Padded):ResidueName

        def CreateResidueCode(chain, number, name=None):

	'''Creates a residue code from a chain id and residue number and optionally a name
	
	A normal residue code has the form ChainID:ResidueIndex where the residue index is a
	string of length 4 left padded with zeros.
	For example passing A, 4 return A:0004.
	
	If a name is passed an extended residue code is returned. This has the format
	ChainID:ResidueIndex(Padded):ResidueName'''
	
	if name is None:
		return  chain + ":" + "0"*(4 - len(str(number))) + str(number)
	else:
		return chain + ":" + "0"*(4 - len(str(number))) + str(number) + ":" + name
        


src/p/e/PEATDB-2.3/PEATDB/Actions.py   PEATDB(Download)
        codemap  = Utilities.InvertedCodeDictionary()
        codes = [codemap[el] for el in list(seq)]
        indexes = [Utilities.CreateResidueCode(chain=chain, number=index) for index in range(1, len(seq) + 1)]        
        return zip(indexes, codes)