示例#1
0
def pipeline_degree(g, essential_proteins):
    thresholds = (1, 2)  # TODO
    protein_count_total     = []  # number of proteins with a degree >= threshold
    protein_count_essential = []  # same for essential proteins
    degrees = centrality_degree(g)
    for threshold in thresholds:
        protein_count_total.append(0)
        protein_count_essential.append(0)
        for vertex, degree in degrees:
            if degree >= threshold:
                if vertex.attributes()['name'] in essential_proteins:
                    protein_count_essential[-1] += 1
                protein_count_total[-1] += 1
    # plotting proportions
    plot_stats(
        protein_count_total,
        protein_count_essential,
        thresholds,
    )
    # hypergeometric test
    pvalues = []
    for index, threshold in enumerate(thresholds):
        protein_count = len(g.vs)
        # total number of protein: protein_count,
        # subset of proteins: protein_count_total[index]
        # total number of essential proteins: len(essential_proteins)
        # number of essential proteins in subset: protein_count_essential[index]
        pvalues.append(phyper(
            protein_count, len(essential_proteins),
            protein_count_total[index],
            protein_count_essential[index]
        ))
    # plotting p-value evolution
    plot_phyper(pvalues, thresholds)
示例#2
0
文件: examples.py 项目: Aluriak/GBI
def plot_dumb_stats():
    """Show statistics about proteins awesomness"""
    plot_stats(
        (40, 23, 12),  # all proteins
        (20, 11, 7),  # essential proteins
        (1, 5, 10),  # awesomness levels
        stat_name='awesomness',  #xlabels
        all_color='magenta',
        essential_color='yellow')
示例#3
0
文件: examples.py 项目: Aluriak/GBI
def plot_dumb_stats():
    """Show statistics about proteins awesomness"""
    plot_stats(
        (40, 23, 12),  # all proteins
        (20, 11,  7),  # essential proteins
        ( 1,  5, 10),  # awesomness levels
        stat_name='awesomness',  #xlabels
        all_color='magenta',
        essential_color='yellow'
    )
示例#4
0
def pipeline_degree(g, essential_proteins, centrality, thresholds):
    # thresholds = (1, 2, 5, 8, 12, 20)  # TODO
    # thresholds = range(1, 20)  # TODO
    protein_count_total     = []  # number of proteins with a degree >= threshold
    protein_count_essential = []  # same for essential proteins
    # degrees = centrality_degree(g)
    degrees = [(v, centrality(v)) for v in g.vs]
    for threshold in thresholds:
        protein_count_total.append(0)
        protein_count_essential.append(0)
        for vertex, degree in degrees:
            if degree >= threshold:
                if vertex.attributes()['name'] in essential_proteins:
                    protein_count_essential[-1] += 1
                protein_count_total[-1] += 1
    # plotting proportions
    plot_stats(
        protein_count_total,
        protein_count_essential,
        thresholds,
    )
    # hypergeometric test
    pvalues = []
    for index, threshold in enumerate(thresholds):
        protein_count = len(g.vs)
        # total number of protein: protein_count,
        # subset of proteins: protein_count_total[index]
        # total number of essential proteins: len(essential_proteins)
        # number of essential proteins in subset: protein_count_essential[index]
        pvalues.append(phyper(
            protein_count, len(essential_proteins),
            protein_count_total[index],
            protein_count_essential[index]
        ))
    # plotting p-value evolution
    plot_phyper(pvalues, thresholds)