As I am just interested to see how weill it fits into a linear trend, I will need the the logFC which in this case I would like to treat it as a slope. Do you know how to do it? I think it should be easy too but I cannot figure it out yet( maybe not so easy then)
I tried to fit a linear model on a set of metabolomics data for an experiment: drug treatment for a group of animals to receive 7 different types of concentration. Each group of animals there are 10 replicates. I would like to plot the changes of a particular metabolites across different concentration of drug given. It is like a factorial design here.
Everything works well until it comes to the end when I wanted to get the logFC which represents the gradient of the overall changes.
grp=factor(target$Group, levels=c("0","0.1","10","30","50","80","100"))
design <- model.matrix(~grp)
fit <- lmFit(data, design)
topTable(fit, n = Inf, adjust="BH")
The output gave me a list of coefficients which corresponds to each level of the design , a column of AveExpr, F, P.value and adj.Pval. I wonder if anyone can kindly suggest me a way to get the logFC? either calculate manually or is there any changes on the code that I have missed out? I saw many posts mentioned that limma is treating each time point independently in a time series experiment. I am not interested in contrast and treating each group of treatment separately. I wonder if is there a way for me to calculate the logFC in this case.
The set up of the experiment is somehow similar to the post below, but in a simpler way Microarray Time series data analysis through limma ?
1 answer
limma has computed logFCs for you. It has computed logFC for dose 0.1 vs 0, for dose 10 vs 0, for 30 vs 0 and so on. That is how time course data is usually analysed. The logFC of dose 100 vs dose 0 is a sort of overall logFC because it measures the effect of the highest dose vs the lowest.
Your email sounds that like you instead wanted to fit a linear trend to the log expression values as a function of dose (or of log dose perhaps). That is easy to do in limma but it is not good practice to assume that log expression is a straight line function of dose (or of log dose perhaps). I advise against it.
It works exactly the same, you simply have to make sure that grp is a numeric vector instead of a factor:
grp <- as.numeric(as.character(grp))
design <- model.matrix(~grp)
etc
I can see the changes has made the multi-level design turned into just control vs condition , a simple linear model. Instead of comparing each group vs control, it compares between the samples vs control, Thank you very much!
Log in to answer this question.