def from_locus_read(cls, locus_read, n_ref):
        sequence = locus_read.sequence
        reference_positions = locus_read.reference_positions
        read_pos_before = locus_read.base0_read_position_before_variant
        read_pos_after = locus_read.base0_read_position_after_variant
        ref_pos_before = reference_positions[read_pos_before]
        if ref_pos_before is None:
            logger.warn(
                "Missing reference pos for nucleotide before variant on read: %s",
                locus_read)
            return None
        ref_pos_after = reference_positions[read_pos_after]
        if ref_pos_after is None:
            logger.warn(
                "Missing reference pos for nucleotide after variant on read: %s",
                locus_read)
            return None
        if n_ref == 0:
            if ref_pos_after - ref_pos_before != 1:
                logger.debug(
                    "Positions before (%d) and after (%d) variant should be adjacent on read %s",
                    ref_pos_before,
                    ref_pos_after,
                    locus_read)
                return None
            ref_positions_for_inserted = reference_positions[
                read_pos_before + 1:read_pos_after]
            if any(insert_pos is not None for insert_pos in ref_positions_for_inserted):
                logger.debug(
                    "Skipping read, inserted nucleotides shouldn't map to reference")
                return None
        else:
            if ref_pos_after - ref_pos_before != n_ref + 1:
                logger.debug(
                    ("Positions before (%d) and after (%d) variant should be "
                     "adjacent on read %s"),
                    ref_pos_before,
                    ref_pos_after,
                    locus_read)
                return None
        nucleotides_at_variant_locus = sequence[read_pos_before + 1:read_pos_after]
        prefix = sequence[:read_pos_before + 1]
        suffix = sequence[read_pos_after:]
        prefix, suffix = convert_from_bytes_if_necessary(prefix, suffix)
        prefix, suffix = trim_N_nucleotides(prefix, suffix)
        return cls(
            prefix,
            nucleotides_at_variant_locus,
            suffix,
            name=locus_read.name)