Ejemplo n.º 1
0
def cge20(metlin, hmdb, metfrag):
    cge20 = path_dict['cge00020']
    observed = ((metlin | hmdb | metfrag) & features) - cofactors
    reverse_path_dict = read.reverse_dict(path_dict)
    print observed & cge20
    for compound in observed & cge20:
        print compound, len(reverse_path_dict[compound])
Ejemplo n.º 2
0
 def gen(self, test_name):
     pathways, features, path_dict, evidence, met_evidence = self.tests[
         test_name]()
     rev_path_dict = read.reverse_dict(path_dict)
     evidence = {e: 1 for e in evidence}
     if met_evidence is None:
         met_evidence = dict()
     return pathways, features, path_dict, rev_path_dict, evidence, met_evidence
import math

ONE, ZERO = (0.99, 0.01)

data_path = '../data/'
observation_file = data_path + 'HilNeg 0324 -- Data.csv'
cofactors = read.get_cofactors(data_path + 'cofactors')
path_dict = read.get_model(data_path + 'model2.csv', cofactors=cofactors)
pathways = path_dict.keys()
features = read.get_metabolites(path_dict)
evidence = read.metlin(observation_file)
evidence |= read.hmdb(observation_file)
evidence -= cofactors
features -= cofactors
evidence &= features
reverse_path_dict = read.reverse_dict(path_dict)
metfrag = read.metfrag(observation_file)
metfrag_evidence = read.dict_of_set(
    read.metfrag_with_scores(observation_file, keep_zero_scores=False),
    metfrag & features - cofactors - evidence)
evidence = {e: 1 for e in evidence}

rate_prior = 0.5

ap = {p: Gamma('p_' + p, rate_prior, 1) for p in pathways}
bmp = {
    p: {
        feat: Gamma('b_{' + p + ',' + feat + '}', ap[p], 1)
        for feat in path_dict[p]
    }
    for p in pathways
Ejemplo n.º 4
0
def summarize_compound(compound):
    path_dict = read.get_model(data_path + 'model2.csv')
    reverse_path_dict = read.reverse_dict(path_dict)
    print "Compound", compound, "has pathways:", reverse_path_dict[compound]
Ejemplo n.º 5
0
 def stats(pathway, metlin, hmdb, metfrag=set()):
     cge = path_dict[pathway]
     observed = ((metlin | hmdb | metfrag) & features) - cofactors
     reverse_path_dict = read.reverse_dict(path_dict)
     for compound in observed & cge:
         print compound, len(reverse_path_dict[compound])
def summarize_compound(compound):
    path_dict = read.get_model(data_path + 'model2.csv')
    reverse_path_dict = read.reverse_dict(path_dict)
    print("Compound", compound, "has pathways:")
    for path in sorted(reverse_path_dict[compound]):
        print(path)