119a120,159 > POLY64REVh = 0xd8000000L > CRCTableh = [0] * 256 > CRCTablel = [0] * 256 > isInitialized = False > > def CRC64(seq): > """ given a nucleotide or amino-acid secuence (or any string), > returns the CRC64 checksum. CRC64 is used by UNIPROT, EMBL and NCBI > as a checksum algorithm. > Adapted by Sebastian Bassi (sbassi AT genesdigitales.com) from > gian paolo ciceri code (Python Cookbook Receipe 259177) """ > global isInitialized > crcl = 0 > crch = 0 > if (isInitialized is not True): > isInitialized = True > for i in xrange(256): > partl = i > parth = 0L > for j in xrange(8): > rflag = partl & 1L > partl >>= 1L > if (parth & 1): > partl |= (1L << 31L) > parth >>= 1L > if rflag: > parth ^= POLY64REVh > CRCTableh[i] = parth; > CRCTablel[i] = partl; > > for item in seq: > shr = 0L > shr = (crch & 0xFF) << 24 > temp1h = crch >> 8L > temp1l = (crcl >> 8L) | shr > tableindex = (crcl ^ ord(item)) & 0xFF > > crch = temp1h ^ CRCTableh[tableindex] > crcl = temp1l ^ CRCTablel[tableindex] > return "%08X%08X" % (crch, crcl)