View source: R/data-access-io-prepare.R
| samples2ags | R Documentation |
Convert a gene-by-sample matrix, such as expression, copy-number, protein,
or methylation measurements, into one altered gene set (AGS) per sample.
"top" ranks absolute, unstandardized deviations from each gene's
across-sample mean; "toppos" ranks signed deviations in descending order,
selecting the upper side of the value distribution. Both remain fixed-size
methods and apply no significance or positivity cutoff. "topnorm" ranks
absolute within-gene z-scores. "bestp" ranks one-sided upper-tail
probabilities calculated from abs(z), whereas "significant" retains genes
below cutoff_q after Benjamini-Hochberg adjustment of the same probabilities.
This adjustment is applied to both directions of deviation and does not use
the enrichment-only q-value convention of nea.render(). "toprandom"
samples genes without replacement.
samples2ags(
x,
n_top = NULL,
sample_columns = NULL,
column_pattern = NULL,
method = c("significant", "top", "toppos", "topnorm", "bestp", "toprandom"),
cutoff_q = 0.05,
case_sensitive = FALSE,
species,
input_id_format = master_id_format(species),
id_mappings = NULL,
ambiguous = c("error", "drop", "first", "expand"),
unmapped = c("keep", "drop", "error"),
duplicate_ids = c("error", "mean", "sum", "max")
)
x |
Numeric gene-by-sample matrix with gene identifiers as row names. |
n_top |
Number of genes retained by top-ranking methods. Values around 30–300 are often useful; very large sets may reduce specificity. |
sample_columns |
Optional names or indices selecting sample columns. |
column_pattern |
Optional regular expression selecting sample columns. |
method |
Preparation method. |
cutoff_q |
Benjamini-Hochberg-adjusted probability cutoff for
|
case_sensitive |
Use case-sensitive identifier matching. The default treats all gene identifiers case-insensitively. |
species |
Required species identifier accepted by
|
input_id_format |
Submitted identifier format. Defaults to
|
id_mappings |
Optional object from |
ambiguous, unmapped |
Mapping policies passed to |
duplicate_ids |
Policy for rows that collapse to one identifier after mapping: error, mean, sum, or maximum. |
A named list containing one altered gene vector per sample, with
normalization metadata available through normalization_info().
mutations2ags(), import_gene_sets(), save_gs_list()
profiles <- matrix(c(
9, 1, 2, 8, 5, 5,
1, 9, 8, 2, 5, 5), nrow = 6,
dimnames = list(paste0("gene", 1:6), c("sample_1", "sample_2")))
top <- samples2ags(profiles, n_top = 2, method = "top",
species = NULL, input_id_format = "custom")
toppos <- samples2ags(profiles, n_top = 2, method = "toppos",
species = NULL, input_id_format = "custom")
top
toppos
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.