Skip to content

Generator.py problem: Always mismatch for reverse strand #101

Description

@zhenzuo2
def _incorp_snp(seq, var, transId, pos, offset, isReverse=False):
    """
    Incorporates a snp into the given :class:`~epytope.Core.Transcript.Transcript` sequence (side effect!).

    :param list(char) seq: :class:`~epytope.Core.Transcript.Transcript` sequence as a list
    :param  var: The snp variant to incorporate
    :type var: :class:`~epytope.Core.Variant.Variant`
    :param str transId: The transcript ID of seq
    :param int pos: The position of the variant
    :param int offset: The offset which has to be added onto the :class:`~epytope.Core.Transcript.Transcript` position of
                       the :class:`~epytope.Core.Variant.Variant`
    :param bool isReverse: Defines whether current transcript is reverse oriented
    :return: The the modified offset
    :rtype: int
    """
    if VariationType.SNP != var.type:
        raise TypeError("%s is not a SNP"%str(var))
   
    ref = var.ref[::-1].translate(COMPLEMENT) if isReverse else var.ref
    obs = var.obs[::-1].translate(COMPLEMENT) if isReverse else var.obs

    #print transId, len(seq), var.get_transcript_position(transId)-1
    if seq[pos] != ref:
        warnings.warn("For %s bp does not match ref of assigned variant %s. Pos %i, var ref %s, seq ref %s " % (
        transId, str(var), pos, ref,
        seq[pos]))

    seq[pos] = obs

    return offset

This warnings always show up for reverse strand

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions