def _annotate(reads, mirbase_ref, precursors):
for r in reads:<EOL><INDENT>for p in reads[r].precursors:<EOL><INDENT>start = reads[r].precursors[p].start + <NUM_LIT:1>  <EOL>end = start + len(reads[r].sequence)<EOL>for mature in mirbase_ref[p]:<EOL><INDENT>mi = mirbase_ref[p][mature]<EOL>is_iso = _coord(reads[r].sequence, start, mi, precursors[p], reads[r].precursors[p])<EOL>logger.debug(("<STR_LIT>").format(s=reads[r].sequence, mature_s=precursors[p][mi[<NUM_LIT:0>]-<NUM_LIT:1>:mi[<NUM_LIT:1>]], **locals()))<EOL>if is_iso:<EOL><INDENT>reads[r].precursors[p].mirna = mature<EOL>break<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return reads<EOL>
Using SAM/BAM coordinates, mismatches and realign to annotate isomiRs