Пример #1
0
def run_paired_t(bt, s1, s2):
    '''Perform a paired t test between samples.

    Parameters
    ----------
    bt : biom table object
        Table containing data for samples in s1 and s2.
    s1 : list
        List of sample ids found in bt (strs).
    s2 : list
        List of sample ids found in bt (strs).

    Returns
    -------
    test_stats : list
        Floats representing the test statistic for each paired comparison. 
    pvals : list
        Floats representing the p-values of the reported test statistics.
    '''
    test_stats = []
    pvals = []
    s1_indices = [bt.index(i, axis='sample') for i in s1]
    s2_indices = [bt.index(i, axis='sample') for i in s2]

    for data in bt.iter_data(axis='observation'):
        test_stat, pval = t_paired(data.take(s1_indices), data.take(s2_indices))
        test_stats.append(test_stat)
        pvals.append(pval)
    return test_stats, pvals
Пример #2
0
def run_paired_t(bt, s1, s2):
    '''Perform a paired t test between samples.

    Parameters
    ----------
    bt : biom table object
        Table containing data for samples in s1 and s2.
    s1 : list
        List of sample ids found in bt (strs).
    s2 : list
        List of sample ids found in bt (strs).

    Returns
    -------
    test_stats : list
        Floats representing the test statistic for each paired comparison. 
    pvals : list
        Floats representing the p-values of the reported test statistics.
    '''
    test_stats = []
    pvals = []
    s1_indices = [bt.index(i, axis='sample') for i in s1]
    s2_indices = [bt.index(i, axis='sample') for i in s2]

    for data in bt.iter_data(axis='observation'):
        test_stat, pval = t_paired(data.take(s1_indices), data.take(s2_indices))
        test_stats.append(test_stat)
        pvals.append(pval)
    return test_stats, pvals
Пример #3
0
def run_paired_t(data_generator):
    """Run paired t test on data."""
    test_stats, pvals = [], []
    for b_data, a_data in data_generator:
        test_stat, pval = t_paired(b_data, a_data)
        test_stats.append(test_stat)
        pvals.append(pval)
    return test_stats, pvals
Пример #4
0
def run_paired_t(data_generator):
    """Run paired t test on data."""
    test_stats, pvals = [], []
    for b_data, a_data in data_generator:
        test_stat, pval = t_paired(b_data, a_data)
        test_stats.append(test_stat)
        pvals.append(pval)
    return test_stats, pvals