An adapter for learning a source-platform representation and applying it to target-platform data before model transfer.
Methods
Method new()
Create a cross-platform adapter with the selected normalization strategy and backend options.
Usage
CrossPlatformAdapter$new(
strategy = c("rank", "quantile", "zscore", "reference", "combat_pooled"),
reference_features = NULL,
reference_summary = c("mean", "median"),
source_platform = "source",
target_platform = "target",
combat_parametric = TRUE,
combat_mean_only = FALSE
)Arguments
strategyAdaptation strategy. One of `"rank"`, `"quantile"`, `"zscore"`, `"reference"`, or `"combat_pooled"`.
reference_featuresOptional character vector of reference miRNAs used when `strategy = "reference"`.
reference_summarySummary statistic for reference normalization: `"mean"` or `"median"`.
source_platformLabel used for source samples in pooled ComBat.
target_platformLabel used for target samples in pooled ComBat.
combat_parametricLogical, use parametric priors in pooled ComBat.
combat_mean_onlyLogical, only correct means in pooled ComBat.
Method fit()
Learn a source-platform reference representation.
Method adapt()
Adapt target-platform data to the learned source representation.
Method get_source_data()
Return the stored source matrix.
Examples
set.seed(42)
src <- matrix(rnorm(100 * 5), 100, 5)
tgt <- matrix(rnorm(50 * 5, mean = 2), 50, 5)
adapter <- CrossPlatformAdapter$new(strategy = "rank")
adapter$fit(src)
adapted_tgt <- adapter$adapt(tgt)
head(adapted_tgt)
#> feature_1 feature_2 feature_3 feature_4 feature_5
#> [1,] 1.00 0.00 0.25 0.75 0.50
#> [2,] 1.00 0.25 0.75 0.00 0.50
#> [3,] 0.75 0.50 1.00 0.00 0.25
#> [4,] 0.25 1.00 0.75 0.50 0.00
#> [5,] 0.25 0.75 0.50 1.00 0.00
#> [6,] 0.50 0.75 1.00 0.00 0.25