Skip to contents

[Experimental]
Functions to download matrices and fragments derived from a 10X Genomics PBMC 3k dataset, with options to filter with common qc metrics, and to subset genes and fragments to only chromosome 4 and 11.

Usage

get_demo_mat(filter_qc = TRUE, subset = TRUE)

get_demo_frags(filter_qc = TRUE, subset = TRUE)

remove_demo_data()

Arguments

filter_qc

(bool) Whether to filter both the RNA and ATAC data using qc metrics (described in details).

subset

(bool) Whether to subset to only genes/insertions on chromosome 4 and 11.

Value

  • get_demo_mat(): (IterableMatrix) A (features x cells) matrix.

  • get_demo_frags(): (IterableFragments) A Fragments object.

  • remove_demo_data(): NULL

Details

These data functions are experimental. The interface, as well as the demo dataset itself will likely undergo changes in the near future.

Data Processing:

The first time either get_demo_mat(), or get_demo_frags(), are ran demo data is downloaded and stored in the BPCells data directory (under file.path(tools::R_user_dir("BPcells", which="data"), "demo_data")).

Subsequent calls to this function will use the previously downloaded matrix/fragments, given that the same combination of filtering and subsetting has been performed previously.

The preparation of this matrix can be reproduced by running the internal function prepare_demo_data() with directory set to the BPCells data directory.

In the case that demo data is not pre-downloaded and demo data download fails, prepare_demo_data() will act as a fallback.

Both the matrix from get_demo_mat() and the fragments from get_demo_frags() may be removed by running remove_demo_data().

Filtering using QC information on the fragments and matrix object chooses cells with at least 1000 reads, 1000 frags, and a minimum tss enrichment of 10. Subsetting provides only genes and insertions on chromosomes 4 and 11.

Dimensions:

ConditionRNA matrix (features x cells)Fragments (chromosomes x cells)
Raw(36601 x 650165)(39 x 462264)
Filter(36601 x 2600)(39 x 2600)
Subset(3582 x 650165)(2 x 462264)
Filter + Subset(3582 x 2600)(2 x 2600)

Data size:

ConditionRNA matrix (MB)Fragments (MB)
Raw31.9200
Filter9.4137
Subset18.325.6
Filter + Subset1.212.3

Function Description:

  • get_demo_mat(): Retrieve a demo IterableMatrix object representing the 10X Genomics PBMC 3k dataset.

  • get_demo_frags(): Retrieve a demo IterableFragments object representing the 10X Genomics PBMC 3k dataset.

  • remove_demo_data(): Remove the demo data from the BPCells data directory.

Examples

#######################################################################
## get_demo_mat() example
#######################################################################
get_demo_mat()
#> 3582 x 2600 IterableMatrix object with class MatrixDir
#> 
#> Row names: ENSG00000272602, ENSG00000250312 ... ENSG00000255512
#> Col names: TTTAGCAAGGTAGCTT-1, AGCCGGTTCCGGAACC-1 ... TACTAAGTCCAATAGC-1
#> 
#> Data type: uint32_t
#> Storage order: column major
#> 
#> Queued Operations:
#> 1. Load compressed matrix from directory /home/runner/.local/share/R/BPCells/demo_data/demo_mat_filtered_subsetted


#######################################################################
## get_demo_frags() example
#######################################################################
get_demo_frags()
#> IterableFragments object of class "FragmentsDir"
#> 
#> Cells: 2600 cells with names TTTAGCAAGGTAGCTT-1, AGCCGGTTCCGGAACC-1 ... TACTAAGTCCAATAGC-1
#> Chromosomes: 2 chromosomes with names chr4, chr11
#> 
#> Queued Operations:
#> 1. Read compressed fragments from directory /home/runner/.local/share/R/BPCells/demo_data/demo_frags_filtered_subsetted


#######################################################################
## remove_demo_data() example
#######################################################################
remove_demo_data()


## Demo data folder is now empty
data_dir <- file.path(tools::R_user_dir("BPCells", which = "data"), "demo_data")
list.files(data_dir)
#> character(0)