Contents

library(TMExplorer)
#> Loading required package: SingleCellExperiment
#> Loading required package: SummarizedExperiment
#> Loading required package: MatrixGenerics
#> Loading required package: matrixStats
#> 
#> Attaching package: 'MatrixGenerics'
#> The following objects are masked from 'package:matrixStats':
#> 
#>     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
#>     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
#>     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
#>     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
#>     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
#>     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
#>     colWeightedMeans, colWeightedMedians, colWeightedSds,
#>     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
#>     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
#>     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
#>     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
#>     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
#>     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
#>     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
#>     rowWeightedSds, rowWeightedVars
#> Loading required package: GenomicRanges
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> Loading required package: parallel
#> 
#> Attaching package: 'BiocGenerics'
#> The following objects are masked from 'package:parallel':
#> 
#>     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
#>     clusterExport, clusterMap, parApply, parCapply, parLapply,
#>     parLapplyLB, parRapply, parSapply, parSapplyLB
#> The following objects are masked from 'package:stats':
#> 
#>     IQR, mad, sd, var, xtabs
#> The following objects are masked from 'package:base':
#> 
#>     Filter, Find, Map, Position, Reduce, anyDuplicated, append,
#>     as.data.frame, basename, cbind, colnames, dirname, do.call,
#>     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
#>     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#>     pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
#>     tapply, union, unique, unsplit, which.max, which.min
#> Loading required package: S4Vectors
#> 
#> Attaching package: 'S4Vectors'
#> The following objects are masked from 'package:base':
#> 
#>     I, expand.grid, unname
#> Loading required package: IRanges
#> Loading required package: GenomeInfoDb
#> Loading required package: Biobase
#> Welcome to Bioconductor
#> 
#>     Vignettes contain introductory material; view with
#>     'browseVignettes()'. To cite Bioconductor, see
#>     'citation("Biobase")', and for packages 'citation("pkgname")'.
#> 
#> Attaching package: 'Biobase'
#> The following object is masked from 'package:MatrixGenerics':
#> 
#>     rowMedians
#> The following objects are masked from 'package:matrixStats':
#> 
#>     anyMissing, rowMedians
#> Loading required package: BiocFileCache
#> Loading required package: dbplyr

1 Introduction

TMExplorer (Tumour Microenvironment Explorer) is a curated collection of scRNAseq datasets sequenced from tumours. It aims to provide a single point of entry for users looking to study the tumour microenvironment at the single-cell level.

Users can quickly search available datasets using the metadata table, and then download the datasets they are interested in for analysis. Optionally, users can save the datasets for use in applications other than R.

This package will improve the ease of studying the tumour microenvironment with single-cell sequencing. Developers may use this package to obtain data for validation of new algorithms and researchers interested in the tumour microenvironment may use it to study specific cancers more closely.

2 Exploring available datasets

Start by exploring the available datasets through metadata.

res = queryTME(metadata_only = TRUE)
Reference accession author journal year
Patel_Science_2014 GSE57872 Patel Science 2014
Tirosh_Science_2016a GSE72056 Tirosh Science 2016
Tirosh_Nature_ 2016b GSE70630 Tirosh Nature 2016
Venteicher_Science_2017 GSE89567 Venteicher Science 2017
Li_Nature_Genetics_2017 GSE81861 Li Nature Genetics 2017
Chung_Nature_Commun_2017 GSE75688 Chung Nature Comm 2017

This will return a list containing a single dataframe of metadata for all available datasets. View the metadata with View(res[[1]]) and then check ?queryTME for a description of searchable fields.

Note: in order to keep the function’s interface consistent, queryTME always returns a list of objects, even if there is only one object. You may prefer running res = queryTME(metadata_only = TRUE)[[1]] in order to save the dataframe directly.

The metatadata_only argument can be applied alongside any other argument in order to examine only datasets that have certain qualities. You can, for instance, view only breast cancer datasets by using

res = queryTME(tumour_type = 'Breast cancer', metadata_only = TRUE)[[1]]
Reference accession author journal year
6 Chung_Nature_Commun_2017 GSE75688 Chung Nature Comm 2017
15 Azizi_Cell_2018 GSE114727 Azizi Cell 2018
26 Yeo_Elife_2020 GSE123366 Yeo Elife 2020

Table 1: Search parameters for queryTME alongside example values.
Search Parameter Description Examples
geo_accession Search by GEO accession number GSE72056, GSE57872
score_type Search by type of score shown in $expression TPM, RPKM, FPKM
has_signatures Filter by presence of cell-type gene signatures TRUE, FALSE
has_truth Filter by presence of cell-type labels TRUE, FALSE
tumour_type Search by tumour type Breast cancer, Melanoma
author Search by first author Patel, Tirosh, Chung
journal Search by publication journal Science, Nature, Cell
year Search by year of publication <2015, >2015, 2013-2015
pmid Search by publication ID 24925914, 27124452
sequence_tech Search by sequencing technology SMART-seq, Fluidigm C1
organism Search by source organism Human, Mice
sparse Return expression in sparse matrices TRUE, FALSE

2.1 Searching by year

In order to search by single years and a range of years, the package looks for specific patterns. ‘2013-2015’ will search for datasets published between 2013 and 2015, inclusive. ‘<2015’ or ‘2015>’ will search for datasets published before or in 2015. ‘>2015’ or ‘2015<’ will search for datasets published in or after 2015.

3 Getting datasets

Once you’ve found a field to search on, you can get your data. For this example, we’re pulling a specific dataset by its GEO ID.

res = queryTME(geo_accession = "GSE81861")

This will return a list containing dataset GSE72056. The dataset is stored as a SingleCellExperiment object, which has the following metadata list


Table 2: Metadata attributes in the SingleCellExperiment object.
Attribute Description
signatures A data.frame containing the cell types and a list of genes that represent that cell type
cells A list of cells included in the study
genes A list of genes included in the study
pmid The PubMed ID of the study
technology The sequencing technology used
score_type The type of score shown in tme_data$expression
organism The type of organism from which cells were sequenced
author The first author of the paper presenting the data
tumour_type The type of tumour sequenced
patients The number of patients included in the study
tumours The number of tumours sampled by the study
geo_accession The GEO accession ID for the dataset

To access the expression data for a result, use

View(counts(res[[1]]))
RHC3546__Tcell__.C6E879 RHC3552__Epithelial__.2749FE
chrX:99883666-99894988_TSPAN6_ENSG00000000003.10 3 0
chrX:99839798-99854882_TNMD_ENSG00000000005.5 0 0
chr20:49505584-49575092_DPM1_ENSG00000000419.8 0 0
chr1:169631244-169863408_SCYL3_ENSG00000000457.9 0 0
chr1:169631244-169863408_C1orf112_ENSG00000000460.12 0 0
chr1:27938574-27961788_FGR_ENSG00000000938.8 0 0

Cell type labels are stored under colData(res[[1]]) for datasets for which cell type labels are available

Metadata is stored in a named list accessible by metadata(res[[1]]). Specific entries can be accessed by attribute name.

metadata(res[[1]])$pmid
#> [1] 28319088

3.1 Example: Returning all datasets with cell-type labels

Say you want to measure the performance of cell-type classification methods. To do this, you need datasets that have the true cell-types available.

res = queryTME(has_truth = TRUE)

This will return a list of all datasets that have true cell-types available. You can see the cell types for the first dataset using the following command:

View(colData(res[[1]]))
label
RHC3546__Tcell__.C6E879 Tcell
RHC3552__Epithelial__.2749FE Epithelial
RHC3553__Epithelial__.2749FE Epithelial
RHC3555__Bcell__.7DEA7B Bcell
RHC3556__Epithelial__.2749FE Epithelial
RHC3557__Bcell__.7DEA7B Bcell

The first column of this dataframe contains the cell barcode, and the second contains the cell type.

3.2 Example: Returning all datasets with cell-type labels and cell-type gene signatures

Some cell-type classification methods require a list of gene signatures, to return only datasets that have cell-type gene signatures available, use:

res = queryTME(has_truth = TRUE, has_signatures = TRUE)
View(metadata(res[[1]])$signatures)
MYELOID FIBROBLAST TCELL
ITGAX_ENSG00000140678.12 SPARC_ENSG00000113140.6 TRBC2_ENSG00000211772.4
CD68_ENSG00000129226.9 COL14A1_ENSG00000187955.7 TRBC2_ENSG00000211772.4
CD14_ENSG00000170458.9 COL13A1_ENSG00000197467.9 CD3E_ENSG00000198851.5
CCL3_ENSG00000006075.11 DCN_ENSG00000011465.12 CD3G_ENSG00000160654.5

4 Saving Data

To facilitate the use of any or all datasets outside of R, you can use saveTME(). saveTME takes two parameters, one a tme_data object to be saved, and the other the directory you would like data to be saved in. Note that the output directory should not already exist.

To save the data from the earlier example to disk, use the following commands.

res = queryTME(geo_accession = "GSE72056")[[1]]
saveTME(res, '~/Downloads/GSE72056')

The result is three CSV files that can be used in other programs. In the future we will support saving in other formats.

5 Session Information

sessionInfo()
#> R version 4.1.0 alpha (2021-05-01 r80254)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.2 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.13-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.13-bioc/R/lib/libRlapack.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        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] parallel  stats4    stats     graphics  grDevices utils     datasets 
#> [8] methods   base     
#> 
#> other attached packages:
#>  [1] TMExplorer_1.1.3             BiocFileCache_1.99.7        
#>  [3] dbplyr_2.1.1                 SingleCellExperiment_1.13.14
#>  [5] SummarizedExperiment_1.21.3  Biobase_2.51.0              
#>  [7] GenomicRanges_1.43.4         GenomeInfoDb_1.27.11        
#>  [9] IRanges_2.25.10              S4Vectors_0.29.18           
#> [11] BiocGenerics_0.37.5          MatrixGenerics_1.3.1        
#> [13] matrixStats_0.58.0           BiocStyle_2.19.2            
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.6             lattice_0.20-44        assertthat_0.2.1      
#>  [4] digest_0.6.27          utf8_1.2.1             R6_2.5.0              
#>  [7] RSQLite_2.2.7          evaluate_0.14          highr_0.9             
#> [10] httr_1.4.2             pillar_1.6.0           zlibbioc_1.37.0       
#> [13] rlang_0.4.11           curl_4.3.1             jquerylib_0.1.4       
#> [16] blob_1.2.1             Matrix_1.3-2           rmarkdown_2.7         
#> [19] stringr_1.4.0          RCurl_1.98-1.3         bit_4.0.4             
#> [22] DelayedArray_0.17.13   compiler_4.1.0         xfun_0.22             
#> [25] pkgconfig_2.0.3        htmltools_0.5.1.1      tidyselect_1.1.1      
#> [28] tibble_3.1.1           GenomeInfoDbData_1.2.4 bookdown_0.22         
#> [31] fansi_0.4.2            crayon_1.4.1           dplyr_1.0.5           
#> [34] rappdirs_0.3.3         bitops_1.0-7           grid_4.1.0            
#> [37] jsonlite_1.7.2         lifecycle_1.0.0        DBI_1.1.1             
#> [40] magrittr_2.0.1         stringi_1.5.3          cachem_1.0.4          
#> [43] XVector_0.31.1         bslib_0.2.4            ellipsis_0.3.2        
#> [46] filelock_1.0.2         generics_0.1.0         vctrs_0.3.8           
#> [49] tools_4.1.0            bit64_4.0.5            glue_1.4.2            
#> [52] purrr_0.3.4            fastmap_1.1.0          yaml_2.2.1            
#> [55] BiocManager_1.30.12    memoise_2.0.0          knitr_1.33            
#> [58] sass_0.3.1