I changed the path "Users/dianahamilton/Desktop/ ... " to just "~/Desktop" and now I get a TRUE reading with isFCSfile(). Adding in truncate_max_range = FALSE to the arguments in both the read.FCS() and read.flowSet() appears to have fixed the issue.
It appears it was both a permissions problem, as Monterey hadn't given permissions for R to use the desktop, and a missing argument in the functions I was using.
The post read originally:
I am a complete newbie to R. Part of my problem is trying to understand the "language" as well as the "syntax." I am doing something and not understanding what I'm doing. Forgive my ignorance: please help.
The problem is this: I have multiple files from a Cytek Aurora in FCS3.1 format (spectral flow cytometry). It has been unmixed and compensated using Cytek's SpectroFlow. I believe that the format has to be good: (a) I can open the file in FlowJo with no issue; (b) I opened the file using a text editor and checked to see what the first three bytes in the file reported (FCS, as expected). When I run the function isFCSfile(filename), with 'filename' the path and filename of the file, it returns FALSE. When I use read.flowSet to read them into R, it returns an error saying "no matching files found in" my path/filename. So how do I get it work?
Here is my code:
`library(flowCore)
#read FCS file
isFCSfile("Users/dianahamilton/Desktop/data_test/Donor 2.fcs")
fs <- read.FCS("Users/dianahamilton/Desktop/data_test/Donor 2.fcs")
#or
sam <- read.flowSet(path="Users/dianahamilton/Desktop/data_test",
pattern='*.fcs', transformation=FALSE, package = "flowCore");`
when I comment out the "sam" line using read.flowSet, I get
> library(flowCore)
> #read FCS file
> isFCSfile("Users/dianahamilton/Desktop/data_test/Donor 2.fcs")
Users/dianahamilton/Desktop/data_test/Donor 2.fcs
FALSE
> fs <- read.FCS("Users/dianahamilton/Desktop/data_test/Donor 2.fcs")
Error in read.FCS("Users/dianahamilton/Desktop/data_test/Donor 2.fcs") :
'Users/dianahamilton/Desktop/data_test/Donor 2.fcs' is not a valid file
When I use "sam" with read.flowSet, I get this:
> sam <- read.flowSet(path="Users/dianahamilton/Desktop/data_test",
+ pattern='*.fcs', transformation=FALSE, package = "flowCore");
Error in parse_pd_for_read_fs(files, path, pattern, phenoData, sep, as.is, :
No matching files found in Users/dianahamilton/Desktop/data_test
data_test contains a total of 8 fcs files, and Donor 2.fcs is a part of them.
When I read the above, it appears that the path is correct, as it can see the file. But I understand that in some manner, the FCS file Donor 2.fcs is not being seen as a valid FCS file, as isFCSfile is telling me that it isn't. read.FCS reinforces that. read.flowSet is again telling me that same thing, except that it's in the function parse_pd_for_read_fs() where it fails. But, as I stated above, I believe that it is valid. If Donor 2.fcs is valid, then the rest of them should also be valid.
Where am I going wrong? How do I get my current fcs files to be recognized by R as such?
Thanks,
Diana
background:
-running macOS Monterey on a Mac Studio (M1 Max chip), 32 GB memory
-Originally I downloaded and installed the R version for the M1 chip, before I understood that it may not be as stable as the other one so I downloaded and reinstalled the other one (there may be residual problems from that, as I did not uninstall and then reinstall). I am using RStudio as the frontend.
-flowCore, version 2.6.0
-all packages up to date
sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.3
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] tcltk stats graphics grDevices utils datasets methods base
other attached packages:
[1] BiocVersion_3.14.0 Biobase_2.54.0 BiocGenerics_0.40.0 flowCut_1.4.0
[5] flowAI_1.24.0 flowClean_1.32.0 BiocManager_1.30.16 cytoinstaller_0.1.0
[9] flowCore_2.6.0
loaded via a namespace (and not attached):
[1] ncdfFlow_2.40.0 bitops_1.0-7 matrixStats_0.61.0 RColorBrewer_1.1-2
[5] httr_1.4.2 Rgraphviz_2.38.0 Rwave_2.6-0 gh_1.3.0
[9] RFOC_3.4-6 tools_4.1.3 utf8_1.2.2 R6_2.5.1
[13] KernSmooth_2.23-20 flowWorkspace_4.6.0 rgeos_0.5-9 DBI_1.1.2
[17] colorspace_2.0-3 sp_1.4-6 tidyselect_1.1.2 gridExtra_2.3
[21] splancs_2.01-42 curl_4.3.2 bit_4.0.4 compiler_4.1.3
[25] RPMG_2.2-3 graph_1.72.0 cli_3.2.0 Cairo_1.5-15
[29] xml2_1.3.3 flowDensity_1.28.0 caTools_1.18.2 scales_1.1.1
[33] sfsmisc_1.1-12 hexbin_1.28.2 proxy_0.4-26 stringr_1.4.0
[37] digest_0.6.29 rmarkdown_2.13 base64enc_0.1-3 jpeg_0.1-9
[41] pkgconfig_2.0.3 htmltools_0.5.2 changepoint_2.2.3 fastmap_1.1.0
[45] maps_3.4.0 rlang_1.0.2 RSEIS_4.0-3 generics_0.1.2
[49] zoo_1.8-9 jsonlite_1.8.0 gtools_3.9.2 dplyr_1.0.8
[53] car_3.0-12 magrittr_2.0.2 dotCall64_1.0-1 RProtoBufLib_2.6.0
[57] Rcpp_1.0.8.3 munsell_0.5.0 S4Vectors_0.32.4 fansi_1.0.3
[61] abind_1.4-5 viridis_0.6.2 lifecycle_1.0.1 GEOmap_2.4-4
[65] stringi_1.7.6 carData_3.0-5 zlibbioc_1.40.0 MASS_7.3-56
[69] gplots_3.1.1 plyr_1.8.7 grid_4.1.3 crayon_1.5.1
[73] lattice_0.20-45 knitr_1.38 pillar_1.7.0 reshape2_1.4.4
[77] stats4_4.1.3 XML_3.99-0.9 glue_1.6.2 evaluate_0.15
[81] latticeExtra_0.6-29 data.table_1.14.2 MBA_0.0-9 remotes_2.4.2
[85] RcppParallel_5.1.5 png_0.1-7 vctrs_0.3.8 spam_2.8-0
[89] aws.s3_0.3.21 gtable_0.3.0 purrr_0.3.4 assertthat_0.2.1
[93] ggplot2_3.3.5 xfun_0.30 e1071_1.7-9 class_7.3-20
[97] IDPmisc_1.1.20 viridisLite_0.4.0 tibble_3.1.6 aws.signature_0.6.0
[101] cytolib_2.6.2 flowViz_1.58.0 fields_13.3 ellipsis_0.3.2