Пример #1
0
def test_spoof_maxent_motifs():
    trials = 1000
    motif = [
        'CGGTGAACTA', 'CGGTGTGCGA', 'CGCTGTGCTG', 'CGGGATGCAA', 'CACGCTACGA',
        'CGCTATGCTA', 'CGGTTGGCTA', 'CGGCGTGCTA', 'CGGTATATTG', 'CGGGTTGCGA'
    ]
    given_ic = motif_ic(motif)  # ~ 9.05 bits
    motifs = spoof_maxent_motifs(motif, trials)
    lb, ub = mean_ci(map(motif_ic, motifs))
    assert lb < given_ic < ub
Пример #2
0
def test_spoof_motif_cftp():
    motif = [
        'CGGTGAACTA', 'CGGTGTGCGA', 'CGCTGTGCTG', 'CGGGATGCAA', 'CACGCTACGA',
        'CGCTATGCTA', 'CGGTTGGCTA', 'CGGCGTGCTA', 'CGGTATATTG', 'CGGGTTGCGA'
    ]
    given_ic = motif_ic(motif)  # ~ 9.05 bits
    motifs = spoof_motif_cftp(motif, num_motifs=1000)
    spoof_ics = map(motif_ic, motifs)
    lb, ub = mean_ci(spoof_ics)
    print lb, given_ic, ub
    assert_less_equal(lb - 1, given_ic)
    assert_less_equal(given_ic, ub + 1)
Пример #3
0
def test_spoof_motif_cftp_occ():
    motif = [
        'CGGTGAACTA', 'CGGTGTGCGA', 'CGCTGTGCTG', 'CGGGATGCAA', 'CACGCTACGA',
        'CGCTATGCTA', 'CGGTTGGCTA', 'CGGCGTGCTA', 'CGGTATATTG', 'CGGGTTGCGA'
    ]
    bio_matrix = matrix_from_motif(motif)
    N = len(motif)
    print occupancies
    mean_bio_occ = mean(occupancies(motif))
    motifs = spoof_motif_cftp_occ(motif, num_motifs=100)
    spoof_occs = map(lambda m: mean(occupancies(m)), motifs)
    lb, ub = mean_ci(spoof_occs)
    print lb, mean_bio_occ, ub
    assert_less_equal(lb, mean_bio_occ)
    assert_less_equal(mean_bio_occ, ub)
Пример #4
0
def test_spoof_maxent_motifs():
    trials = 1000
    motif = ['CGGTGAACTA',
             'CGGTGTGCGA',
             'CGCTGTGCTG',
             'CGGGATGCAA',
             'CACGCTACGA',
             'CGCTATGCTA',
             'CGGTTGGCTA',
             'CGGCGTGCTA',
             'CGGTATATTG',
             'CGGGTTGCGA']
    given_ic = motif_ic(motif) # ~ 9.05 bits
    motifs = spoof_maxent_motifs(motif,trials)
    lb, ub = mean_ci(map(motif_ic,motifs))
    assert lb < given_ic < ub
Пример #5
0
def test_spoof_motif_cftp():
    motif = ['CGGTGAACTA',
             'CGGTGTGCGA',
             'CGCTGTGCTG',
             'CGGGATGCAA',
             'CACGCTACGA',
             'CGCTATGCTA',
             'CGGTTGGCTA',
             'CGGCGTGCTA',
             'CGGTATATTG',
             'CGGGTTGCGA']
    given_ic = motif_ic(motif) # ~ 9.05 bits
    motifs = spoof_motif_cftp(motif, num_motifs=1000)
    spoof_ics = map(motif_ic, motifs)
    lb, ub = mean_ci(spoof_ics)
    print lb, given_ic, ub
    assert_less_equal(lb - 1, given_ic)
    assert_less_equal(given_ic, ub + 1)
Пример #6
0
def test_spoof_motif_cftp_occ():
    motif = ['CGGTGAACTA',
             'CGGTGTGCGA',
             'CGCTGTGCTG',
             'CGGGATGCAA',
             'CACGCTACGA',
             'CGCTATGCTA',
             'CGGTTGGCTA',
             'CGGCGTGCTA',
             'CGGTATATTG',
             'CGGGTTGCGA']
    bio_matrix = matrix_from_motif(motif)
    N = len(motif)
    print occupancies
    mean_bio_occ = mean(occupancies(motif))
    motifs = spoof_motif_cftp_occ(motif, num_motifs=100)
    spoof_occs = map(lambda m:mean(occupancies(m)), motifs)
    lb, ub = mean_ci(spoof_occs)
    print lb, mean_bio_occ, ub
    assert_less_equal(lb, mean_bio_occ)
    assert_less_equal(mean_bio_occ, ub)
Пример #7
0
def test_maxent_motif():
    trials = 1000
    N, L, desired_ic = 10, 10, 10
    motifs = [maxent_motif(N, L, desired_ic) for i in trange(trials)]
    lb, ub = mean_ci(map(motif_ic, motifs))
    assert lb < desired_ic < ub
Пример #8
0
def test_maxent_motif():
    trials = 1000
    N, L, desired_ic = 10,10,10
    motifs = [maxent_motif(N,L,desired_ic) for i in trange(trials)]
    lb, ub = mean_ci(map(motif_ic,motifs))
    assert lb < desired_ic < ub