0

我正在尝试使用 package.json 生成热图cellrangerRkit。这个包中的pheatmap函数是指pheatmap库中的函数,如下所示:

gbm_pheatmap
function (gbm, genes_to_plot, cells_to_plot, n_genes = 5, colour = NULL, 
          limits = c(-3, 3)) 
{
  if (!is.list(genes_to_plot)) {
    cat("Plotting one gene set instead of multiple cluster-specific gene sets\n")
    gene_indices <- sapply(genes_to_plot, function(x) get_gene_index(gbm, 
                                                                     x))
    gene_annotation <- NULL
  }
  else {
    if ("significant" %in% names(genes_to_plot[[1]])) {
      gene_indices <- unlist(lapply(genes_to_plot, function(x) with(x, 
                                                                    head(ix[significant], n_genes))))
      gene_grouping <- unlist(lapply(names(genes_to_plot), 
                                     function(nm) rep(nm, with(genes_to_plot[[nm]], 
                                                               length(head(ix[significant], n_genes))))))
    }
    else {
      gene_indices <- unlist(lapply(genes_to_plot, function(x) x$ix[1:n_genes]))
      gene_grouping <- rep(names(genes_to_plot), each = n_genes)
    }
    gene_annotation <- data.frame(ClusterID = as.factor(gene_grouping))
  }
  cell_indices <- unlist(lapply(cells_to_plot, function(x) x$ix))
  value <- t(scale(t(as.matrix(exprs(gbm))[gene_indices, cell_indices])))
  value[value < limits[1]] <- limits[1]
  value[value > limits[2]] <- limits[2]
  rownames(value) <- make.unique(fData(gbm)$symbol[gene_indices])
  cell_grouping <- unlist(lapply(1:length(cells_to_plot), function(x) {
    rep(names(cells_to_plot)[x], length(cells_to_plot[[x]]$barcode))
  }))
  cell_annotation <- data.frame(ClusterID = as.factor(cell_grouping))
  rownames(cell_annotation) <- colnames(value)
  if (!is.null(gene_annotation)) {
    rownames(gene_annotation) <- rownames(value)
  }
  if (is.null(colour)) {
    anno_colors <- NULL
  }
  else {
    names(colour) <- names(cells_to_plot)
    anno_colors <- list(ClusterID = colour)
  }
  pheatmap(value, cluster_rows = FALSE, cluster_cols = FALSE, 
           show_colnames = FALSE, annotation_row = gene_annotation, 
           annotation_col = cell_annotation, annotation_names_row = FALSE, 
           annotation_names_col = FALSE, annotation_colors = anno_colors)
}
<bytecode: 0x00000000507b7970>
  <environment: namespace:cellrangerRkit>  

我的问题是,当我绘制热图时,由于字体较大,绘图右侧的注释重叠(见下文)丑陋的热图

包装函数gbm_heatmap没有fontsize选项,使我无法在调用它时简单地传递参数。如何更改此包装器中的绘图行为?

感谢所有输入,谢谢!

4

0 回答 0