View source: R/gen-functions.R
repairSID | R Documentation |
Replace a faulty sample ID with a new one and write the single fcs file back to disc.
repairSID( fs = NULL, name = NULL, newSID = NULL, patt = NULL, fn = ".", confirm = TRUE, fcsRepair = FALSE )
fs |
The object returned by this function if parameter |
name |
Character length one. The name of the fcs file within the flowSet that should get a new sample ID. |
newSID |
Character length one. The new Sample ID. |
patt |
A regular expression defining a possible subset of FCS files
residing in the directory specified by |
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. |
confirm |
Logical. If the user should be asked for additional confirmation before the rewriting of the fcs file 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: |
To first obtain the flowSet, leave the parameter 'fs'at its default NULL. By providing a pattern to 'patt', subgroups of fcs files can be read in. Provide the so obtained flowSet to the parameter 'fs', and specify the name and the new sample ID in order to re-write the specified file with its new Sample ID. 'object@phenoData@data' can be used to inspect and verify names of FCS files and the sample IDs therein – see examples.
(Invisible) NULL. Is called for its side effects: the specified single fcs file gets written to disc with its new sample ID.
A correct sample ID is of importance when using the 'dictionary' to expand the abbreviations in the sample ID - see https://bpollner.github.io/flowdex/articles/acquire_data.html.
Other Accessory functions:
applyBandpass()
,
checkRepairFcsFiles()
,
cutFdmatToGate()
,
exportFdmatData()
,
fd_load()
,
fd_save()
,
genfs()
,
repairVolumes()
Other Repair functions:
checkRepairFcsFiles()
,
repairVolumes()
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. # fon <- "fcsF_E_vol_sid" repairVolumes(vol=1234567, fn=fon, confirm = FALSE) # because these files are also used # to demonstrate function 'repairVolumes'. We need to repair the volumes there first flowset <- repairSID(fn = fon) flowset@phenoData@data # very bad sample ID in the fourth sample # view the correct sample IDs of the other samples # copy one of those correct sample IDs # paste and modify it - it should be beaker #3: nsid <- "tr: GPos; Td: 5; wt: nativ; ap: no; th: th1; ha: ha1; bk: b3" # also copy and paste the sample name sana <- "N_na_GPos_T5_th1_b3.fcs" # the name of the sample having the faulty sample ID # now put all together and write fcs file with correct sample ID back to disk repairSID(fs=flowset, fn = fon, name = sana, newSID = nsid, confirm = FALSE) # # and check again: flowset <- repairSID(fn = fon) flowset@phenoData@data # all is good # setwd(old_wd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.