Beispiel #1
0
def geneusage_ttests(attr, type, outfile, g2n, name2obj, matched, pcutoff):
    # attr: "clones"/"reads"; type=genetype: v, d, j, vj, dj
    testtype = statcommon.get_test_type(g2n, matched)
    f = open(outfile, 'w')
    f.write(("Name\tGroup1_Group2\tt_val\tp_val\tMean1 +/- Std1\t" +
             "Mean2 +/- Std2\n"))
    genes = get_genes(name2obj.values(), type)
    for gene in genes:
        pair2tp, group2mean = statcommon.ttest_allpairs(g2n, name2obj, matched,
                                                 attr=None, func=get_geneusage,
                                                 func_args=(attr, type, gene),
                                                 testtype=testtype)
        statcommon.ttest_write(f, gene, pair2tp, group2mean, pcutoff)
    f.close()
Beispiel #2
0
def lendist_ttests(attr, outfile, g2n, name2obj, matched, pcutoff):
    testtype = statcommon.get_test_type(g2n, matched)
    f = open(outfile, 'w')
    # compare median length
    f.write(("#Category\tGroup1_Group2\tt_val\tp_val\tMean1 +/- Std1\t" +
             "Mean2 +/- Std2\n"))
    medattr = "median_" + attr 
    pair2tp, group2mean = statcommon.ttest_allpairs(g2n, name2obj, matched,
                                                    medattr, testtype=testtype)
    statcommon.ttest_write(f, medattr, pair2tp, group2mean)

    # compare freq of each length
    f.write("#Length\n")
    lens = get_lens(name2obj.values())
    lenattr = "len2" + attr
    for l in lens:
        pair2tp, group2mean = statcommon.ttest_allpairs(g2n, name2obj,
                                  matched, attr=None,
                                  func=statcommon.obj_dictattr_lookup,
                                  func_args=(lenattr, l), testtype=testtype)
        statcommon.ttest_write(f, str(l), pair2tp, group2mean, pcutoff)
    f.close()