Using output from normalizeBatch() outside of cydar package
1
0
Entering edit mode
@kennethbaker-21172
Last seen 5.5 years ago

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.

cydar mass cytometry • 1.3k views
ADD COMMENT
0
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 6 hours ago
The city by the bay

I would imagine that you could take each matrix in the unlisted output of normalizeBatch() and use it to construct a flowFrame. The resulting list of flowFrames could then be converted into flowSet. This may or may not be coercible into a ncdfFlowSet - I can't remember - but it shouldn't matter as a flowSet should work just as well in any downstream application.

library(cydar)
example(normalizeBatch) # just to get some stuff.

library(flowCore)
blah <- unlist(corrected, recursive=FALSE)
blah <- lapply(blah, flowFrame)

fs <- do.call(flowSet, blah)

Hopefully the downstream pipeline don't use any of the special parameter fields in the flowFrames.

ADD COMMENT
0
Entering edit mode

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...

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

Okay - thanks again for the advice, much appreciated.

ADD REPLY

Login before adding your answer.

Traffic: 462 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6