The official Python 3 interface to the g:Profiler
toolkit for enrichment analysis of functional (GO and other) terms,
conversion between identifier namespaces and mapping orhologous genes in related organisms.
It has an optional dependency on pandas.
Installing gprofiler
the recommended way of installing gprofiler is using pip
pip install gprofiler-official
Legacy version
The 0.3.x series of gprofiler-official is incompatible with the 1.0.x series. We changed the major version number to
signify the breaking changes in the API. To install the previous version of gprofiler-official, use the command
pip install gprofiler-official==0.3.5
Tools:
To use any of the tools in the g:Profiler toolkit, first initialize the GProfiler object.
from gprofiler import GProfiler
gp = GProfiler(
user_agent='ExampleTool', #optional user agent
return_dataframe=True, #return pandas dataframe or plain python structures
)
g:GOSt (profile)
from gprofiler import GProfiler
gp = GProfiler(return_dataframe=True)
gp.profile(organism='hsapiens',
query=['NR1H4','TRIP12','UBC','FCRL3','PLXNA3','GDNF','VPS11'])
Output:
source native name p_value significant description term_size query_size intersection_size effective_domain_size precision recall query parents
GO:BP GO:0048585 negative regulation of response to stimulus 0.004229 True "Any process that stops, prevents, or reduces ... 1610 7 6 17622 0.857143 0.003727 query_1 [GO:0048583, GO:0048519, GO:0050896]
GO:BP GO:0002224 toll-like receptor signaling pathway 0.016351 True "Any series of molecular signals generated as ... 133 7 3 17622 0.428571 0.022556 query_1 [GO:0002221]
GO:BP GO:0048486 parasympathetic nervous system development 0.026199 True "The process whose specific outcome is the pro... 19 7 2 17622 0.285714 0.105263 query_1 [GO:0048483, GO:0048731]
GO:BP GO:0034162 toll-like receptor 9 signaling pathway 0.038733 True "Any series of molecular signals generated as ... 23 7 2 17622 0.285714 0.086957 query_1 [GO:0002224]
GO:BP GO:0002221 pattern recognition receptor signaling pathway 0.039782 True "Any series of molecular signals generated as ... 179 7 3 17622 0.428571 0.016760 query_1 [GO:0002758]
CORUM CORUM:5669 PlexinA3-Nrp1 complex 0.049767 True PlexinA3-Nrp1 complex 2 2 1 3620 0.500000 0.500000 query_1 [CORUM:0000000]
CORUM CORUM:5759 PLXNA3-RANBPM complex 0.049767 True PLXNA3-RANBPM complex 2 2 1 3620 0.500000 0.500000 query_1 [CORUM:0000000]
source is the code for the datasource
native is the ID for the enriched term/functional category in its native namespace.
name is the readable name for the enriched term, description is the longer description if available.
p_value is the corrected p-value for the
term_size, query_size, intersection_size, effective_domain_size are parameters to the hypergeometric test.
query is the name of the query and is significant if multiple queries were made in one call (e.g gp.profile(query={'query1':['NR1H4'], 'query2':['NR1H4','TRIP12']}))
Setting the parameter no_evidences=False would add the column intersections (a list of genes that are annotated to the term and are present in the query )
and the column evidences (a list of lists of GO evidence codes for the intersecting genes)
NB! the parameter combined significantly changes the output structure by packing the results of distinct queries together.
For example:
from gprofiler import GProfiler
gp = GProfiler(return_dataframe=True)
gp.convert(organism='hsapiens',
query=['NR1H4','TRIP12','UBC','FCRL3','PLXNA3','GDNF','VPS11'],
target_namespace='ENTREZGENE_ACC')
incoming column lists the input gene, converted lists the gene in the target namespace (Entrez Gene accession number in this case).
g:Orth (orth)
from gprofiler import GProfiler
gp = GProfiler(return_dataframe=True)
gp.orth(organism='hsapiens',
query=['NR1H4','TRIP12','UBC','FCRL3','PLXNA3','GDNF','VPS11'],
target='mmusculus')
incoming is the input gene, converted is the canonical Ensembl ID for the input gene,
ortholog_ensg is the canonical Ensembl ID for the orthologous gene in the target organism.
g:SNPense (snpense)
from gprofiler import GProfiler
gp = GProfiler(return_dataframe=True)
gp.snpense(query=['rs11734132', 'rs7961894', 'rs4305276', 'rs17396340'])