I have used the normalizeBatch() function of the cydar package to apply batch correction to a mass cytometry dataset, based on an identical technical replicate present within each batch.
The cydar package manual describes how to convert the output of normalizeBatch() to a CyData object (by using unlist() followed by the prepareCellData() function). However, I wish to keep the data in a flowSet (or ncdfFlowSet) structure for use in a downstream pipeline based on the CATALYST package.
Could anyone tell me please if there is a method to achieve this, i.e. is it possible to do any of the following? 1. apply the output from normalizeBatch() back to the ncdfFlowSet files used in the function to normalise them whilst maintaining their ncdfFlowSet structure 2. convert the output from normalizeBatch() back to an ncdfFlowSet structure
Apologies if I am asking the impossible here, any help would be appreciated.
Great - thanks for the help, makes perfect sense and I'll give that a go.
After doing a bit more reading of package manuals, the other thing which came to mind today was to use the exprs() function of flowCore to extract the expression matrices from the original uncorrected flowFrames - i.e. those used to create the ncdfFlowSet objects used as the input to normaliseBatch() - and then replace them with the matrices from the unlisted output of normaliseBatch(). So long as I made sure to match the correct matrix to the correct original flowFrame object, then that should allow creation of flowFrames with a corrected expression matrix together with all of the other special parameter fields...
Well, that's one way to do it. Just be aware that some of the fields (e.g., max/min intensities) computed from the original data won't make sense with the corrected data. If a downstream method is relying on them to be consistent, you could have some problems where you silently get nonsensical output.
Okay - thanks again for the advice, much appreciated.