Read in all or a subset of FCS files, replace missing volume values in the description of the single flowFrames with a provided default value and write the FCS-files back to disc. Original fcs get overwritten.
Usage
repairVolumes(
patt = NULL,
vol = NULL,
fn = ".",
includeAll = FALSE,
confirm = TRUE,
fcsRepair = FALSE,
verbose = TRUE
)
Arguments
- patt
A regular expression defining a possible subset of FCS files residing in the directory specified by
fn
to read in. Only matching patterns will be included.- vol
Numeric length one. The value that should be written into the
$VOL
slot in the description of the single flowFrame.- fn
Character length one. The name of the folder where FCS files should be read from. If left at the default '.', the folder name as defined in the settings file (key: 'foN_fcsFiles') will be used.
- includeAll
Logical. If left at the default
FALSE
, only those FCS files with *missing* volume information are read in and the value provided invol
will be assigned to them. If changed toTRUE
, also FCS files with *present* volume information will be read in and the value provided invol
will be assigned to them.- confirm
Logical. If the user should be asked for additional confirmation before the rewriting of the fcs files is performed. Defaults to TRUE.
- fcsRepair
Logical. If set to TRUE, fcs-files in the folder specified at argument 'fn' will be checked for multiplied entries in the keywords, as after some testing the author came to the humble conclusion that these multiplied keywords can be the reason for the error message:
"The HEADER and the TEXT segment define different starting point ... to read the data"
.
If 'fcsRepair' is set to TRUE, all except the last of each multiplied keyword will be removed and the fcs file will be saved to disc, overwriting the original fcs file without further warning.
Use the functioncheckRepairFcsFiles
which does offer more options to manually check and repair afflicted fcs files. There, it is possible to display multiplied keywords and to select which one to keep.- verbose
Logical. If status messages should be displayed. If left at the default '.', the value as defined in the settings file (key 'dV_verbose') will be used.
Value
(Invisible) NULL. Is used for its side effects, i.e. to repair fcs files with missing volume data and write them to disc, thereby overwriting the original fcs files.
Details
This function is intended to be used when, for known or unknown reasons, there is no volume information encoded in the original fcs file.
See also
Other Accessory functions:
applyBandpass()
,
checkRepairFcsFiles()
,
cutFdmatToGate()
,
exportFdmatData()
,
fd_load()
,
fd_save()
,
genfs()
,
repairSID()
Other Repair functions:
checkRepairFcsFiles()
,
repairSID()
Examples
td <- tempdir()
data_source <- "https://github.com/bpollner/data/raw/main/flowdex_examples/flowdex_examples.zip"
check_download_data(td, data_source)
exp_home <- paste0(td, "/flowdex_examples")
old_wd <- getwd()
setwd(exp_home)
#
assign("get_settings_from_flowdex_package_root", TRUE, pos=.GlobalEnv)
# only required to make the examples run automatically
# you should not call 'assign' if you run the examples manually
# the effect of setting 'get_settings_from_flowdex_package_root' to TRUE
# is that the file 'flowdex_settings.R' in 'root' of the installed package
# 'flowdex' will be sourced instead of the one in the user-defined location.
#
check_download_data(td, data_source, TRUE) # force download here
#> Download ok
#
fon <- "fcsF_E_vol_sid"
repairVolumes(vol=1234567, fn=fon, confirm = FALSE)
#> Reading in all fcs files in the folder `fcsF_E_vol_sid`... ok.
#> Re-writing volume data of 2 FCS files, using `1234567` to replace missing values.
#> .. ok.
#
setwd(old_wd)