View source: R/15_auto_geo_group.R
| auto_geo_group | R Documentation |
Infer sample groups from GEO phenotype metadata.
auto_geo_group(
x,
group_col = "title",
choice = NULL,
min_group_size = 2L,
max_groups = 20L,
min_coverage = 0.8,
search_other_cols = TRUE,
stopwords = .tinyarray_geo_stopwords(),
levels = NULL,
ref = NULL,
verbose = TRUE
)
x |
A GEO result list with a 'pd' data frame, or a phenotype data frame. |
group_col |
Column name to try first. The default is 'title'. |
choice |
Candidate index to select. Use '0' to cancel. If 'NULL', the function returns the candidate table without selecting. |
min_group_size |
Minimum number of samples required for a split label. |
max_groups |
Maximum number of group labels allowed in one column. |
min_coverage |
Minimum fraction of samples that must be assigned a label. |
search_other_cols |
Whether to search other columns when 'group_col' and 'title' fail. |
stopwords |
Character vector of generic words to ignore during tokenization. |
levels |
Optional character vector giving the desired factor level order. |
ref |
Optional reference level to place first. |
verbose |
Whether to print messages and candidate tables. |
The function first tries the user-specified 'group_col', then 'title'. If no stable grouping is found, it scans the remaining columns and returns a table of candidate groupings for manual selection. Both binary and multigroup factors are supported. Rare groups are left as 'NA' rather than being relabeled as another group.
Labels that differ only in capitalization are merged, retaining their most common spelling. Shared affixes and trailing sample identifiers are removed when they can be identified consistently.
A list with 'group_list', 'source_col', 'selected_index', 'candidate_table', 'candidates', and 'pdata'.
pd <- data.frame(
title = c("Control sample", "Control sample", "Treat sample", "Treat sample"),
stringsAsFactors = FALSE
)
rownames(pd) <- paste0("s", 1:4)
res <- auto_geo_group(
pd,
choice = 1,
levels = c("Control", "Treat"),
ref = "Control",
verbose = FALSE
)
res$source_col
levels(res$group_list)
table(res$group_list)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.