View source: R/aggregate_mapped_genes.R
aggregate_mapped_genes | R Documentation |
Aggregate/expand a gene matrix (gene_df
) using a gene mapping
data.frame (gene_map
).
Importantly, mappings can be performed across a variety of scenarios that
can occur during within-species and between-species gene mapping:
1 gene : 1 gene
many genes : 1 gene
1 gene : many genes
many genes : many genes
For more details on how aggregation/expansion is performed, please see: many2many_rows.
aggregate_mapped_genes(
gene_df,
gene_map = NULL,
input_col = "input_gene",
output_col = "ortholog_gene",
input_species = "human",
output_species = input_species,
method = c("gprofiler", "homologene", "babelgene"),
agg_fun = "sum",
agg_method = c("monocle3", "stats"),
aggregate_orthologs = TRUE,
transpose = FALSE,
mthreshold = 1,
target = "ENSG",
numeric_ns = "",
as_integers = FALSE,
as_sparse = TRUE,
as_DelayedArray = FALSE,
dropNA = TRUE,
sort_rows = FALSE,
verbose = TRUE
)
gene_df |
Input matrix where row names are genes. |
gene_map |
A data.frame that maps the current gene names to new gene names. This function's behaviour will adapt to different situations as follows:
|
input_col |
Column name within |
output_col |
Column name within |
input_species |
Name of the input species (e.g., "mouse","fly"). Use map_species to return a full list of available species. |
output_species |
Name of the output species (e.g. "human","chicken"). Use map_species to return a full list of available species. |
method |
R package to use for gene mapping:
|
agg_fun |
Aggregation function. |
agg_method |
Aggregation method. |
aggregate_orthologs |
[Optional] After performing an initial round of
many:many aggregation/expansion with many2many_rows,
ensure each orthologous gene only appears in one row by using the
aggregate_rows function (default: |
transpose |
Transpose |
mthreshold |
maximum number of results per initial alias to show. Shows all by default. |
target |
target namespace. |
numeric_ns |
namespace to use for fully numeric IDs (list of available namespaces). |
as_integers |
Force all values in the matrix to become integers,
by applying floor (default: |
as_sparse |
Convert aggregated matrix to sparse matrix. |
as_DelayedArray |
Convert aggregated matrix to DelayedArray. |
dropNA |
Drop genes assigned to |
sort_rows |
Sort |
verbose |
Print messages. |
Aggregated matrix
#### Aggregate within species: gene synonyms ####
data("exp_mouse_enst")
X_agg <- aggregate_mapped_genes(gene_df = exp_mouse_enst,
input_species = "mouse")
#### Aggregate across species: gene orthologs ####
data("exp_mouse")
X_agg2 <- aggregate_mapped_genes(gene_df = exp_mouse,
input_species = "mouse",
output_species = "human",
method="homologene")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.