Read data from an .fcs/.csv file or a directory of .fcs/.csv files.
Usage
tof_read_data(path = NULL, sep = "|", panel_info = dplyr::tibble())
Arguments
- path
A file path to a single file or to a directory of files. The only valid file types are .fcs files or .csv files containing high-dimensional cytometry data.
- sep
Optional. A string to use to separate the antigen name and its associated metal in the column names of the output tibble. Defaults to "|". Only used if the input file is an .fcs file.
- panel_info
Optional. A tibble or data.frame containing information about the panel used during high-dimensional cytometry data acquisition. Two columns are required: "metals" and "antigens". Only used if the input file is a .csv file.
Value
An [c by m+1] tibble in which each row represents a single cell (of c total in the dataset) and each column represents a high-dimensional cytometry measurement (of m total in the dataset). If more than one .fcs is read at once, the last column of the tibble (`file_name`) will represent the file name of the .fcs file from which each cell was read.
See also
Other input/output functions:
tof_write_csv()
,
tof_write_data()
,
tof_write_fcs()
Examples
input_file <- dir(tidytof_example_data("aml"), full.names = TRUE)[[1]]
tof_read_data(input_file)
#> # A tibble: 100 × 59
#> Time Event_length `CD45|Y89` `empty|Pd102` `empty|Pd104` `empty|Pd105`
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 11021370 16 517. 1.33 13.2 865.
#> 2 7112446. 19 850. 3.99 12.7 756.
#> 3 9722098 16 747. 6.96 4.85 639.
#> 4 2267279. 16 585. 0.648 6.32 586.
#> 5 9624729 18 773. 3.93 9.65 645.
#> 6 4439897 19 485. 4.18 3.84 627.
#> 7 2762526. 16 504. 3.46 4.25 566.
#> 8 3746682. 18 567. 6.62 11.7 703.
#> 9 15214280 19 1043. 3.10 9.20 853.
#> 10 42699. 16 543. 0.888 13.6 813.
#> # ℹ 90 more rows
#> # ℹ 53 more variables: `empty|Pd106` <dbl>, `empty|Pd108` <dbl>,
#> # `empty|Pd110` <dbl>, `CD61|In113` <dbl>, `CD99|In115` <dbl>,
#> # `empty|I127` <dbl>, `CD45RA|La139` <dbl>, `CD93|Ce140` <dbl>,
#> # `CD3_CD19|Pr141` <dbl>, `CCR2|Nd142` <dbl>, `CD117|Nd143` <dbl>,
#> # `CD123|Nd144` <dbl>, `CD64|Nd145` <dbl>, `CD90|Nd146` <dbl>,
#> # `CD38|Sm147` <dbl>, `CD34|Nd148` <dbl>, `CEBPa|Sm149` <dbl>, …