#!/usr/bin/env python# Saez Lab 2020# Denes Turei# turei.denes@gmail.comimportimportlibasimpfrompypathimportomnipathfrompypath.coreimportintercellfrompypath.coreimportannotfrompypath.coreimportintercell_annotfrompypath.utilsimportmappinga=omnipath.db.get_db('annotations')i=omnipath.db.get_db('intercell')# the annotation database# individual annotation databases:a.annots# select one databasecomppi=a.annots['ComPPI']# query the fieldscomppi.get_names()# query the values for one fieldcomppi.get_values('location')# query the proteins by field-value pairscomppi.get_subset(location='nucleus')comppi.get_subset(location={'nucleus','cytosol'})# the intercell database# the category namesi.class_names# their labelsi.class_labels# get all the classes for a proteini.classes_by_entity('P00533')# count the members in each classi.counts_by_class()# get the entities annotated by each resourcei.entities_by_resource()# get all members from one classi.get_class('tight_junction')# to see gene symbolsmapping.map_names(i.get_class('ligand'),'uniprot','genesymbol')# how to change the annotation definitions# -- edit the definition in the pypath/core/intercell_annot.py file in your# local repo# -- reload the modules# -- rebuild the intercell database# -- if you are satisfied with the result, commit your changes with a good# commit message and push it to the origin# -- please commit each change separately so we can keep track what's going on# once you have the definitions changed, reload the modulesimp.reload(intercell_annot)imp.reload(annot)imp.reload(intercell)# rebuild the intercell database (this takes time but is relatively quick# as the annotations and complex databases are already loaded and we don't# need to change them)i=intercell.IntercellAnnotation()# then inspect the new `i` object if your changes could address the wrong# annotations; if you are satisfied commit your changes
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.