コード例 #1
0
def main():
    args = parser.parse_args()
    beta = 0.5
    #get mutational data
    mvals = getMutationalData()

    ##load up interactome
    gfile = args.graph
    ##TODO: replace this with Docker image call
    g = pickle.load(open(gfile, 'rb'))
    key = 'mpnstPDXmuts'
    this_hyp = hyphalNetwork(mvals, g)
    this_hyp._to_file(key + '_hypha.pkl')

    ##read from file
    ###this is all we need to do in a single eval, then we can do tests later
    this_hyp.node_stats().to_csv(key + '_nodelist.csv')
    for_e = hyEnrich.go_enrich_forests(this_hyp)
    this_hyp.assign_enrichment(for_e, type='forest')
    for_e.to_csv(key + 'enrichedForestGoTerms.csv')
    com_e = hyEnrich.go_enrich_communities(this_hyp)
    this_hyp.assign_enrichment(com_e, type='community')
    this_hyp._to_file(key + '_hypha.pkl')
    com_e.to_csv(key + 'enrichedCommunityGOterms.csv')
    this_hyp.community_stats(prefix=key).to_csv(key + '_communityStats.csv')
    res = hyStats.compute_all_distances({'mutations': this_hyp})
    res.to_csv('panPDXDistances.csv')
    nmi = hyStats.compute_all_nmi({'mutations': this_hyp}, g)
    nmi.to_csv('panPDXNMI.csv')
コード例 #2
0
ファイル: panCancerTest.py プロジェクト: Lthura/hyphalnet
def main():
    args = parser.parse_args()

    #this is a hack - fix this!
    bcData = prot.parsePDCfile('data/CPTAC2_Breast_Prospective_Collection_BI_Proteome.tmt10.tsv')
    ncbi = prot.map_ncbi_to_gene(bcData)

    if args.fromFile is None:
        hyphae = build_hyphae_from_data()
    else:
        hyphae = loadFromFile(args.fromFile)

    for key, this_hyp in hyphae.items():
        this_hyp.node_stats().to_csv(key+'_nodelist.csv')
        if args.doEnrich:
            if len(this_hyp.forest_enrichment)==0:
                for_e = hype.go_enrich_forests(this_hyp, ncbi)
                this_hyp.assign_enrichment(for_e, type='forest')
                for_e.to_csv(key+'enrichedForestGoTerms.csv')
                this_hyp._to_file(key+'_hypha.pkl')
            if len(this_hyp.community_enrichment)==0:
                com_e = hype.go_enrich_communities(this_hyp, ncbi)
                this_hyp.assign_enrichment(com_e, type='community')
                this_hyp._to_file(key+'_hypha.pkl')
                com_e.to_csv(key+'enrichedCommunityGOterms.csv')
            ##next: compare enrichment between patients mapped to communities
        this_hyp.forest_stats().to_csv(key+'_communityStats.csv')
        this_hyp.community_stats(prefix=key).to_csv(key+'_communityStats.csv')

    #now compute graph distances to ascertain fidelity
    if args.getDist:
        res = compute_all_distances(hyphae)
        res.to_csv('panCancerDistances.csv')
コード例 #3
0
def main():
    args = parser.parse_args()

    if args.fromFile is None:
        hyphae = significant_genes(data, 'AML sample', 'Gene', 'LogFoldChange')
    else:
        hyphae = loadFromFile(args.fromFile)

        #now compute graph distances to ascertain fidelity
    if args.getDist:
        res = hyStats.compute_all_distances(hyphae)
        res.to_csv('proteomicdistances.csv')
        nmi = hyStats.compute_all_nmi(hyphae, g)
        nmi.to_csv('proteomic.csv')
    for key, this_hyp in hyphae.items():
        this_hyp.node_stats().to_csv(key + '_nodelist.csv')
        if args.doEnrich:
            if len(this_hyp.forest_enrichment) == 0:
                for_e = hyEnrich.go_enrich_forests(this_hyp)  #SG, ncbi)
                this_hyp.assign_enrichment(for_e, type='forest')
                for_e.to_csv(key + 'enrichedForestGoTerms.csv')
                this_hyp._to_file(key + '_hypha.pkl')
            if len(this_hyp.community_enrichment) == 0:
                com_e = hyEnrich.go_enrich_communities(this_hyp)
                this_hyp.assign_enrichment(com_e, type='community')
                this_hyp._to_file(key + '_hypha.pkl')
                com_e.to_csv(key + 'enrichedCommunityGOterms.csv')
            ##next: compare enrichment between patients mapped to communities
        this_hyp.community_stats(prefix=key).to_csv(key +
                                                    '_communityStats.csv')
        this_hyp.forest_stats().to_csv(key + '_TreeStats.csv')
コード例 #4
0
def main():
    args = parser.parse_args()
    gfile = args.graph
    g = pickle.load(open(gfile, 'rb'))#hyp.make_graph_from_dict(gfile)
    if args.fromFile is None:
        hyphae = build_hyphae_from_data(args.qt, g, args.sample)
    else:
        hyphae = loadFromFile(args.fromFile)

    #now compute graph distances to ascertain fidelity
    if args.getDist:
        res = hyStats.compute_all_distances(hyphae)
        res.to_csv('panCancerDistances.csv')
        nmi = hyStats.compute_all_nmi(hyphae, g)
        nmi.to_csv('panCancerNMI.csv')

    for key, this_hyp in hyphae.items():
        this_hyp.node_stats().to_csv(key+'_nodelist.csv')
        if args.doEnrich:
            if len(this_hyp.community_enrichment) == 0:
                com_e = hyEnrich.go_enrich_communities(this_hyp)
                this_hyp.assign_enrichment(com_e, type='community')
                this_hyp._to_file(key+'_hypha.pkl')
                com_e.to_csv(key+'enrichedCommunityGOterms.csv')
            ##next: compare enrichment between patients mapped to communities
        this_hyp.forest_stats().to_csv(key+'_TreeStats.csv')
        this_hyp.community_stats(prefix=key).to_csv(key+'_communityStats.csv')
コード例 #5
0
def main():

    gfile = '../../data/igraphPPI.pkl'
    g = pickle.load(open(gfile, 'rb'))  #hyp.make_graph_from_dict(gfile)

    args = parser.parse_args()
    beta = 0.5
    proteomics_dictionary = significant_prots(data, 'AML sample', 'Gene',
                                              'LogFoldChange')
    gene_dictionary = tumor_genes(data, 'AML sample', 'Gene', 'Tumor VAF')
    if args.fromFile is None:
        hyphae = dict()
        hyphae['mutations'] = hyphalNetwork(gene_dictionary, g.copy(), beta)
        hyphae['proteomics'] = hyphalNetwork(proteomics_dictionary, g.copy(),
                                             beta)
        for key, this_hyp in hyphae.items():
            this_hyp._to_file(key + '_amlPatientData_hypha.pkl')
    else:
        hyphae = loadFromFile(args.fromFile)

        #now compute graph distances to ascertain fidelity
    if args.getDist:
        res = hyStats.compute_all_distances(hyphae)
        res.to_csv('amlNetworkdistances.csv')
        tab = table.build_table("AML Network Distances", 'syn22128879', res)
        syn.store(tab)
        nmi = hyStats.compute_all_nmi(hyphae, g)
        nmi.to_csv('amlNMI.csv')
        syn.store(File('amlNMI.csv', parent='syn22269875'))
        #store distances
    for key, this_hyp in hyphae.items():
        node_stats = this_hyp.node_stats()
        node_stats.to_csv(key + '_nodelist.csv')
        tab = table.build_table("AML Network Nodes", 'syn22128879', node_stats)
        syn.store(tab)
        if args.doEnrich:
            if len(this_hyp.forest_enrichment) == 0:
                for_e = hyEnrich.go_enrich_forests(this_hyp)  #SG, ncbi)
                this_hyp.assign_enrichment(for_e, type='forest')
                for_e.to_csv(key + 'enrichedForestGoTerms.csv')
                syn.store(
                    File(key + 'enrichedForestGoTerms.csv',
                         parent='syn22269875'))
                this_hyp._to_file(key + '_amlPatientData_hypha.pkl')
            if len(this_hyp.community_enrichment) == 0:
                com_e = hyEnrich.go_enrich_communities(this_hyp)
                this_hyp.assign_enrichment(com_e, type='community')
                com_e.to_csv(key + 'enrichedCommunityGOterms.csv')
                syn.store(
                    File(key + 'enrichedCommunityGOterms.csv',
                         parent='syn22269875'))
                this_hyp._to_file(key + '_amlPatientData_hypha.pkl')
            ##next: compare enrichment between patients mapped to communities
        this_hyp.community_stats(prefix=key).to_csv(key +
                                                    '_communityStats.csv')
        this_hyp.forest_stats().to_csv(key + '_TreeStats.csv')
        for files in [
                key + '_amlPatientData_hypha.pkl', key + '_communityStats.csv',
                key + '_TreeStats.csv'
        ]:
            syn.store(File(files, parent='syn22269875'))