plot_per_group {infercnv} | R Documentation

## plot_per_group

### Description

Takes an infercnv object and subdivides it into one object per group of cells to allow plotting of each group on a seperate plot. If references are selected, they will appear on the observation heatmap area as it is larger.

### Usage

    plot_per_group(infercnv_obj, on_references = TRUE,
      on_observations = TRUE, sample = FALSE, n_cells = 1000,
      every_n = NULL, above_m = 1000,
      base_filename = "infercnv_per_group", output_format = "png",
      write_expr_matrix = TRUE, save_objects = FALSE, png_res = 300,
      dynamic_resize = 0, out_dir)

### Arguments

`infercnv_obj` | infercnv_object
`on_references` | boolean (default=TRUE), plot references (normal cells).
`on_observations` | boolean (default=TRUE), plot observations data (tumor cells).
`sample` | Whether unique groups of cells should be sampled from or not. (see other parameters for how sampling is done) (Default: FALSE)
`n_cells` | Number of cells that should be sampled per group if sampling is enabled (default = 1000) .
`every_n` | Sample 1 cell every_n cells for each group that has above_m cells, if sampling is enabled. 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. (Default: NULL)
`above_m` | Sample only groups that have at least above_m cells if sampling is enabled. (default: 1000) Does not require every_n to be set.
`base_filename` | Base prefix for the output files names. Will be followed by OBS/REF to indidate the type of the group, and the group name. (Default: "infercnv_per_group")
`output_format` | Output format for the figure. Choose between "png", "pdf" and NA. NA means to only write the text outputs without generating the figure itself. (default: "png")
`write_expr_matrix` | Includes writing a matrix file containing the expression data that is plotted in the heatmap. (default: FALSE)
`save_objects` | Whether to save the infercnv objects generated for each group as RDS. (default: FALSE)
`png_res` | Resolution for png output. (Default: 300)
`dynamic_resize` | Factor (>= 0) by which to scale the dynamic resize of the observation heatmap and the overall plot based on how many cells there are. Default is 0, which disables the scaling. Try 1 first if you want to enable. (Default: 0)
`out_dir` | Directory in which to save plots and other outputs.

### Value

void

### 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::plot_per_group(infercnv_obj, out_dir=tempfile())

[Package infercnv version 1.4.0 Index]