I'm trying to use the mclust method on an .FCS format file (which is a flow cytometry format file) and I read this file into R as flowFrame object.
install.packages("openCyto") # since the old version sefaulted my R session
library( openCyto )
library( flowCore)
library( mclust)
trial1=read.FCS("export_Alcina TregMAIT_AV 10-1974 P1_CD4.fcs")
a=as.matrix(trial1)
Editors note: some of these are Bioconductor packages and you should install according to the help pages for that environment.
However, mclust
does not accept the .fcs file as a matrix & I tried to convert it to a matrix with the function as.matrix, and I get this error:
Error in as.vector(data) :
no method for coercing this S4 class to a vector
I've found similar questions where they explain you have to add importMethodsFrom(S4Vectors,as.matrix)
into the NAMESPACE of mclust
, which I did. I also did importMethodsFrom(BiocGenerics,as.vector)
in the NAMESPACE of mclust. However, I'm still not able to use mclust
.
P.S. any advice or reading would be appreciated!
If, anyone knows other clustering methods that use GMM model that could accept .FCS format without converting, I'd be very happy.