Exemple #1
0
def notchOld():
    cys = CyNetwork()
    filename = '/Users/vikash/Documents/MATLAB/MetSignal/REACTOME_SBML2/Signaling_by_EGFR.xml'
    species, reactions_info = parse_xml_reactome(filename)

    cofactorsID = [
        'AMP [cytosol]', 'Pi [nucleoplasm]', 'Ca2+ [cytosol]', 'H2O [cytosol]',
        'GDP [cytosol]', 'ATP [cytosol]', 'Ub [cytosol]', 'ADP [nucleoplasm]',
        'ADP [cytosol]', 'Pi [cytosol', 'ATP [nucleoplasm]', 'GTP [cytosol]'
    ]
    out = open('egfr.txt', 'w')
    # species dictionary
    new_species = {}

    for k, v in species.items():
        new_species[v[0]] = v[0].split('[')[0]
        print v[0]
        out.write("%s\n" % v[0])
    for k, v in reactions_info.items():
        new_species[k] = ''

    import pdb
    pdb.set_trace()
    rInfo, labels, newIds = regenReaction(reactions_info, new_species,
                                          cofactorsID)
    node_list, edge_list = cys.createNodeEdgeCofactor(rInfo, labels, newIds)
    cys.createCysNet(node_list, edge_list)
Exemple #2
0
def drawNet(netFile,rxnFile):
    rxnList=read_1col(rxnFile)
    temp = pickle.load(open(netFile))

    reactions_info=temp[2]
    new_rInfo = {}

    for k in rxnList:
        if (k in (temp[0]['rxns'])) & (k in reactions_info.keys()):  # this is just for signaling reactions
            E = reactions_info[k]['M']
            ind = temp[0]['rxns'].index(k)
            act = temp[0]['activators'][ind]
            inh = temp[0]['inhibitors'][ind]

            if not (act == 'NA'):
                acts = act.split('|')

                for a in acts:
                    if a in temp[1].keys():
                        name = temp[1][a][0];
                    elif a in temp[0]['rashmiv']:
                        name = temp[0]['rashmik'][temp[0]['rashmiv'].index(a)]
                    else:
                        name = a;
                        print a
                    E.append(name)
            I = []
            if not (inh == 'NA'):
                acts = inh.split('|')
                for a in acts:
                    if a in temp[1].keys():
                        name = temp[1][a][0];
                    elif a in temp[0]['rashmiv']:
                        name = temp[0]['rashmik'][temp[0]['rashmiv'].index(a)]
                    else:
                        name = a;
                        print a
                    I.append(name)

            new_rInfo[k] = {'S': reactions_info[k]['S'], 'P': reactions_info[k]['P'], 'E': E, 'I': I}
    # now we want to create network on cytoscape
    # new_rInfo {'reaction_1980109': {'I': [], 'P': ['NICD1:DTX [cytosol]'], 'S': ['CNTN1:NOTCH1:DTX [plasma membrane]'],
    #'E': ['gamma-secretase complex [plasma membrane]']},
    # species_label species can be repalced
    # cofactorsID list of cofactor Ids
    cofactorsID=[]
    cys = CyNetwork()
    species_label={}
    rInfo, labels, newIds = regenReaction(new_rInfo, species_label, cofactorsID)

    node_list, edge_list = cys.createNodeEdgeCofactor(rInfo, labels, newIds)
    cys.createCysNet(node_list, edge_list)
def notchViz():
    Info=pickle.load(open('/Users/vikashpandey/Documents/PyCytoscape/VisPathways/notch.pickle'))
    for k in Info[0].keys():
        print k
    import pdb;pdb.set_trace()

    cofactorsID = ['AMP [cytosol]', 'Pi [nucleoplasm]', 'Ca2+ [cytosol]', 'H2O [cytosol]', 'GDP [cytosol]',
                   'ATP [cytosol]', 'Ub [cytosol]', 'ADP [nucleoplasm]', 'ADP [cytosol]', 'Pi [cytosol',
                   'ATP [nucleoplasm]', 'GTP [cytosol]']
    cys = CyNetwork()
    rInfo, labels, newIds = regenReaction(Info[0], Info[1],cofactorsID)
    node_list, edge_list = cys.createNodeEdgeCofactor(rInfo, labels, newIds)
    cys.createCysNet(node_list, edge_list)
def notch1Vizualize(vizFile):
    Info = pickle.load(open(vizFile))
    # for k in Info[0].keys():
    #     print k
    # import pdb;pdb.set_trace()
    # Info[0] : rxn Info
    # Info[1]: is label
    #import pdb;pdb.set_trace()
    cofactorsID = [
        'AMP [cytosol]', 'Pi [nucleoplasm]', 'Ca2+ [cytosol]', 'H2O [cytosol]',
        'GDP [cytosol]', 'ATP [cytosol]', 'Ub [cytosol]', 'ADP [nucleoplasm]',
        'ADP [cytosol]', 'Pi [cytosol', 'ATP [nucleoplasm]', 'GTP [cytosol]'
    ]
    cys = CyNetwork()
    rInfo, labels, newIds = regenReaction(Info[0], Info[1], cofactorsID)
    node_list, edge_list = cys.createNodeEdgeCofactor(rInfo, labels, newIds)
    cys.createCysNet(node_list, edge_list)
def egfViz():
    # This is the xml file for the egf network. we can use this to parse any network
    fin = '/Users/vikashpandey/Documents/MATLAB/reDoMetSignal/testModels/R-HSA-177929_EGFR.xml'

    species, reactions_info = parse_xml_reactome(fin)

    # step 2
    # we want take information  from pickle signaling model because signaling model is more complete
    import pickle
    sigf = '/Users/vikashpandey/Documents/MATLAB/reDoMetSignal/SignalingAnalysis/PythonData/DataPickle/Signaling.pickle'
    data = pickle.load(open(sigf))
    species = data[0]
    rxnInfo = data[1]
    # find reaction and specis info of reduced model from signaling model
    rInfo = {}

    for rxn in reactions_info.keys():
        newRxn = rxn.replace('reaction_', 'R-HSA-')
        if newRxn in rxnInfo.keys():
            rInfo[newRxn] = rxnInfo[newRxn]
        else:
            print rxn

    #import pdb;pdb.set_trace()
    new_rInfo, new_species=collectNewNet(rInfo)

    # visualize with new data

    cofactorsID = ['AMP [cytosol]', 'Pi [nucleoplasm]', 'Ca2+ [cytosol]', 'H2O [cytosol]', 'GDP [cytosol]',
                   'ATP [cytosol]', 'Ub [cytosol]', 'ADP [nucleoplasm]', 'ADP [cytosol]', 'Pi [cytosol]',
                   'ATP [nucleoplasm]', 'GTP [cytosol]']

    cys = CyNetwork()
    rInfo, labels, newIds = regenReaction(new_rInfo, new_species,cofactorsID)
    f= '/Users/vikashpandey/Documents/MATLAB/reDoMetSignal/SignalingAnalysis/PythonData/DataPickle/proteinShortName.pickle'
    proteinShortName = pickle.load(open(f))
    new_labels={}
    for k,v in labels.items():
        if k in proteinShortName.keys():
            new_labels[k]=proteinShortName[k]
        else:
            new_labels[k]=v

    node_list, edge_list = cys.createNodeEdgeCofactor(rInfo, new_labels,newIds)
    cys.createCysNet(node_list, edge_list)
def rxnWiseViz_Maria():
    # This function takes input as reactions as a text file
    f="/Users/vikash/switchdrive2/RedoConnectMetSig/Data/signaling_viz.txt"
    rxns=read_1col(f)
    import pickle
    sigf='/Users/vikash/Desktop/consign/ExceptMetabolismNew.pickle'

    # sigf = '/Users/vikash/switchdrive2/RedoConnectMetSig/Data/Signaling.pickle'
    data = pickle.load(open(sigf))
    species = data[0]
    rxnInfo = data[1]
    # find reaction and specis info of reduced model from signaling model
    rInfo = {}

    for rxn in rxns:
        if rxn in rxnInfo.keys():
            rInfo[rxn] = rxnInfo[rxn]
        else:
            print "this is not found in the siganling network=  %s"%rxn
    # import pdb;
    # pdb.set_trace()
    # import pdb;pdb.set_trace()
    new_rInfo, new_species = collectNewNet(rInfo)

    # visualize with new data

    cofactorsID = ['AMP [cytosol]', 'Pi [nucleoplasm]', 'Ca2+ [cytosol]', 'H2O [cytosol]', 'GDP [cytosol]',
                   'ATP [cytosol]', 'Ub [cytosol]', 'ADP [nucleoplasm]', 'ADP [cytosol]', 'Pi [cytosol]',
                   'ATP [nucleoplasm]', 'GTP [cytosol]']

    cys = CyNetwork()
    rInfo, labels, newIds = regenReaction(new_rInfo, new_species, cofactorsID)
    f = '/Users/vikash/switchdrive2/RedoConnectMetSig/Data/proteinShortName.pickle'
    proteinShortName = pickle.load(open(f))
    new_labels = {}
    for k, v in labels.items():
        if k in proteinShortName.keys():
            new_labels[k] = proteinShortName[k]
        else:
            new_labels[k] = v

    node_list, edge_list = cys.createNodeEdgeCofactor(rInfo, new_labels, newIds)
    cys.createCysNet(node_list, edge_list)