Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: OmicsProcessing
Type: Package
Title: OmicsProcessing
Version: 1.1.1
Version: 1.1.2
Date: 2025-03-03
Authors@R: c(
person("Vivian", "Viallon", role = c("aut")),
Expand Down
6 changes: 4 additions & 2 deletions R/normalization_SERRF.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
#' single-level strata is created so all samples are treated as one batch. When
#' provided, the column must exist in `df` with no NA values.
#' @param num_screen_SERRF Number of correlated features to use in model fitting. Default is 10.
#' @param seed Set a random number generator seed, default 0.
#'
#' @return A normalized data frame.
#' @export
normalise_SERRF <- function(df, target_cols = NULL, is_qc = NULL, strata_col = NULL, num_screen_SERRF = 10) {
normalise_SERRF <- function(df, target_cols = NULL, is_qc = NULL, strata_col = NULL, num_screen_SERRF = 10, seed = 0) {
set.seed(seed)
# ---- Validation ----
temp_strata_cols <- character(0)

Expand Down Expand Up @@ -75,7 +77,7 @@ normalise_SERRF <- function(df, target_cols = NULL, is_qc = NULL, strata_col = N

# ---- Normalize Each Feature ----
for (j in seq_along(target_cols)) {
if (j %% 250 == 1) cat("Feature", j, "\n")
if (j %% 250 == 1) cat(j, "out of ", target_cols, " features normalised\n")
feature_name <- target_cols[j]

for (batch in batch_levels) {
Expand Down
5 changes: 4 additions & 1 deletion man/normalise_SERRF.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion vignettes/feature-clustering.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,17 @@ res_scores <- OmicsProcessing::cluster_features_by_retention_time(
target_cols = target_cols,
rt_height = 0.07,
method = "scores",
corr_thresh = 0.75,
scores = scores
)

clustered_df <- res_scores$clustered_df # original features + representatives
rep_map <- res_scores$representatives_map # mapping of representatives to raw features
```

The `rt_height` parameter defines the maximum RT span for forming a cluster: features whose RTs differ by less than this value are grouped. Within each cluster, the supplied `scores` determine the representative. In this example, pre-normalisation mean intensities serve as scores; consequently, each representative is the feature with the highest mean intensity before normalisation. The `representatives_map` lists representatives as names, with vectors of raw feature names as their values.
The `rt_height` parameter defines the maximum RT span for forming a cluster: features whose RTs differ by less than this value are grouped. Within each RT‑based group, pairwise correlations between features are calculated, and the features are further partitioned into correlation‑based subclusters. The supplied `scores` determine the representative feature for each subcluster. In this example, pre-normalisation mean intensities serve as scores; consequently, each representative is the feature with the highest mean intensity before normalisation.

The `representatives_map` lists representatives as names, with vectors of raw feature names as their values. In effect, features with similar retention times are identified, and among those with high correlation, the feature with the highest pre‑normalisation mean intensity is selected as the representative.

### How representatives are selected with the correlation method

Expand Down