| Title: | An R package for tissue expression analysis and gene set enrichment |
|---|---|
| Description: | Protein2Tissue provides a comprehensive framework for analysing tissue-specific gene and protein expression patterns. The package allows users to map genes or proteins to their predominant tissue types, perform tissue-based enrichment analysis on gene sets, and explore expression profiles across a wide range of human tissues. Reference expression data is derived from publicly available databases the Human Protein Atlas (https://www.proteinatlas.org). |
| Authors: | Chaoran Yang [aut, cre] (ORCID: <https://orcid.org/0000-0001-6639-8136>), Yao Chen [aut] (ORCID: <https://orcid.org/0000-0001-8172-3996>) |
| Maintainer: | Chaoran Yang <[email protected]> |
| License: | file LICENSE |
| Version: | 0.99.5 |
| Built: | 2026-10-07 08:28:41 UTC |
| Source: | https://github.com/BiocStaging/Protein2Tissue |
A data frame containing tissue-specific gene expression data derived from the Human Protein Atlas (HPA).
ee_tbee_tb
A data frame with n rows and the following columns:
HGNC gene symbol
Ensembl gene identifier
NCBI Entrez ID
UNIPROT ID
Whether the protein is a predicted secretory protein or not
expression category, one of "Tissue
enhanced",
"Group enriched", or "Tissue enriched"
tissue names
Human Protein Atlas https://www.proteinatlas.org. Uhlen M et al. (2017). A pathology atlas of the human cancer transcriptome. Science, 357(6352). doi:10.1126/science.aan2507
data(ee_tb) head(ee_tb)data(ee_tb) head(ee_tb)
An S4 class to store enrichment analysis results, including the enrichment results of input and background protein lists.
inputAn object containing enrichment results for the input set
backgroundAn object containing enrichment results for the background set
# Create an Enrichment object obj <- methods::new("Enrichment", input = data.frame(Gene = c("TP53", "BRCA1")), background = data.frame(Gene = c("TP53", "BRCA1", "EGFR", "MYC")) ) show(obj)# Create an Enrichment object obj <- methods::new("Enrichment", input = data.frame(Gene = c("TP53", "BRCA1")), background = data.frame(Gene = c("TP53", "BRCA1", "EGFR", "MYC")) ) show(obj)
This function classifies genes into tissue specificity categories ("Tissue enriched", "Group enriched", "Tissue enhanced", "Low tissue specificity", or "Not detected") based on relative expression levels across tissues, following Human Protein Atlas–style rules.
geneClassification( expression, tissue_groups = NULL, min_expression = 1, secretory_analysis = FALSE, typeKey )geneClassification( expression, tissue_groups = NULL, min_expression = 1, secretory_analysis = FALSE, typeKey )
expression |
A numeric matrix or data frame with genes as rows and
tissues as columns. Row names of it must correspond to gene identifiers
defined by |
tissue_groups |
Optional data frame with two columns named
|
min_expression |
Numeric value specifying the minimum expression
level required for a gene to be considered detected. Default is |
secretory_analysis |
Logical indicating whether to include predicted
secretory protein annotations from the human protein atlas.
Default is |
typeKey |
Character string specifying the gene identifier type used
in |
Optionally, the function can integrate predicted secretory protein annotations from the Protein2Tissue database or derive gene, Ensembl, Entrez ID, and UniProt annotations using org.Hs.eg.db.
The classification is performed gene by gene using the following rules:
Not detected: Maximum expression across all tissues is
below min_expression.
Tissue enriched: Expression in one tissue is at least 4-fold higher than expression in all other tissues.
Group enriched: Mean expression of a group of tissues (either user-defined or automatically detected among the top-expressing tissues) is at least 4-fold higher than the maximum expression in all remaining tissues.
Tissue enhanced: Expression in one tissue is at least 4-fold higher than the mean expression across all tissues.
Low tissue specificity: Not meeting any of the criteria above.
When secretory_analysis = TRUE, gene annotations and predicted
secretory status are retrieved from the internal ee_tb dataset
provided by the Protein2Tissue package. Genes not present in this
database are removed.
data.frame with tissue specificity classification
A data frame containing:
Gene annotation columns: Gene, Ensembl,
EntrezID, and Uniprot
Is_secreted (if available)
Tissue.specificity classification
One column per tissue indicating classification labels
url <- "https://raw.githubusercontent.com/ChrYang/DataSet/main/tissue_tpm_gtex.csv" tissue_tpm_gtex <- read.csv(url, row.names=1) res <- geneClassification( expression = tissue_tpm_gtex, typeKey = "Ensembl", min_expression = 1, secretory_analysis = FALSE ) head(res) # Example with predefined tissue groups tissue_groups <- data.frame( Tissue = c("Colon_Transverse", "Colon_Sigmoid", "Liver"), Group = c("Colon", "Colon", "Liver") ) res_grouped <- geneClassification( expression = tissue_tpm_gtex, tissue_groups = tissue_groups, typeKey = "Ensembl", min_expression = 1, secretory_analysis = FALSE )url <- "https://raw.githubusercontent.com/ChrYang/DataSet/main/tissue_tpm_gtex.csv" tissue_tpm_gtex <- read.csv(url, row.names=1) res <- geneClassification( expression = tissue_tpm_gtex, typeKey = "Ensembl", min_expression = 1, secretory_analysis = FALSE ) head(res) # Example with predefined tissue groups tissue_groups <- data.frame( Tissue = c("Colon_Transverse", "Colon_Sigmoid", "Liver"), Group = c("Colon", "Colon", "Liver") ) res_grouped <- geneClassification( expression = tissue_tpm_gtex, tissue_groups = tissue_groups, typeKey = "Ensembl", min_expression = 1, secretory_analysis = FALSE )
Accessor for the background slot of an Enrichment object
getBackground(object) ## S4 method for signature 'Enrichment' getBackground(object)getBackground(object) ## S4 method for signature 'Enrichment' getBackground(object)
object |
An Enrichment object |
The background data frame
obj <- methods::new("Enrichment", input = data.frame(Gene = c("TP53", "BRCA1")), background = data.frame(Gene = c("TP53", "BRCA1", "EGFR")) ) getBackground(obj)obj <- methods::new("Enrichment", input = data.frame(Gene = c("TP53", "BRCA1")), background = data.frame(Gene = c("TP53", "BRCA1", "EGFR")) ) getBackground(obj)
Accessor for the input slot of an Enrichment object
getInput(object) ## S4 method for signature 'Enrichment' getInput(object)getInput(object) ## S4 method for signature 'Enrichment' getInput(object)
object |
An Enrichment object |
The input data frame
obj <- methods::new("Enrichment", input = data.frame(Gene = c("TP53", "BRCA1")), background = data.frame(Gene = c("TP53", "BRCA1", "EGFR")) ) getInput(obj)obj <- methods::new("Enrichment", input = data.frame(Gene = c("TP53", "BRCA1")), background = data.frame(Gene = c("TP53", "BRCA1", "EGFR")) ) getInput(obj)
Performs Gene Ontology (GO) enrichment analysis on genes showing
tissue-specific or group-enriched expression patterns, using
enrichGO.
goEnriched(out, type = "BP", tissueTest = "", inclusion = "All")goEnriched(out, type = "BP", tissueTest = "", inclusion = "All")
out |
An object compatible with |
type |
A character string specifying the GO ontology category.
One of |
tissueTest |
A character string specifying the tissue to test.
Must match a value in the |
inclusion |
A character vector specifying which signal categories
to include. One of |
An enrichResult object from
enrichGO containing GO enrichment
results for the specified tissue and signal categories.
data("plasma_data", package = "Protein2Tissue") tmp <- dplyr::filter(plasma_data, Coefficient.Age > 0 & q.Age < 0.05) tmp <- dplyr::pull(tmp, UniqueSymbol) myList <- toupper(tmp) myBackground <- toupper(plasma_data$UniqueSymbol) result <- tissueAnalysis( input = myList, background = myBackground, typeKey = "Gene", # identifier type for input typeKeyBg = "Gene", # identifier type for background ) goEnriched(result, type = "BP", tissueTest = "Liver", inclusion = "All")data("plasma_data", package = "Protein2Tissue") tmp <- dplyr::filter(plasma_data, Coefficient.Age > 0 & q.Age < 0.05) tmp <- dplyr::pull(tmp, UniqueSymbol) myList <- toupper(tmp) myBackground <- toupper(plasma_data$UniqueSymbol) result <- tissueAnalysis( input = myList, background = myBackground, typeKey = "Gene", # identifier type for input typeKeyBg = "Gene", # identifier type for background ) goEnriched(result, type = "BP", tissueTest = "Liver", inclusion = "All")
Generates a heatmap showing tissue expression signals per gene from an
Enrichment object, with optional filtering by signal category.
heatmapEnrich(out, inclusion = "All")heatmapEnrich(out, inclusion = "All")
out |
An |
inclusion |
A character vector specifying which signal categories to
include. Valid options are |
The function first converts the Enrichment object to long format
using the internal .wideToLong function, retaining NA values
to show absent signals in the heatmap. Signal categories are colour-coded
for easy interpretation.
A ggplot2 object showing a heatmap of tissue expression
signals per gene, with tissues on the x-axis and genes on the y-axis.
plotProteinType, tissueAnalysis
result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID" ) # plot all signal categories heatmapEnrich(result) # plot specific categories only heatmapEnrich(result, inclusion = c("Tissue enriched", "Tissue enhanced"))result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID" ) # plot all signal categories heatmapEnrich(result) # plot specific categories only heatmapEnrich(result, inclusion = c("Tissue enriched", "Tissue enhanced"))
Creates a network visualisation showing gene-tissue relationships from a wide-format expression object.
networkPlot(out)networkPlot(out)
out |
typically a |
A ggplot object representing the gene-tissue network.
Tissue nodes are displayed as large labelled circles; gene nodes as
small points. Edges are coloured by signal category.
result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID", database = NULL ) p <- networkPlot(result) print(p)result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID", database = NULL ) p <- networkPlot(result) print(p)
A data frame containing differential expression results from a plasma
proteomics study. The dataset captures associations between protein
expression levels and age and is intended as example input for
tissueAnalysis().
plasma_dataplasma_data
A data frame with n rows and 4 columns:
Character. Protein or gene identifier.
Numeric. Estimated effect size for association with age.
Numeric. Raw p-value for the age association.
Numeric. Adjusted p-value (q-value) controlling for multiple testing.
This dataset is adapted from Lehallier et al. (2019), which profiled age-associated changes in the human plasma proteome.
Lehallier et al. (2019). Undulating changes in human plasma proteome profiles across the lifespan. Nature Medicine. doi:10.1038/s41591-019-0673-2
data(plasma_data) head(plasma_data)data(plasma_data) head(plasma_data)
Generates a bar chart showing the distribution of genes across RNA tissue
specificity classes from an Enrichment object.
plotProteinType(out)plotProteinType(out)
out |
An |
The function summarises the Tissue.specificity column from the
input slot of the Enrichment object and plots the count of genes
in each specificity class as a horizontal bar chart.
A ggplot2 object showing the number of genes in each
RNA tissue specificity class.
result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID" ) plotProteinType(result)result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID" ) plotProteinType(result)
Performs Fisher's exact test for each tissue to identify tissues that are significantly enriched in the input protein list compared to the background.
testByTissue( out, inclusion = "All", testMethod = "fisher", padj = "none", secretoryOnly = FALSE )testByTissue( out, inclusion = "All", testMethod = "fisher", padj = "none", secretoryOnly = FALSE )
out |
An |
inclusion |
A character vector specifying which signal categories to
include in the analysis. Valid options are |
testMethod |
A character string specifying the method for statistics
tests for the contingency table. Passed to |
padj |
A character string specifying the method for multiple testing
correction. Passed to |
secretoryOnly |
A logical value indicating whether to restrict the
analysis to secretory proteins only (i.e. rows where |
For each tissue, a 2x2 contingency table is constructed and exact test is applied to test whether the proportion of input proteins expressed in that tissue differs significantly from the background proportion.
The contingency table is structured as follows:
Expressed Not expressed
Input a b
Background c d
Multiple testing correction is applied across all tissues using the method
specified in padj.
A data frame with one row per tissue containing the following columns:
tissue — tissue name
input_in — number of input proteins present in the tissue
input_total — total number of input proteins
bg_in — number of background proteins present in the tissue
bg_total — total number of background proteins
input_prop — proportion of input proteins in the tissue
bg_prop — proportion of background proteins in the tissue
OR — odds ratio from Fisher's exact test
p_value — p-value from Fisher's exact test
p_adj — adjusted p-value
tissueAnalysis, heatmapEnrich,
fisher.test, exact.test,
p.adjust
result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID" ) # run Fisher's exact test across all tissues testResult <- testByTissue(result) # with BH correction and secretory proteins only testResult <- testByTissue( result, inclusion = c("Tissue enriched", "Tissue enhanced"), testMethod = "barnard", padj = "BH", secretoryOnly = TRUE )result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID" ) # run Fisher's exact test across all tissues testResult <- testByTissue(result) # with BH correction and secretory proteins only testResult <- testByTissue( result, inclusion = c("Tissue enriched", "Tissue enhanced"), testMethod = "barnard", padj = "BH", secretoryOnly = TRUE )
Generates a horizontal grouped bar chart comparing the proportion of input proteins versus background proteins across tissues, with p-values annotated from exact test.
testPlot(testTable)testPlot(testTable)
testTable |
A data frame output from |
The function reshapes the exact test result table from wide to long format and plots input and background proportions side by side per tissue. Tissues are ordered by proportion for easier visual comparison. P-values are rounded to 3 decimal places and displayed to the right of the bars.
A ggplot2 object showing a horizontal grouped bar chart with:
Blue bars representing the proportion of input proteins per tissue
Grey bars representing the proportion of background proteins
P-values from exact test annotated per tissue
result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID", database = NULL ) # run test's exact test across all tissues testResult <- testByTissue(result) # plot results testPlot(testResult)result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID", database = NULL ) # run test's exact test across all tissues testResult <- testByTissue(result) # plot results testPlot(testResult)
geneClassification.An example of the data frame the for the 'tissue_groups' parameter of
geneClassification.
tissue_maptissue_map
An example of the data frame the for the 'tissue_groups' parameter
of geneClassification. This data frame has two columns named
Tissue and Group, defining predefined tissue groupings for
group-enriched analysis.
data(tissue_map) head(tissue_map)data(tissue_map) head(tissue_map)
Performs tissue enrichment analysis by mapping input proteins and background
proteins against a reference expression database. Proteins not found in the
database are removed with a warning, and the matched results are returned
as an Enrichment object for downstream analysis.
tissueAnalysis( input, background = "Default", typeKey = "Gene", typeKeyBg = "Ensembl", database = NULL )tissueAnalysis( input, background = "Default", typeKey = "Gene", typeKeyBg = "Ensembl", database = NULL )
input |
A character vector of protein identifiers to be analysed (e.g. gene symbols or Ensembl IDs). |
background |
A character vector of background protein identifiers
representing the universe of proteins. Defaults to
|
typeKey |
A character string specifying the identifier type for the
input proteins. Must match a column name in the reference database.
Default is |
typeKeyBg |
A character string indicating the identifier type used for
the background proteins. This must be "Gene", "Ensembl", or "EntrezID".
The default is |
database |
Defaults to |
The function maps input and background protein lists against the internal
reference expression database ee_tb. Proteins not found in the
database are removed before analysis. If no proteins are found in the
database, the function stops with an informative error message.
Note that typeKey and typeKeyBg may differ because input
proteins and background proteins can use different identifier systems
(e.g. gene symbols vs Ensembl IDs). Both are mapped to the same reference
database ee_tb which contains multiple identifier columns.
An Enrichment S4 object containing:
input — a data frame of matched input proteins with
reference database annotations
background — a data frame of matched background proteins
with reference database annotations
enrichmentAnalysis, Enrichment-class
result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID", database = NULL ) # access results getInput(result) getBackground(result)result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID", database = NULL ) # access results getInput(result) getBackground(result)
Performs enrichment analysis in the tissue designated by the
parameter tissueToTest by mapping input genes or proteins against
a reference expression database. Genes or proteins not found in the database
are removed with a warning, and the matched results are returned as a data
frame showing genes or proteins enriched in the corresponding tissue.
tissueAnalysis2( input, typeKey = "Gene", database = NULL, inclusion = "All", secretoryOnly = FALSE, tissueToTest )tissueAnalysis2( input, typeKey = "Gene", database = NULL, inclusion = "All", secretoryOnly = FALSE, tissueToTest )
input |
A character vector of gene or proteins identifiers to be analysed (e.g. gene symbols or Ensembl IDs). |
typeKey |
A character string specifying the identifier type for the
input genes or proteins. Must match a column name in the reference database.
Default is |
database |
Defaults to |
inclusion |
A character vector specifying which signal categories to
include in the analysis. Valid options are |
secretoryOnly |
A logical value indicating whether to restrict the
analysis to secretory proteins only (i.e. rows where |
tissueToTest |
The tissue in which the input proteins or genes are
tested for enrichment. Must be one of the tissue listed in the
|
The function maps input gene or proteins lists against the internal
reference expression database like the defaultee_tb in the
tissue designated by the parameter tissueToTest. Proteins
or genes not found in the database are removed before analysis.
If no proteins are found in the database, the function stops with
an informative error message.
A data frame of matched input genes with reference database
annotations for the tissue designated by the tissueToTest
parameter.
enrichmentAnalysis, Enrichment-class
# using gene symbols for input, Ensembl IDs for background result2 <- tissueAnalysis2( input = c("BRCA1", "EGFR"), typeKey = "Gene", database = NULL, inclusion = "All", secretoryOnly = FALSE, tissueToTest = "Testis" ) # access results result2# using gene symbols for input, Ensembl IDs for background result2 <- tissueAnalysis2( input = c("BRCA1", "EGFR"), typeKey = "Gene", database = NULL, inclusion = "All", secretoryOnly = FALSE, tissueToTest = "Testis" ) # access results result2
Write Enrichment Analysis Output to File
writeOutput(out, type = "csv", filename)writeOutput(out, type = "csv", filename)
out |
An |
type |
A character string specifying the output file format.
Must be either |
filename |
A character string specifying the output file path. |
Invisibly returns NULL. Called for its side effect of
writing a file to disk.
result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID", database = NULL ) writeOutput(result,type = "csv","~/Enrichment_Results.csv")result <- tissueAnalysis( input = c("TP53", "BRCA1", "EGFR"), background = c("347", "948", "1050", "2167", "2819", "3625"), typeKey = "Gene", typeKeyBg = "EntrezID", database = NULL ) writeOutput(result,type = "csv","~/Enrichment_Results.csv")