This is a mix of bioinformatics and ML problem. Hope someone with both expertise can help. Please forgive me if it's unclear or I used the wrong words as I am very new to ML.

I am trying to pick out some important features (genes) in a RNA-Seq data set of 37 samples to predict the outcome of the disease. The outcome is binary. And before I ran anything, I used removeBatchEffect() from limma on a normalised matrix from vst(), because there are two batches in it. The outcome variable is balanced in the two batches. LASSO failed with coefficients all being 0. Hence I am planning to try random forest (RFE or Boruta) and treeSHAP to interpret the result. I have a few questions before I move on and hope you can provide some insight:

  1. If I want to build a model based on gene expression using random forest, and apply it to other cohort as well, should I perform batch effect correction?

  2. In case I have built a random forest model, can I get interpretation from random forest nodes like those in decision trees? e.g. you can reach the outcome 1 via a clear path of high feature A value followed by high feature B value, or low feature A value followed by high feature C value. Then you know the interaction of A, B and C is important. With my limited knowledge, I think tree-based ML can lead to one class through more than one path? Please correct me if I am wrong.

Edited: I thought about the experiment again and read the comments. I have deleted and modified some questions to make it more specific.

  • 1
    $\begingroup$ Do you know that there is a Bioinformatics SE site? And there is biostars.org. $\endgroup$
    – dipetkov
    Aug 26, 2022 at 17:30
  • $\begingroup$ @dipetkov thanks for the reminder. I am aware of them. I am just not sure where to post because this is a mix of two problems (question about random forest and then the bioinformatics part for data preprocessing) $\endgroup$
    – Kento
    Aug 26, 2022 at 17:41
  • $\begingroup$ Is there some reason why you didn't continue with limma and use outcome as a categorical covariate in a linear model? Then topTable() will give you the individual genes most differentially expressed between the two outcomes. $\endgroup$
    – EdM
    Aug 26, 2022 at 18:14
  • $\begingroup$ I can do a DGE but I am just worry I might miss something. For example if there are two groups in poor outcome samples with two separate pathways activated (e.g. the activation of either pathway A or B could lead to poor outcome), will I be missing one or even both pathways if I just do a DGE? If I use a decision tree or random forest, will it be able to give me something like, poor outcome can be a result of high gene A expression followed by high gene B, or high gene C followed by high gene D, but not necessarily both? $\endgroup$
    – Kento
    Aug 26, 2022 at 20:12
  • 1
    $\begingroup$ Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. $\endgroup$
    – Community Bot
    Aug 27, 2022 at 3:07

1 Answer 1


If you don't correct for batch effects in gene expression values, your modeling will be inefficient and results might be unreliable. Even with the "outcome variable ... balanced in the two batches," failure to adjust for batch effects will lead to increased variance in the results that will diminish your power to detect true differences related to outcome. That's the case whether you are doing standard differential gene expression or any other type of analysis like LASSO or random forest. That answers question 1.

For question 2, a random forest doesn't lend itself to the easy interpretation of decision trees. See Section 8.2.2 of ISLR, second edition, which includes an example of a random-forest classification scheme based on gene-expression data. In particular, note that (page 344):

in building a random forest, at each split in the tree, the algorithm is not even allowed to consider a majority of the available predictors.

Random forest might improve your classification scheme, but it won't provide a clear path along the features like a decision tree. Thus I don't think that it would allay your fear (expressed in a comment) about two separate pathways being activated to lead to poor outcomes, either.

With a binary outcome, I suspect that standard differential gene expression analysis comparing the two outcomes will be more powerful and interpretable way to start. Then evaluate the pathways containing the most differentially expressed genes.

  • $\begingroup$ Thanks @Edm! The first question actually stems from the concern for generalisability (which is not my biggest concern but would be nice if the model can be generalised and applied to a separate cohort outside of the training set). Are there known ways that address technical variation between batches of data when training a model, allowing the application of the model on, let's say, a single or couple of samples outside of the training batches? Or is it something impossible to do at the moment/ever with the knowledge we have now? $\endgroup$
    – Kento
    Aug 27, 2022 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.