[Biopython] IUPAC code contribution
Michal
mictadlo at gmail.com
Mon Jun 6 21:52:21 UTC 2011
Hello,
I would like to contribute the following IUPAC function to Biopython:
def iupac_base(alignment):
IUPAC = {
ord('N'): 'N',
ord('G'): 'G',
ord('A'): 'A',
ord('T'): 'T',
ord('C'): 'C',
ord('G') + ord('A'): 'R',
ord('T') + ord('C'): 'Y',
ord('A') + ord('C'): 'M',
ord('G') + ord('T'): 'K',
ord('G') + ord('C'): 'S',
ord('A') + ord('T'): 'W',
ord('A') + ord('C') + ord('T'): 'H',
ord('G') + ord('T') + ord('C'): 'B',
ord('G') + ord('C') + ord('A'): 'V',
ord('G') + ord('A') + ord('T'): 'D',
ord('G') + ord('A') + ord('T') + ord('C'): 'N'}
return IUPAC[sum(map(ord, {}.fromkeys(alignment).keys()))]
a = iupac_base(['A','A','T','T','T'])
Cheers,
Michal
More information about the Biopython
mailing list