sort_samples | R Documentation |
Sort biological sample labels for experimental design
sort_samples(
x,
control_terms = c("WT|wildtype", "normal|healthy|healthycontrol|^hc$",
"control|ctrl|ctl", "(^|[-_ ])(NT|NTC)($|[-_ ]|[0-9])", "none|empty|blank",
"untreated|untrt|untreat", "Vehicle|veh", "ETOH|ethanol", "scramble|mock|sham",
"ttx|PBS", "knockout", "mutant"),
sortFunc = jamba::mixedSort,
pre_control_terms = NULL,
post_control_terms = NULL,
ignore.case = TRUE,
boundary = TRUE,
perl = boundary,
keep_factor_order = TRUE,
...
)
x |
character vector or factor |
control_terms |
vector of regular expression patterns used to determine control terms, where the patterns are matched and returned in order. |
pre_control_terms |
vector or NULL, optional control
terms or regular expressions to use before the |
post_control_terms |
vector or NULL, optional control
terms or regular expressions to use after the |
ignore.case |
logical passed to |
boundary |
logical indicating whether to require a word
boundary at either the start or end of the control terms.
When TRUE, it uses |
perl |
logical indicating whether to use Perl regular expression pattern matching. |
keep_factor_order |
logical indicating whether to maintain
factor level order, if |
... |
additional arguments are ignored. |
This function sorts a vector of sample labels using typical
heuristics that order typical control groups terms before
test groups. For example, "Vehicle"
would be returned
before "Treatment"
since "Vehicle"
is a recognized control
term.
It also employs jamba::mixedSort()
for
proper alphanumeric sorting, for example so "Time_5hr"
would
be sorted before "Time_12hr"
.
character vector ordered such that control terms are preferentially first before non-control terms.
Other jamses utilities:
choose_annotation_colnames()
,
contrast2comp_dev()
,
fold_to_log2fold()
,
intercalate()
,
list2im_opt()
,
log2fold_to_fold()
,
make_block_arrow_polygon()
,
mark_stat_hits()
,
matrix_normalize()
,
point_handedness()
,
point_slope_intercept()
,
shortest_unique_abbreviation()
,
shrinkDataFrame()
,
shrink_df()
,
shrink_matrix()
,
strsplitOrdered()
,
sub_split_vector()
,
update_function_params()
,
update_list_elements()
# the defaults perform well for clear descriptors
sort_samples(c("Trt_12h", "Trt_9h", "Trt_1h", "Trt_9h", "Vehicle"));
# custom terms can be added before the usual control terms
sort_samples(c("Trt_12h", "Trt_9h", "Trt_1h", "Trt_9h", "Fixated", "Vehicle"),
pre_control_terms="fixate");
# custom terms can be added after the usual control terms
sort_samples(c("Trt_12h", "Trt_9h", "Trt_1h", "Trt_9h", "Fixated", "Vehicle"),
post_control_terms="fixate");
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.