Как изменить параметры построения функции внутри оболочки (R) - PullRequest
0 голосов
/ 23 мая 2018

Я пытаюсь сгенерировать тепловые карты, используя пакет 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>  

Моя проблема в том, что, когда я строю свою тепловую карту, аннотация на правой стороне графикаперекрывается из-за большого размера шрифта (см. ниже) ugly heatmap

Функция-обертка gbm_heatmap не имеет опции fontsize, что не позволяет мне просто передавать аргумент, когданазывая этоКак я могу изменить поведение при построении графиков в этой оболочке?

Оцените все входные данные, спасибо!

...