# Create example data
set.seed(123)
n_cells <- 200
mPT <- runif(n_cells, 0, 1)
scores <- sin(mPT * 2 * pi) + rnorm(n_cells, 0, 0.1)
# Compute trend
trend <- scMetaTraj_trend(
scores = scores,
mPT = mPT,
n_bins = 30,
smooth = TRUE,
span = 0.3
)
# Plot trend
plot(trend$mPT_bin, trend$score_smooth, type = "l",
xlab = "Metabolic pseudotime", ylab = "Module score")
Run the code above in your browser using DataLab