I have tried to develop a machine learning model based on a set of differentially expressed genes obtained using DESeq2. Variance stabilising transformation (vst()) was performed for this purpose as it is recommended in the vignette. But I have applied it to the entire dataset together (as it was passed together as a dds object for running vst(). Note that this was the same dds object used for running DESeq2), prior to dividing into training and testing for model development. I feel like I have applied it in a wrong way because ideally I should apply vst() only on the training data and then transform the test data based on the transformation values obtained on the training data. Even if for simplicity, I apply it on the entire dataset in the beginning, I would still need to retain these values for transforming the unknown validation dataset which might only include one sample. Please let me know if there is a way to do so or if there is a better strategy in your opinion. Shall I make a dds object using the training data only, apply vst() and somehow store these values and then use these stored values to apply vst() on the dds object created using test data only? And how to find these stored transformation values?