HPAStainR is a package designed to query the pathologist scored staining data of multiple proteins/genes at once in the Human Protein Atlas (HPA). This vignette will walk you through:
How to download the data required to run HPAStainR
How to run HPAStainR as a function
How to run HPAStainR as a Shiny App
Installation can be completed using BiocManager and the code below.
The first step required to run HPAStainR is downloading HPA’s normal tissue staining data and their cancer data. While available online, HPAStainR has a function that can download and load the data for you.
library(HPAStainR)
#> Loading required package: dplyr
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#> Loading required package: tidyr
HPA_data <- HPA_data_downloader(tissue_type = "both", save_file = FALSE)
The above function has downloaded both normal tissue and cancer data. save_file
was set to FALSE
, but if it were set to TRUE
as there was no given argument for save location
, both files being saved to the current working directory. The data has also been unzipped and loaded into the object HPA_dat as a list of data frames called hpa_dat
and cancer_dat
which hold the normal tissue and cancer tissue data respectively. If the code is run again it would redownload the files unless you had set save_file
to TRUE
, in which case it would just load said saved files.
Gene | Gene.name | Tissue | Cell.type | Level | Reliability |
---|---|---|---|---|---|
ENSG00000000003 | TSPAN6 | adipose tissue | adipocytes | Not detected | Approved |
ENSG00000000003 | TSPAN6 | adrenal gland | glandular cells | Not detected | Approved |
ENSG00000000003 | TSPAN6 | appendix | glandular cells | Medium | Approved |
ENSG00000000003 | TSPAN6 | appendix | lymphoid tissue | Not detected | Approved |
ENSG00000000003 | TSPAN6 | bone marrow | hematopoietic cells | Not detected | Approved |
ENSG00000000003 | TSPAN6 | breast | adipocytes | Not detected | Approved |
ENSG00000000003 | TSPAN6 | breast | glandular cells | High | Approved |
ENSG00000000003 | TSPAN6 | breast | myoepithelial cells | Not detected | Approved |
ENSG00000000003 | TSPAN6 | bronchus | respiratory epithelial cells | High | Approved |
ENSG00000000003 | TSPAN6 | caudate | glial cells | Not detected | Approved |
Gene | Gene.name | Cancer | High | Medium | Low | Not.detected |
---|---|---|---|---|---|---|
ENSG00000000003 | TSPAN6 | breast cancer | 1 | 7 | 2 | 2 |
ENSG00000000003 | TSPAN6 | carcinoid | 0 | 1 | 1 | 2 |
ENSG00000000003 | TSPAN6 | cervical cancer | 11 | 1 | 0 | 0 |
ENSG00000000003 | TSPAN6 | colorectal cancer | 0 | 6 | 2 | 2 |
ENSG00000000003 | TSPAN6 | endometrial cancer | 10 | 2 | 0 | 0 |
ENSG00000000003 | TSPAN6 | glioma | 0 | 0 | 0 | 11 |
ENSG00000000003 | TSPAN6 | head and neck cancer | 0 | 3 | 1 | 0 |
ENSG00000000003 | TSPAN6 | liver cancer | 4 | 5 | 1 | 0 |
ENSG00000000003 | TSPAN6 | lung cancer | 8 | 4 | 0 | 0 |
ENSG00000000003 | TSPAN6 | lymphoma | 0 | 0 | 0 | 11 |
hpar
package as a version controlled alternativeHPA_data_downloader
provides the most up to date information on the Human Protein Atlas website. However for more consistent results with version control, feel free to use the data from the hpar
BioConductor package using the following commands.
if (!requireNamespace("hpar", quietly = TRUE))
BiocManager::install(hpar)
data(hpaNormalTissue, package = "hpar")
data(hpaCancer, package = "hpar")
hpar
’s normal tissueGene | Gene.name | Tissue | Cell.type | Level | Reliability |
---|---|---|---|---|---|
ENSG00000000003 | TSPAN6 | adipose tissue | adipocytes | Not detected | Approved |
ENSG00000000003 | TSPAN6 | adrenal gland | glandular cells | Not detected | Approved |
ENSG00000000003 | TSPAN6 | appendix | glandular cells | Medium | Approved |
ENSG00000000003 | TSPAN6 | appendix | lymphoid tissue | Not detected | Approved |
ENSG00000000003 | TSPAN6 | bone marrow | hematopoietic cells | Not detected | Approved |
ENSG00000000003 | TSPAN6 | breast | adipocytes | Not detected | Approved |
ENSG00000000003 | TSPAN6 | breast | glandular cells | High | Approved |
ENSG00000000003 | TSPAN6 | breast | myoepithelial cells | Not detected | Approved |
ENSG00000000003 | TSPAN6 | bronchus | respiratory epithelial cells | High | Approved |
ENSG00000000003 | TSPAN6 | caudate | glial cells | Not detected | Approved |
Now that the data is available you can now us the HPAStainR function. This requires a list of proteins or genes you are interested in. In this example, we’re going to use pancreatic enzymes PRSS1, PNLIP, CELA3A, and the hormone PRL.
gene_list = c("PRSS1", "PNLIP","CELA3A", "PRL")
stainR_out <- HPAStainR::HPAStainR(gene_list = gene_list,
hpa_dat = HPA_data$hpa_dat,
cancer_dat = HPA_data$cancer_dat,
cancer_analysis = "both",
stringency = "normal")
head(stainR_out, 10)
#> # A tibble: 10 × 11
#> cell_type percent_high_ex… percent_medium_… percent_low_exp… percent_not_det…
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 PANCREAS… 0.75 0 0 0.25
#> 2 breast c… 0 1 0 0
#> 3 carcinoid 0 1 0 0
#> 4 cervical… 0 1 0 0
#> 5 colorect… 0 1 0 0
#> 6 endometr… 0 1 0 0
#> 7 glioma 0 1 0 0
#> 8 liver ca… 0 1 0 0
#> 9 lung can… 0 1 0 0
#> 10 lymphoma 0 1 0 0
#> # … with 6 more variables: number_of_proteins <dbl>, tested_proteins <chr>,
#> # detected_proteins <chr>, staining_score <dbl>, p_val <dbl>, p_val_adj <dbl>
The output of HPAStainR is a tibble with multiple columns. The basic columns include the following:
cell_type: The cell types/cancers that are tested in the Human Protein Atlas.
percent/count_high/medium/low_expression: Either the percent or count of genes from the list that stain either at high levels, medium levels or low levels.
percent/count_not_detected: The number or percent of proteins that failed to stain the cell type.
number of proteins: The number of proteins tested in a cell type.
tested_proteins: A character string of proteins that were tested in the cell type as not all proteins are tested in every cell type.
enriched_score: An arbitrary ranking value further explained below.
p_val: A p-value denoting an enrichment of rarely staining proteins (stained in <29% of the cell types, see paper [cite] for further details).
p_val_adjust: The previous p-value adjusted for multiple testing using “holm”
The staining score an arbitrary rank of staining weighted on how highly a protein stained. See the manual for the equation and further information.
Another way to use HPAStainR is as a Shiny app, and the function shiny_HPAStainR allows you to run a local version of the app:
Note: If you want the tab from the online Shiny that gives you the stained : tested ratio of proteins, make sure to run the below code and insert the resulting object in the third argument (cell_type_data
) of shiny_HPAStainR
shiny_HPAStainR(hpa_dat = HPA_data$hpa_dat,
cancer_dat = HPA_data$cancer_dat,
cell_type_data = hpa_summary)
You should now be able to query whatever list of proteins you like and can easily rank them on whatever column you wish. Also all of the options from the functions are modifiable on the left hand side panel.
sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.3 LTS
#>
#> Matrix products: default
#> BLAS: /home/biocbuild/bbs-3.14-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.14-bioc/R/lib/libRlapack.so
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_GB LC_COLLATE=C
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] HPAStainR_1.4.1 tidyr_1.1.4 dplyr_1.0.7
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.7 highr_0.9 pillar_1.6.4 bslib_0.3.1
#> [5] compiler_4.1.2 later_1.3.0 jquerylib_0.1.4 tools_4.1.2
#> [9] digest_0.6.28 jsonlite_1.7.2 evaluate_0.14 lifecycle_1.0.1
#> [13] tibble_3.1.6 pkgconfig_2.0.3 rlang_0.4.12 cli_3.1.0
#> [17] shiny_1.7.1 DBI_1.1.1 yaml_2.2.1 xfun_0.28
#> [21] fastmap_1.1.0 stringr_1.4.0 knitr_1.36 generics_0.1.1
#> [25] vctrs_0.3.8 sass_0.4.0 tidyselect_1.1.1 data.table_1.14.2
#> [29] glue_1.5.0 R6_2.5.1 fansi_0.5.0 rmarkdown_2.11
#> [33] hpar_1.36.0 purrr_0.3.4 magrittr_2.0.1 scales_1.1.1
#> [37] promises_1.2.0.1 ellipsis_0.3.2 htmltools_0.5.2 assertthat_0.2.1
#> [41] colorspace_2.0-2 xtable_1.8-4 mime_0.12 httpuv_1.6.3
#> [45] utf8_1.2.2 stringi_1.7.5 munsell_0.5.0 crayon_1.4.2
Any questions? Feel free to contact me at tnieuwe1[@]jhmi.edu