cole-trapnell-lab / monocle3

Other
330 stars 100 forks source link

`fit_models` and `model_formula_str` #671

Open shaman-yellow opened 1 year ago

shaman-yellow commented 1 year ago

Hello, I would like to know, how well monocle3::fit_models supports formula expressions. I've only seen examples of simple formulas in tutorials, like, "~time + batch". The R package limma supports formulas very well, for example, "~0+treatment+treatment:time" (time is a continuous variable), or, "~poly(time, degree = 2, raw = TRUE)", or even:

cycle <- 6
sinphase <- sin(2*pi* time / cycle)
cosphase <- cos(2*pi*time / cycle))
formula <- ~ sinphase + cosphase

Refer to https://doi.org/10.12688/f1000research.27893.1

brgew commented 1 year ago

Hi,

Do you need to use a formula that causes Monocle3 to fail? If you are curious, you can examine the code for fit_models() in the file monocle3/R/expr_models.R.

Best Wishes, Brent