plot_cnv {infercnv}R Documentation

Plot the matrix as a heatmap, with cells as rows and genes as columns, ordered according to chromosome

Description

Formats the data and sends it for plotting.

Usage

plot_cnv(infercnv_obj, out_dir = ".", title = "inferCNV",
  obs_title = "Observations (Cells)", ref_title = "References (Cells)",
  cluster_by_groups = TRUE, cluster_references = TRUE,
  k_obs_groups = 3, contig_cex = 1,
  x.center = mean(infercnv_obj@expr.data), x.range = "auto",
  hclust_method = "ward.D", color_safe_pal = FALSE,
  output_filename = "infercnv", output_format = "png", png_res = 300,
  dynamic_resize = 0, ref_contig = NULL, write_expr_matrix = FALSE)

Arguments

infercnv_obj

infercnv object

out_dir

Directory in which to save pdf and other output.

title

Plot title.

obs_title

Title for the observations matrix.

ref_title

Title for the reference matrix.

cluster_by_groups

Whether to cluster observations by their annotations or not. Using this ignores k_obs_groups.

cluster_references

Whether to cluster references within their annotations or not. (dendrogram not displayed)

k_obs_groups

Number of groups to break observation into.

contig_cex

Contig text size.

x.center

Value on which to center expression.

x.range

vector containing the extreme values in the heatmap (ie. c(-3,4) )

hclust_method

Clustering method to use for hclust.

color_safe_pal

Logical indication of using a color blindness safe palette.

output_filename

Filename to save the figure to.

output_format

format for heatmap image file (default: 'png'), options('png', 'pdf', NA) If set to NA, will print graphics natively

png_res

Resolution for png output.

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.

ref_contig

If given, will focus cluster on only genes in this contig.

write_expr_matrix

Includes writing a matrix file containing the expression data that is plotted in the heatmap.

Value

A list of all relevent settings used for the plotting to be able to reuse them in another plot call while keeping consistant plotting settings, most importantly x.range.

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)

plot_cnv(infercnv_obj,
         out_dir=tempfile(),
         obs_title="Observations (Cells)",
         ref_title="References (Cells)",
         cluster_by_groups=TRUE,
         x.center=1,
         x.range="auto",
         hclust_method='ward.D',
         color_safe_pal=FALSE,
         output_filename="infercnv",
         output_format="png",
         png_res=300,
         dynamic_resize=0
         )


[Package infercnv version 1.0.2 Index]