This function filters the mutations based on the mutation calling model and parameters. The loci passed the filter will be saved in the h5 file, together with the filter parameters.
filter_loc(
mtmutObj,
min_cell = 5,
model = "bb",
p_threshold = 0.05,
alt_count_threshold = 0,
p_adj_method = "fdr"
)
a mtmutObj object.
a integer of the minimum number of cells with mutation, the default is 5.
a string of the model for mutation calling, it can be "bb", "bm" or "bi" which stands for beta binomial, binomial mixture and binomial model respectively, the default is "bb".
a numeric of the p-value threshold, the default is 0.05.
a integer of the minimum number of alternative base count, the default is 0.
a string of the method for p-value adjustment, .
refer to p.adjust
. The default is "fdr".
a mtmutObj object with loc_pass and loc_filter updated.
## 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)
run_model_fit(x)
#> chrM.200
#> chrM.204
#> chrM.310
#> chrM.824
#> chrM.1000
#> chrM.1001
#> chrM.1227
#> chrM.2285
#> chrM.6081
#> chrM.9429
#> chrM.9728
#> chrM.9804
#> chrM.9840
#> chrM.12889
#> chrM.16093
#> chrM.16147
#> used (Mb) gc trigger (Mb) max used (Mb)
#> Ncells 2125101 113.5 3221262 172.1 3221262 172.1
#> Vcells 4294913 32.8 10146329 77.5 10123834 77.3
x <- filter_loc(x, min_cell = 5, model = "bb", p_threshold = 0.05, p_adj_method = "fdr")
x
#> mtmutObj object
#> -------------------------------------------------
#> h5 file: /tmp/RtmppwH5Ub/file2395d57885ac0.h5
#> Available loci: 16
#> Selected loci: 16
#> Available cells: 1359
#> Selected cells: 1359
#> Loci passed the filter: 14
#> filter parameters:
#> min_cell: 5
#> model: bb
#> p_threshold: 0.05
#> alt_count_threshold: 0
#> p_adj_method: fdr