A generic function that merges the protein data with the sample identifiers or sample names. If the file does not have sample identifiers the function generates it automatically.

merge_sampleID(iden, data_files, genepix_vars, method)

Arguments

iden

A character indicating the name of the object to be used under data_files.

data_files

A list of data objects with names utilised by iden.

genepix_vars

A list of specific definitions of the experiment design. See array_vars.

method

A description of the background correction to be used. See bg_correct.

Value

a data frame merged with corresponding sample ID's. The sample ID are specified in the sample ID files

Examples

## Not run:
### Define the genepix_vars
genepix_vars <- array_vars(
  channel = "635",
  chip_path = system.file("extdata", "array_data/machine1/",
   package="protGear"),
  totsamples = 21,
  blockspersample = 2,
  mig_prefix = "_first",
  machine = 1,
  ## optional
  date_process = "0520"
)

## the path where the micro-array data is located
data_path <- paste0(genepix_vars$chip_path)
filenames <- list.files(genepix_vars$chip_path,
                        pattern = "*.txt$|*.gpr$", full.names = FALSE
)
## create a list of all the files
data_files <- purrr::map(
 .x = filenames,
  .f = read_array_files,
  data_path = data_path,
  genepix_vars = genepix_vars
)
data_files <- purrr::set_names(data_files, 
purrr::map(filenames, name_of_files))
## merge the lab data with samples and perform bg correction
merge_sampleID(iden = "KK2-06", data_files = data_files,
               genepix_vars =genepix_vars,method = "subtract_global" )
#> Warning: KK2-06.csv Not found in the sampleID filesdata/array_sampleID/
#> # A tibble: 8,064 × 11
#> # Groups:   sampleID, antigen [2,457]
#>    sampleID sample_…¹ antigen FMedian BGMed…² FMedi…³ Block Column   Row repli…⁴
#>    <chr>        <int> <chr>     <int>   <int>   <dbl> <int>  <int> <int>   <int>
#>  1 SID_gen1         1 Landma…   65535    2443   64413     1      1     1       1
#>  2 SID_gen1         1 MSP3.6     5488    1126    4366     1      2     1       1
#>  3 SID_gen1         1 ETRAMP…    6350    1026    5228     1      3     1       1
#>  4 SID_gen1         1 GAMA      15768    1059   14646     1      4     1       1
#>  5 SID_gen1         1 MSRP4     65535    1413   64413     1      5     1       1
#>  6 SID_gen1         1 MSP4      65535    1405   64413     1      6     1       1
#>  7 SID_gen1         1 RAMA      43966    1085   42844     1      7     1       1
#>  8 SID_gen1         1 ASP       65535    1092   64413     1      8     1       1
#>  9 SID_gen1         1 Landma…   65535    4198   64413     1      1     2       2
#> 10 SID_gen1         1 MSP3.6     6596    1343    5474     1      2     2       2
#> # … with 8,054 more rows, 1 more variable: iden <chr>, and abbreviated variable
#> #   names ¹​sample_array_ID, ²​BGMedian, ³​FMedianBG_correct, ⁴​replicate
## End(Not run)