from bioservices import ChEMBL, QuickGO, Reactome, KEGG from py2neo import Graph from model.core import * from ncbi import fetch_publication_list from quickgo import fetch_quick_go_data from uniprot import * graph = Graph(host=os.environ.get("DB", "localhost"), bolt=True, password=os.environ.get("NEO4J_PASSWORD", "")) chembl = ChEMBL(verbose=False) quick_go = QuickGO(verbose=False) reactome = Reactome(verbose=False) kegg = KEGG(verbose=False) # watch("neo4j.bolt") gene_dict = dict() transcript_dict = dict() pseudogene_dict = dict() cds_dict = dict() exon_dict = dict() rrna_dict = dict() trna_dict = dict() ncrna_dict = dict() location_dict = dict() go_term_set = set()
def reactome(): return Reactome(verbose=True)
spamwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) spamwriter.writerow(['GENE', 'HITS']) for gene in gene_dict.keys(): nop = len(gene_dict[gene]) print 'Gene code: ' + gene print 'Number of pathways: ' + str(nop) spamwriter.writerow([str(gene), str(nop)]) for pathway in gene_dict[gene]: print human_pathways_dict[pathway] print '\n' print "!! REACTOME !!" react = Reactome() #"Currently only human pathways will be returned from this method" with open('REACTOME_stats.csv', 'wb') as csvfile: spamwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) spamwriter.writerow(['GENE', 'HITS']) for gene in gene_list: pathway_list = react.query_hit_pathways(gene) nop = len(pathway_list) spamwriter.writerow([str(gene), str(nop)]) for p in pathway_list: print gene + ': ' + p["displayName"] + ' , ' + p[ "stableIdentifier"]["displayName"]
def get_species_name_to_id(): r = Reactome() species_name_to_id = {x['displayName']: x['dbId'] for x in r.data_species_all()} return species_name_to_id
Options: -h --help Show help. --version Show version. """ import os import requests from lxml import etree import json from bioservices import Reactome import logging log = logging.getLogger('root') s = Reactome() wsUrl = 'http://reactome.org/ReactomeRESTfulAPI/RESTfulWS' # base Url for Reactome Webservice def getEntityData(dbId, downloadDir=None): ''' Get reactome entities by database id''' if not downloadDir: downloadDir = './downloadedEntities' fn = '{}/{}.json'.format(downloadDir, dbId) if os.path.isfile(fn): with open(fn, 'r') as f: entity = json.load(f)
print "!! KEGG !!" with open('KEGG_stats.csv', 'wb') as csvfile: spamwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) spamwriter.writerow(['GENE', 'HITS']) for gene in gene_dict.keys(): nop = len(gene_dict[gene]) print 'Gene code: ' + gene print 'Number of pathways: ' + str(nop) spamwriter.writerow([str(gene), str(nop)]) for pathway in gene_dict[gene]: print human_pathways_dict[pathway] print '\n' print "!! REACTOME !!" react = Reactome() #"Currently only human pathways will be returned from this method" with open('REACTOME_stats.csv', 'wb') as csvfile: spamwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) spamwriter.writerow(['GENE', 'HITS']) for gene in gene_list: pathway_list = react.query_hit_pathways(gene) nop = len(pathway_list) spamwriter.writerow([str(gene), str(nop)]) for p in pathway_list: print gene +': '+ p["displayName"] +' , '+ p["stableIdentifier"]["displayName"]
def setup_class(klass): klass.e = Reactome(verbose=True)