Closed sudu87 closed 4 years ago
Here's what I'd try:
all(panel$fcs_colname %in% colnames(fs))
: If this returnsFALSE
, there's a mistake in your metadata; if it returnsTRUE
, see next point.antigen
columns causing unexpected behavior. You should either
fcs_column
(if there are no protein targets for these) orprepData
will also remove them from the SCE, and you won't carry 10+ empty channels through the analysis. (alternatively, you could specify prepData(sce, ..., features = panel$fcs_colnames[!is.na(panel$antigen)])
; which would be equivalent to ii.)
Thanks, so i tried the first step:
all(panel$fcs_colname %in% colnames(fcs_raw))
returned FALSE
Then there's your answer... you can use panel$fcs_colname[!panel$fcs_colname] %in% colnames(fcs_raw)
to see which channels in your metadata table do not appear in the flowSet
.
Nevertheless, I still recommend either removing channels that are not needed for the downstream analysis (because they are empty), or specifying which channels to keep via argument features
.
I used the code you wrote. But I get this error.
Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function '%in%': invalid argument type
Also if I try to use features
with let's say 1 channel only just for trying it out, there's an error.
sce <- prepData(fcs_raw, panel, md,features ="164Dy_Siglec-8")
Error in prepData(fcs_raw, panel, md, features = "164Dy_Siglec-8") : panel[[panel_cols$channel]] %in% colnames(fs) are not all TRUE
panel$fcs_colname[!panel$fcs_colname %in% colnames(fcs_raw)]
(there was a misplaced ]
).fcs_raw
has column names of the form Dy162Di Dy163Di Dy164Di ...
, but your md$fcs_colname
has 164Dy_Siglec-8
: this does not match with the channel names in the data. panel$fcs_colname[!panel$fcs_colname %in% colnames(fcs_raw)
should give you which fcs_colname
s need fixing.Once you have the SCE, everything downstream should be much simpler, promise!
Thanks for pointing out the mistake and the unmatched column names. Totally overlooked that one! In this regard I have follow up questions:
Dy164Di
instead of 164Dy_Siglec-8
and so on, in the panel
file and the SCE will be generated using whatever matches ?panel
and pass it to the features
argument? If so then in which format ? as "string" or just the names. i.e. features="Dy164Di"
or features=Dy164Di
. I tried to do this but i still get this error:Error in prepData(fcs_raw, panel, md) : panel[[panel_cols$channel]] %in% colnames(fs) are not all TRUE
md
table (.csv file). Then, they will be dropped from the SCE by prepData()
automatically.prepData()
will not "use whatever matches", but will throw an error if anything doesn't match.features
:panel
that don't match with fcs_raw
, as I said in point 2. Regardless of argument features
.So in summary, specifying a subset of channels via features = ...
or just keeping that subset in panel
& removing all else is equivalent. Either way, the panel$fcs_colname
s need to match with colnames(fcs_raw)
.
Thank you Helena, Point no. 1 worked. I removed the channels from the panel
dataframe.
fcs_colname |
antigen |
marker_class |
|
---|---|---|---|
Dy164Di | Siglec-8 | state | |
Er168Di | CD206 | state | |
Er170Di | CD169 | state | |
Eu151Di | CD11b | type | |
Gd156Di | HLA-DR | state | |
Gd160Di | CD14 | type |
Table properties:
'data.frame': 21 obs. of 3 variables:
$ fcs_colname : chr "Dy164Di" "Er168Di" "Er170Di" "Eu151Di" ...
$ antigen : chr "Siglec-8" "CD206" "CD169" "CD11b" ...
$ marker_class: chr "state" "state" "state" "type" ...
Then the function:
sce <- prepData(fcs_raw, panel, md)
and as you said it discarded the non-matching columns.
The object was successfully made, this is how it looks now. Do you think this is good to go ? There's a warning though. Not sure why but doesn't seem have anymore errors.
class: SingleCellExperiment
dim: 21 578655
metadata(1): experiment_info
assays(2): counts exprs
rownames(21): Siglec-8 CD206 ... CD81 CD88
rowData names(3): channel_name marker_name marker_class
colnames: NULL
colData names(3): sample_id condition patient_id
reducedDimNames(0):
altExpNames(0):
Warning messages:
Unknown or uninitialised column: `Antigen`.
Not sure about this warning either :/ Worth checking that rowData(sce)
looks good- but otherwise, yes, I think you're good to go!
Hello Helena,
Thank you for the suggestion to use the new version of the pipeline to use in CyTOF data analysis.
https://bioconductor.org/packages/release/bioc/vignettes/CATALYST/inst/doc/differential.html
Background:
Experiment specific info in:
https://github.com/markrobinsonuzh/cytofWorkflow/issues/17
I am not sure may be the way i got the data, not all channels in the FCS file is of my interest. I guess this is creating a problem in creating the SCE object.
Installing and loading packages
Reading FCS filename
Reading metadata file
Make sure condition variables are factors with the right levels
I read in the vignette of SCE that one can set marker_class to none. is it correct ?
Also, i read that by default, non-mass channels (e.g., time, event lengths) will be removed from the output SCE's assay data.
Do you think the error appears due the channels which doesn't have data ?
Thanks for your help,
Sudip