def cseguid(seq): '''Returns the cSEGUID for the sequence. The cSEGUID is the url safe SEGUID checksum calculated for the lexicographically minimal string rotation of a DNA sequence. Only defined for circular sequences. ''' from Bio.Seq import reverse_complement as rc return pretty_string( seguid( min( SmallestRotation(str(seq).upper()), SmallestRotation(str(rc(seq)).upper()))))
def seguid(seq): '''Returns the url safe SEGUID checksum for the sequence. This is the SEGUID checksum with the '+' and '/' characters of standard Base64 encoding are respectively replaced by '-' and '_'. ''' return pretty_string( base64_seguid( str(seq).upper() ).replace("+","-").replace("/","_") )