コード例 #1
0
        for total_sig in total_sig_hypotheses
    ]


def simultaneousPermutation(significance_level, n, categories, testset_size,
                            iterations):
    result = simultaneousPermutationWithMultipleSignificanceLevels(
        [significance_level], n, categories, testset_size, iterations)
    return result[0]


if __name__ == "__main__":
    n = 40
    iterations = 1000

    fisher.init(n)

    testset = set([0, 1, 4, 7, 2, 10, 40, 32])

    categories = [
        set([0, 1]),
        set([1, 4, 7, 0, 2, 10, 40]),
        set([10, 2, 40]),
        set([32])
    ]

    cat_pvalues = [computeOverlapPval(s, testset, n) for s in categories]
    levels = [0.1, 0.05, 0.01, 0.005]
    perm_DR = simultaneousPermutationWithMultipleSignificanceLevels(
        levels, n, categories, len(testset), iterations)
コード例 #2
0
     print "\nLoading drug bank database from XML..."
     drugDB.loadXML(os.sep.join(["data","drugbank","drugbank.xml"]))
     drugDB.mapTargetNames(os.sep.join(["data","drugbank","target_links.csv"]))
 else:
     import drugbankCatalog as drugDB
     print "\nLoading DrugBank drug catalogue..."
     drugDB.initDruglist(os.sep.join(["data","drugbank","drug_links.csv"]))
     print "\nLoading DrugBank drug target catalogue..."
     drugDB.initTargets(os.sep.join(["data","drugbank","target_links.csv"]), os.sep.join(["data","drugbank","all_target_protein.fasta"]),__ENABLE_GENE_VERIFICATION,__ENABLE_GENE_UPDATES)
 
 commonGenes = studyGenes & gwasDB.__geneSet
 cgWithoutGWAS = studyGenes - gwasDB.__geneSet
 gwasWithoutCG = gwasDB.__geneSet - studyGenes
 
 print "initializing fisher algorithm..."
 fisher.init(len(geneDB.__approved_symbols))
 
 # chi-square contingency table for gwas and RE
 
 a1 = len(commonGenes)
 b1 = len(gwasWithoutCG)
 c1 = len(cgWithoutGWAS)
 d1 = len( geneDB.__approved_symbols - (studyGenes | gwasDB.__geneSet) )
 oddsratio1 = geneUtils.oddsRatio(a1,b1,c1,d1)
 kappa1 = geneUtils.kappaStatistic(a1,b1,c1,d1)
 fisher_exact1 = fisher.compute(a1,b1,c1,d1)
 fisherp1 = fisher.significance(fisher_exact1, a1,b1,c1,d1)
 
 
 commonDrugTargets = drugDB.__geneSet & studyGenes