TAPseq 1.10.0
One application of TAP-seq is to measure the expression of genes that enable assigning cells to different cell types. The TAPseq package offers a simple approach to identify a desired number of cell type markers based on differentially expressed genes between cell types.
This optional functionality requires additional R-packages such as Seurat. Please install the TAPseq package with all suggested dependencies.
The TAPseq package contains a small subset of the mouse bone marrow data from Baccin et al., 2019 (https://www.nature.com/articles/s41556-019-0439-6). The full dataset can be downloaded here. This dataset is stored in a Seurat object which contains both gene expression and cell type data for every cell.
library(TAPseq)
library(Seurat)
# example of mouse bone marrow 10x gene expression data
data("bone_marrow_genex")
# transcript counts
GetAssayData(bone_marrow_genex)[1:10, 1:10]
# number of cells per cell type
table(Idents(bone_marrow_genex))
A linear model with lasso regularization is used to select target genes that best identify cell
types. By default 10-fold cross-validation is used to select the number of target genes based on the
largest value of lambda within 1 standard error of the minimum. See ?glmnet::cv.glmnet
for more
details.
# automatically select a number of target genes using 10-fold cross-validation
target_genes_cv <- selectTargetGenes(bone_marrow_genex)
head(target_genes_cv)
length(target_genes_cv)
This example results in a reasonable target gene panel, but in cases with many different cell types the resulting panels might be very large.
To avoid this, we can specify a desired number of targets. This selects a value for lamda in the lasso model that results in approximately this number of non-zero coefficients, i.e. marker genes.
# identify approximately 100 target genes that can be used to identify cell populations
target_genes_100 <- selectTargetGenes(bone_marrow_genex, targets = 100)
length(target_genes_100)
To intuitively assess how well a chosen set of target genes distinguishes cell types, we can use UMAP plots based on the full gene expression data and on target genes only.
plotTargetGenes(bone_marrow_genex, target_genes = target_genes_100)
We can see that the expression of the 99 selected target genes groups cells of different populations together.
A good follow up would be to cluster the cells based on only the target genes following the same workflow used to define the cell identities in the original object. This could then be used to verify that the selected target genes reliably identify the correct cell types.
All of the output in this vignette was produced under the following conditions:
sessionInfo()
#> R version 4.2.1 (2022-06-23)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.5 LTS
#>
#> Matrix products: default
#> BLAS: /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.16-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] stats4 stats graphics grDevices utils datasets methods
#> [8] base
#>
#> other attached packages:
#> [1] sp_1.5-0 SeuratObject_4.1.2
#> [3] Seurat_4.2.0 ggplot2_3.3.6
#> [5] dplyr_1.0.10 BSgenome.Hsapiens.UCSC.hg38_1.4.4
#> [7] BSgenome_1.66.0 rtracklayer_1.58.0
#> [9] Biostrings_2.66.0 XVector_0.38.0
#> [11] BiocParallel_1.32.0 GenomicRanges_1.50.0
#> [13] GenomeInfoDb_1.34.0 IRanges_2.32.0
#> [15] S4Vectors_0.36.0 BiocGenerics_0.44.0
#> [17] TAPseq_1.10.0 BiocStyle_2.26.0
#>
#> loaded via a namespace (and not attached):
#> [1] utf8_1.2.2 reticulate_1.26
#> [3] tidyselect_1.2.0 RSQLite_2.2.18
#> [5] AnnotationDbi_1.60.0 htmlwidgets_1.5.4
#> [7] grid_4.2.1 Rtsne_0.16
#> [9] munsell_0.5.0 codetools_0.2-18
#> [11] ica_1.0-3 future_1.28.0
#> [13] miniUI_0.1.1.1 withr_2.5.0
#> [15] spatstat.random_3.0-0 colorspace_2.0-3
#> [17] progressr_0.11.0 Biobase_2.58.0
#> [19] filelock_1.0.2 highr_0.9
#> [21] knitr_1.40 ROCR_1.0-11
#> [23] tensor_1.5 listenv_0.8.0
#> [25] MatrixGenerics_1.10.0 labeling_0.4.2
#> [27] GenomeInfoDbData_1.2.9 polyclip_1.10-4
#> [29] bit64_4.0.5 farver_2.1.1
#> [31] parallelly_1.32.1 vctrs_0.5.0
#> [33] generics_0.1.3 xfun_0.34
#> [35] BiocFileCache_2.6.0 R6_2.5.1
#> [37] bitops_1.0-7 spatstat.utils_3.0-1
#> [39] cachem_1.0.6 DelayedArray_0.24.0
#> [41] assertthat_0.2.1 promises_1.2.0.1
#> [43] BiocIO_1.8.0 scales_1.2.1
#> [45] rgeos_0.5-9 gtable_0.3.1
#> [47] globals_0.16.1 goftest_1.2-3
#> [49] rlang_1.0.6 splines_4.2.1
#> [51] lazyeval_0.2.2 spatstat.geom_3.0-3
#> [53] BiocManager_1.30.19 yaml_2.3.6
#> [55] reshape2_1.4.4 abind_1.4-5
#> [57] GenomicFeatures_1.50.0 httpuv_1.6.6
#> [59] tools_4.2.1 bookdown_0.29
#> [61] ellipsis_0.3.2 spatstat.core_2.4-4
#> [63] jquerylib_0.1.4 RColorBrewer_1.1-3
#> [65] ggridges_0.5.4 Rcpp_1.0.9
#> [67] plyr_1.8.7 progress_1.2.2
#> [69] zlibbioc_1.44.0 purrr_0.3.5
#> [71] RCurl_1.98-1.9 prettyunits_1.1.1
#> [73] rpart_4.1.19 deldir_1.0-6
#> [75] pbapply_1.5-0 cowplot_1.1.1
#> [77] zoo_1.8-11 SummarizedExperiment_1.28.0
#> [79] ggrepel_0.9.1 cluster_2.1.4
#> [81] magrittr_2.0.3 data.table_1.14.4
#> [83] magick_2.7.3 scattermore_0.8
#> [85] lmtest_0.9-40 RANN_2.6.1
#> [87] fitdistrplus_1.1-8 matrixStats_0.62.0
#> [89] hms_1.1.2 patchwork_1.1.2
#> [91] mime_0.12 evaluate_0.17
#> [93] xtable_1.8-4 XML_3.99-0.12
#> [95] shape_1.4.6 gridExtra_2.3
#> [97] compiler_4.2.1 biomaRt_2.54.0
#> [99] tibble_3.1.8 KernSmooth_2.23-20
#> [101] crayon_1.5.2 htmltools_0.5.3
#> [103] mgcv_1.8-41 later_1.3.0
#> [105] tidyr_1.2.1 DBI_1.1.3
#> [107] dbplyr_2.2.1 MASS_7.3-58.1
#> [109] rappdirs_0.3.3 Matrix_1.5-1
#> [111] cli_3.4.1 parallel_4.2.1
#> [113] igraph_1.3.5 pkgconfig_2.0.3
#> [115] GenomicAlignments_1.34.0 plotly_4.10.0
#> [117] spatstat.sparse_3.0-0 foreach_1.5.2
#> [119] xml2_1.3.3 bslib_0.4.0
#> [121] stringr_1.4.1 digest_0.6.30
#> [123] sctransform_0.3.5 RcppAnnoy_0.0.20
#> [125] spatstat.data_3.0-0 rmarkdown_2.17
#> [127] leiden_0.4.3 uwot_0.1.14
#> [129] restfulr_0.0.15 curl_4.3.3
#> [131] shiny_1.7.3 Rsamtools_2.14.0
#> [133] rjson_0.2.21 nlme_3.1-160
#> [135] lifecycle_1.0.3 jsonlite_1.8.3
#> [137] limma_3.54.0 viridisLite_0.4.1
#> [139] fansi_1.0.3 pillar_1.8.1
#> [141] lattice_0.20-45 KEGGREST_1.38.0
#> [143] fastmap_1.1.0 httr_1.4.4
#> [145] survival_3.4-0 glue_1.6.2
#> [147] iterators_1.0.14 png_0.1-7
#> [149] glmnet_4.1-4 bit_4.0.4
#> [151] stringi_1.7.8 sass_0.4.2
#> [153] blob_1.2.3 memoise_2.0.1
#> [155] irlba_2.3.5.1 future.apply_1.9.1