sample_object {infercnv} | R Documentation

## sample_object

### 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

    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

    # data(data)
    # data(annots)
    # data(genes)

    # infercnv_obj <- infercnv::CreateInfercnvObject(raw_counts_matrix=data,
    #                                                gene_order_file=genes,
    #                                                annotations_file=annots,
    #                                                ref_group_names=c("normal"))

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

    data(infercnv_object)

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

[Package infercnv version 1.4.0 Index]