I'm a basic R user and I have to design a matrix to get DEGs from a library that has approximately 33000 genes. This library has 3 different factors: genotype (2 levels), treatment (2 levels) and tissue (2 levels, which are roots and stems).
I'm interested in obtaining the differentially expressed genes between, let's say "treatment vs control", for each tissue.
I've been using the model.matrix function like this:
# To evaluate each factor separately: design.matrix.roots <- model.matrix(~ genotype+treatment, data = mydf_roots$metadata) design.matrix.stems <- model.matrix(~ genotype+treatment, data = mydf_stems$metadata) # To evaluate the interaction between factors: design.matrix.roots <- model.matrix(~ genotype*treatment, data = mydf_roots$metadata) design.matrix.stems <- model.matrix(~ genotype*treatment, data = mydf_stems$metadata)
The problem is that, to be honest, I am not entirely sure if what I'm doing is correct or wrong, as I sometimes get NULL when trying to get DEGs between roots and treatment, for example. Also, the number of DEGs I get from the interaction is very very low; no more than 5.
Is there another way I can do this? Or am I doing the coding wrong?
P.S. Sorry for my writing, my main language is actually spanish :)