sample_object: sample_object

Description Usage Arguments Value Examples

View source: R/infercnv_sampling.R

Description

Apply sampling on an infercnv object to reduce the number of cells in it and allow faster plotting or have all groups take up the same height on the heatmap

Usage

1
2
3
4
5
6
7
8
sample_object(
  infercnv_obj,
  n_cells = 100,
  every_n = NULL,
  above_m = NULL,
  on_references = TRUE,
  on_observations = TRUE
)

Arguments

infercnv_obj

infercnv_object

n_cells

Number of cells that should be sampled per group (default = 100).

every_n

Sample 1 cell every_n cells for each group. If subclusters are defined, this will make sure that at least one cell per subcluster is sampled. Requires above_m to be set to work, overriding n_cells parameter.

above_m

Sample groups that have at least above_m cells. Requires every_n to be set to work, overriding n_cells parameter

on_references

boolean (default=TRUE), sample references (normal cells).

on_observations

boolean (default=TRUE), sample observations data (tumor cells).

Value

sampled infercnv_obj

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# data(infercnv_data_example)
# data(infercnv_annots_example)
# data(infercnv_genes_example)

# infercnv_object_example <- infercnv::CreateInfercnvObject(raw_counts_matrix=infercnv_data_example, 
#                                                           gene_order_file=infercnv_genes_example,
#                                                           annotations_file=infercnv_annots_example,
#                                                           ref_group_names=c("normal"))

# infercnv_object_example <- infercnv::run(infercnv_object_example,
#                                          cutoff=1,
#                                          out_dir=tempfile(), 
#                                          cluster_by_groups=TRUE, 
#                                          denoise=TRUE,
#                                          HMM=FALSE,
#                                          num_threads=2,
#                                          no_plot=TRUE)

data(infercnv_object_example)

infercnv_object_example <- infercnv::sample_object(infercnv_object_example, n_cells=5)
# plot result object

infercnv documentation built on Nov. 8, 2020, 11:10 p.m.