def score_pairwise(aseq, bseq):
assert len(aseq) == len(bseq)<EOL>GAP_OPEN = -<NUM_LIT><EOL>GAP_EXTEND = -<NUM_LIT:0.5><EOL>GAP_CHARS = frozenset('<STR_LIT>')<EOL>score = <NUM_LIT:0.0><EOL>in_gap = True   <EOL>for ares, bres in zip(aseq.upper(), bseq.upper()):<EOL><INDENT>if ares in GAP_CHARS and bres in GAP_CHARS:<EOL><INDENT>continue<EOL><DEDENT>match = blosum62.get((ares, bres), None)<EOL>if match is None:<EOL><INDENT>assert GAP_CHARS.intersection((ares, bres)),"<STR_LIT>" + str((ares, bres))<EOL>if not in_gap:<EOL><INDENT>score += GAP_OPEN<EOL>in_gap = True<EOL><DEDENT>score += GAP_EXTEND<EOL><DEDENT>else:<EOL><INDENT>in_gap = False<EOL>score += match<EOL><DEDENT><DEDENT>if in_gap:<EOL><INDENT>score -= GAP_OPEN<EOL><DEDENT>return score<EOL>
Compute pairwise distances between two sequences (raw strings).