Ejemplo n.º 1
0
    def __init__(self, pwm_list=[], stddev=0.05, seed=None):
        if len(pwm_list) > 0 and isinstance(pwm_list[0], dict):
            pwm_list = [PWM.from_config(pwm) for pwm in pwm_list]

        self.stddev = stddev
        self.seed = seed
        self.pwm_list = pwm_list
        _check_pwm_list(pwm_list)
Ejemplo n.º 2
0
    def __init__(self, pwm_list=[], kernel_size=None, mean_max_scale=0.):
        # handle pwm_list as a dictionary
        if len(pwm_list) > 0 and isinstance(pwm_list[0], dict):
            pwm_list = [PWM.from_config(pwm) for pwm in pwm_list]

        if kernel_size is None:
            kernel_size = len(pwm_list)

        self.pwm_list = pwm_list
        self.kernel_size = kernel_size
        self.mean_max_scale = mean_max_scale
        _check_pwm_list(pwm_list)
Ejemplo n.º 3
0
    def __init__(self,
                 pwm_list=[],
                 stddev=0.05,
                 seed=None,
                 background_probs=DEFAULT_BASE_BACKGROUND,
                 add_noise_before_Pwm2Pssm=True):
        if len(pwm_list) > 0 and isinstance(pwm_list[0], dict):
            pwm_list = [PWM.from_config(pwm) for pwm in pwm_list]

        self.pwm_list = pwm_list
        _check_pwm_list(pwm_list)
        self.stddev = stddev
        self.seed = seed
        self.background_probs = background_probs
        self.add_noise_before_Pwm2Pssm = add_noise_before_Pwm2Pssm
Ejemplo n.º 4
0
    def __init__(self,
                 pwm_list=[],
                 kernel_size=None,
                 mean_max_scale=0.,
                 background_probs=DEFAULT_BASE_BACKGROUND):

        # handle pwm_list as a dictionary
        if len(pwm_list) > 0 and isinstance(pwm_list[0], dict):
            pwm_list = [PWM.from_config(pwm) for pwm in pwm_list]

        if kernel_size is None:
            kernel_size = len(pwm_list)

        _check_pwm_list(pwm_list)
        self.pwm_list = pwm_list
        self.kernel_size = kernel_size
        self.mean_max_scale = mean_max_scale
        self.background_probs = background_probs
Ejemplo n.º 5
0
def get_branchpoint_pwm_list(cache=True):
    l = []
    if os.path.isfile(BR_PWM) and cache:
        l.append(PWM.from_config(read_json(BR_PWM)))
    else:
        dt = pd.read_csv(
            DATA_ROOT +
            "/Splice_branchpoints/processed/branchpointer/train/filteredDescr.csv"
        )
        # colmeans
        dt = dt[dt.set == "HC"]
        dtseq = dt[dt.columns[dt.columns.str.match("^seq_")]] - 1
        pwm = np.array(dtseq.mean()).reshape((-1, 4))
        assert np.allclose(pwm.sum(1), 1)
        p = PWM(pwm, name="U2_branchpoint")
        write_json(p.get_config(), BR_PWM)
        l.append(p)
    l.append(
        PWM(0.05 + np.loadtxt(BR_SPLICE_RACK_PATH + "/GT_AG_U12.txt"),
            "GT_AG_U12_branchpoint"))
    return l