Description Usage Arguments Details Value Examples
View source: R/functions_signal_operations.R
centerAtMax
locates the coordinate x of the maximum in y and shifts x
such that it is zero at max y.
1 2 3 4 5 6 7 8 9 10 11 |
dt |
data.table |
x_ |
the variable name of the x-values. default is 'x' |
y_ |
the variable name of the y-values default is 'y' |
by_ |
optionally, any variables that provide grouping to the data. default is none. see details. |
view_size |
the size in |
trim_to_valid |
valid |
check_by_dupes |
default assumption is that there should be on set of x_ for a by_ instance. if this is not the case and you want to disable warnings about set this to FALSE. |
x_precision |
numerical precision of x, default is 3. |
replace_x |
logical, default TRUE. if TRUE x_ will be replaced with position relative to summit. if FALSE x_ will be preserved and x_summitPosition added. |
character. by_ controls at the level of the data centering is applied. If by_ is "" or NULL, a single max position will be determined for the entire dataset. If by is "id" (the default) then each region will be centered individually across all samples.
data.table with x (or xnew if replace_x is FALSE) shifted such that x = 0 matches the maximum y-value define by by_ grouping
1 2 3 4 5 6 7 8 9 10 | centerAtMax(CTCF_in_10a_profiles_gr, y_ = 'y', by_ = 'id',
check_by_dupes = FALSE)
#it's a bit clearer what's happening with trimming disabled
#but results are less useful for heatmaps etc.
centerAtMax(CTCF_in_10a_profiles_gr, y_ = 'y', by_ = 'id',
check_by_dupes = FALSE, trim_to_valid = FALSE)
#specify view_size to limit range of x values considered, prevents
#excessive data trimming.
centerAtMax(CTCF_in_10a_profiles_gr, y_ = 'y', view_size = 100, by_ = 'id',
check_by_dupes = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.