def _replace_reference(self, var):
if var.type not in "<STR_LIT>":<EOL><INDENT>raise HGVSUnsupportedOperationError("<STR_LIT>")<EOL><DEDENT>if var.posedit.edit.type == "<STR_LIT>":<EOL><INDENT>return var<EOL><DEDENT>if var.posedit.edit.type == "<STR_LIT>":<EOL><INDENT>return var<EOL><DEDENT>pos = var.posedit.pos<EOL>if ((isinstance(pos.start, hgvs.location.BaseOffsetPosition) and pos.start.offset != <NUM_LIT:0>)<EOL>or (isinstance(pos.end, hgvs.location.BaseOffsetPosition) and pos.end.offset != <NUM_LIT:0>)):<EOL><INDENT>_logger.info("<STR_LIT>".format(var))<EOL>return var<EOL><DEDENT>if var.type == "<STR_LIT:c>":<EOL><INDENT>tm = self._fetch_AlignmentMapper(<EOL>tx_ac=var.ac, alt_ac=var.ac, alt_aln_method="<STR_LIT>")<EOL>pos = tm.c_to_n(var.posedit.pos)<EOL><DEDENT>else:<EOL><INDENT>pos = var.posedit.pos<EOL><DEDENT>seq = self.hdp.get_seq(var.ac, pos.start.base - <NUM_LIT:1>, pos.end.base)<EOL>edit = var.posedit.edit<EOL>if edit.ref != seq:<EOL><INDENT>_logger.debug("<STR_LIT>".format(<EOL>var=var, seq=seq))<EOL>edit.ref = seq<EOL><DEDENT>return var<EOL>
fetch reference sequence for variant and update (in-place) if necessary