The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
CrossDomainAdjust is a small R package for cross-domain
feature correction. The current version implements lambda-controlled
projection correction; a centering-based method can be added later under
the same package.
lambda = 0: keep the original features.lambda = 1: fully remove the learned cross-domain
projection component.0 < lambda < 1: partial correction.The method works for two, three, four, or more domains. With K
domains, the domain-shift subspace has rank at most K - 1 for either
built-in anchor. An arbitrary custom anchor outside the affine hull of
the centroids can increase this to K, subject to the number of features.
It learns an orthogonal projection matrix P = B %*% t(B)
from training-domain centroid differences and corrects features by:
x_corrected = x - lambda * ((x - anchor) %*% P)The new sample’s domain label is checked for consistency, while the correction itself is projection-based and does not apply a domain-wise mean shift.
The projection anchor is user-controlled:
fit_domain_projector(x, domain, anchor = "domain_mean") # equal-weight domain center
fit_domain_projector(x, domain, anchor = "sample_mean") # sample-size-weighted center
fit_domain_projector(x, domain, anchor = custom_center_vector)library(CrossDomainAdjust)
set.seed(1)
x <- rbind(
matrix(rnorm(40), nrow = 10),
matrix(rnorm(40) + 1.2, nrow = 10),
matrix(rnorm(40) - 0.8, nrow = 10)
)
colnames(x) <- paste0("gene", 1:4)
domain <- rep(c("TCGA", "GEO_A", "GEO_B"), each = 10)
projector <- fit_domain_projector(x, domain, anchor = "domain_mean")
projector
new_sample <- c(gene1 = 2.1, gene2 = 0.4, gene3 = 1.3, gene4 = -0.2)
project_new_sample(projector, new_sample, domain = "GEO_A", lambda = 0)
project_new_sample(projector, new_sample, domain = "GEO_A", lambda = 0.5)
project_new_sample(projector, new_sample, domain = "GEO_A", lambda = 1)After installation, run:
example_dir <- system.file("examples", package = "CrossDomainAdjust")
source(file.path(example_dir, "01_pca_lambda_overlap.R"))
source(file.path(example_dir, "02_two_domain_new_sample_projection.R"))
source(file.path(example_dir, "03_three_domain_new_sample_projection.R"))The first example simulates two cohorts with a batch effect and draws PCA panels for multiple lambda values. The second example takes two cohort matrices, a lambda value, one new sample, and its source cohort, then outputs the corrected feature vector and a PCA plot showing cohort centers plus the sample before and after correction. The third example repeats the same idea for three domains, where the centers form a triangle and the projection can remove up to two independent domain directions.
Use your training expression matrix after feature construction, for example a 15-gene within-sample rank matrix:
projector <- fit_domain_projector(rank_matrix, domain = cohort_domain, anchor = "domain_mean")
corrected_training <- project_features(projector, rank_matrix, lambda = 0.55)
corrected_one_patient <- project_new_sample(
projector,
sample = named_15_gene_rank_vector,
domain = "GEO",
lambda = 0.55
)These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.