def badness(self): """ The Jim Kent Badness score, attempts to calculate how bad this alignment is https://github.com/ucscGenomeBrowser/kent/blob/fb80e018778062c49021f2c35607868df1054e8e/src/hg/pslCDnaFilter/cDnaAligns.c#L52-L70 (mismatch + ref_insert + 3 * log(1 + max(ref_size - tgt_size, 0))) / (match + mismatch + repmatch) :return: A float between 0 and 1 where 1 is very bad """ b = format_ratio(self.mismatches + self.q_num_insert + 3 * math.log(1 + abs(self.q_size - self.t_size)), self.matches + self.mismatches + self.repmatches, num_digits=5, resolve_nan=1) return min(b, 1)
def coverage(self): return format_ratio(self.matches + self.mismatches + self.repmatches, self.q_size, num_digits=5, resolve_nan=0)
def percent_n(self): return format_ratio(self.n_count, self.q_size, num_digits=5)
def target_identity(self): return format_ratio(self.matches + self.repmatches, self.matches + self.repmatches + self.mismatches + self.q_base_insert + self.t_base_insert, num_digits=5, resolve_nan=0)