def get_pID(read):
try:<EOL><INDENT>return <NUM_LIT:100> * (<NUM_LIT:1> - read.get_tag("<STR_LIT>") / read.query_alignment_length)<EOL><DEDENT>except KeyError:<EOL><INDENT>try:<EOL><INDENT>return <NUM_LIT:100> * (<NUM_LIT:1> - (parse_MD(read.get_tag("<STR_LIT>")) + parse_CIGAR(read.cigartuples))<EOL>/ read.query_alignment_length)<EOL><DEDENT>except KeyError:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>except ZeroDivisionError:<EOL><INDENT>return None<EOL><DEDENT>
Return the percent identity of a read.

    based on the NM tag if present,
    if not calculate from MD tag and CIGAR string

    read.query_alignment_length can be zero in the case of ultra long reads aligned with minimap2 -L