ribolands/pathfinder.py
def mfe_intersect(seq, md, bps, fc_empty = None):
    """ Return the MFE structure given allowed base pairs.

    Makes a temporary fold compound where all bases are forbidden and only the
    specified base-pairs are allowed. If fc is specified (for efficiency
    reasons only), then it is assumed that all base-pairs are already forbiden!
    The function will return the fold compund with forbidden base-pairs again.
    """
    fc_tmp = fc_empty is None 
    if fc_empty is None:
        fc_empty = forbid_all_basepairs(seq, RNA.fold_compound(seq, md))

    for bp in bps: # enable base pairs
        fc_empty.hc_add_bp(bp[0], bp[1], RNA.CONSTRAINT_CONTEXT_ALL_LOOPS | RNA.CONSTRAINT_CONTEXT_NO_REMOVE)
    mss, mfe = fc_empty.mfe()

    if fc_tmp:
        del fc_empty
    else:
        for bp in bps:
            fc_empty.hc_add_bp(bp[0], bp[1], RNA.CONSTRAINT_CONTEXT_NONE | RNA.CONSTRAINT_CONTEXT_NO_REMOVE)
    return mss, int(round(mfe * 100))
 Return the MFE structure given allowed base pairs.

    Makes a temporary fold compound where all bases are forbidden and only the
    specified base-pairs are allowed. If fc is specified (for efficiency
    reasons only), then it is assumed that all base-pairs are already forbiden!
    The function will return the fold compund with forbidden base-pairs again.
    
Return the MFE structure given allowed base pairs.
Makes a temporary fold compound where all bases are forbidden and only the
specified base-pairs are allowed. If fc is specified (for efficiency
reasons only), then it is assumed that all base-pairs are already forbiden.
The function will return the fold compund with forbidden base-pairs again.
Return the MFE structure given allowed base pairs . Makes a temporary fold compound where all bases are forbidden and only the specified base - pairs are allowed . If fc is specified ( for efficiency reasons only ) then it is assumed that all base - pairs are already forbiden . The function will return the fold compund with forbidden base - pairs again .
def mfe_intersect(seq, md, bps, fc_empty = None):
    fc_tmp = fc_empty is None 
    if fc_empty is None:
        fc_empty = forbid_all_basepairs(seq, RNA.fold_compound(seq, md))
    for bp in bps: 
        fc_empty.hc_add_bp(bp[0], bp[1], RNA.CONSTRAINT_CONTEXT_ALL_LOOPS | RNA.CONSTRAINT_CONTEXT_NO_REMOVE)
    mss, mfe = fc_empty.mfe()
    if fc_tmp:
        del fc_empty
    else:
        for bp in bps:
            fc_empty.hc_add_bp(bp[0], bp[1], RNA.CONSTRAINT_CONTEXT_NONE | RNA.CONSTRAINT_CONTEXT_NO_REMOVE)
    return mss, int(round(mfe * 100))
def mfe_intersect ( seq , md , bps , fc_empty = None ) : fc_tmp = fc_empty is None if fc_empty is None : fc_empty = forbid_all_basepairs ( seq , RNA . fold_compound ( seq , md ) ) for bp in bps : fc_empty . hc_add_bp ( bp [ 0 ] , bp [ 1 ] , RNA . CONSTRAINT_CONTEXT_ALL_LOOPS | RNA . CONSTRAINT_CONTEXT_NO_REMOVE ) mss , mfe = fc_empty . mfe ( ) if fc_tmp : del fc_empty else : for bp in bps : fc_empty . hc_add_bp ( bp [ 0 ] , bp [ 1 ] , RNA . CONSTRAINT_CONTEXT_NONE | RNA . CONSTRAINT_CONTEXT_NO_REMOVE ) return mss , int ( round ( mfe * 100 ) )
Return the MFE structure given allowed base pairs.
Return the MFE structure given allowed base pairs .
""" Return the MFE structure given allowed base pairs.

    Makes a temporary fold compound where all bases are forbidden and only the
    specified base-pairs are allowed. If fc is specified (for efficiency
    reasons only), then it is assumed that all base-pairs are already forbiden!
    The function will return the fold compund with forbidden base-pairs again.
    """ # enable base pairs
seq
md
bps
fc_empty