Functions to subset cell and loci for fitting models and plotting.

subset_cell(mtmutObj, cell_list)

subset_loc(mtmutObj, loc_list)

Arguments

mtmutObj

a mtmutObj object

cell_list

a list of cell barcodes

loc_list

a list of loci

Value

a mtmutObj object with cell and loci selected

Examples

## Use the example data
f <- system.file("extdata", "mini_dataset.tsv.gz", package = "scMitoMut")

## Create a temporary h5 file
## In real case, we keep the h5 in project folder for future use
f_h5_tmp <- tempfile(fileext = ".h5")

## Load the data with parse_table function
f_h5 <- parse_table(f, sep = "\t", h5_file = f_h5_tmp)

## open the h5 file and create a mtmutObj object
x <- open_h5_file(f_h5)
x
#> mtmutObj object
#> -------------------------------------------------
#> h5 file: /tmp/RtmppwH5Ub/file2395d6f6bfa2a.h5
#> Available loci: 16
#> Selected loci: 16
#> Available cells: 1359
#> Selected cells: 1359
#> Loci passed the filter: 0
#> filter parameters: 
#> 	min_cell: 1
#> 	model: bb
#> 	p_threshold: 0.05
#> 	alt_count_threshold: 0
#> 	p_adj_method: fdr
## subset cell and loci
x <- subset_cell(x, x$cell_list[1:10])
x <- subset_loc(x, x$loc_list[1:10])
x
#> mtmutObj object
#> -------------------------------------------------
#> h5 file: /tmp/RtmppwH5Ub/file2395d6f6bfa2a.h5
#> Available loci: 16
#> Selected loci: 10
#> Available cells: 1359
#> Selected cells: 10
#> Loci passed the filter: 0
#> filter parameters: 
#> 	min_cell: 1
#> 	model: bb
#> 	p_threshold: 0.05
#> 	alt_count_threshold: 0
#> 	p_adj_method: fdr