top_genes | R Documentation |
top_genes()
creates a HermesDataTopGenes
object, which extends data.frame
. It
contains two columns:
expression
: containing the statistic values calculated by summary_fun
across columns.
name
: the gene names.
The corresponding autoplot()
method then visualizes the result as a barplot.
top_genes(
object,
assay_name = "counts",
summary_fun = rowMeans,
n_top = if (is.null(min_threshold)) 10L else NULL,
min_threshold = NULL
)
## S4 method for signature 'HermesDataTopGenes'
autoplot(
object,
x_lab = "HGNC gene names",
y_lab = paste0(object@summary_fun_name, "(", object@assay_name, ")"),
title = "Top most expressed genes"
)
object |
( |
assay_name |
( |
summary_fun |
( |
n_top |
( |
min_threshold |
( |
x_lab |
( |
y_lab |
( |
title |
( |
The data frame is sorted in descending order of expression
and only the top
entries according to the selection criteria are included.
Note that exactly one of the arguments n_top
and min_threshold
must be
provided.
A HermesDataTopGenes object.
autoplot(HermesDataTopGenes)
: Creates a bar plot from a HermesDataTopGenes object,
where the y axis shows the expression statistics for each of the top genes
on the x-axis.
object <- hermes_data
# Default uses average of raw counts across samples to rank genes.
top_genes(object)
# Instead of showing top 10 genes, can also set a minimum threshold on average counts.
top_genes(object, n_top = NULL, min_threshold = 50000)
# We can also use the maximum of raw counts across samples, by specifying a different
# summary statistics function.
result <- top_genes(object, summary_fun = rowMax)
# Finally we can produce barplots based on the results.
autoplot(result, title = "My top genes")
autoplot(result, y_lab = "Counts", title = "My top genes")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.