extract bg — extract_bg • protGear
Description: A generic function to extract the background data for micro array data.

# extract bg

Source: `R/read_files_functions.R`
`extract_bg.Rd`

A generic function to extract the background data for micro array data.

    extract_bg(iden, data_files, genepix_vars = genepix_vars)

## 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`.

## Value

A data frame of background values

## Details

Extract the background values

## Examples

    ## Not run:
    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"
    )
    #Define the data path
    data_path <- paste0(genepix_vars$chip_path)
    # List the file names to use
    filenames <- list.files(genepix_vars$chip_path,
                           pattern = '*.txt$|*.gpr$', full.names = FALSE
    )
    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))
    names(data_files)
    #> [1] "BRB001" "KK2-06"
    extract_bg(iden ="KK2-06" , data_files=data_files,genepix_vars=genepix_vars)
    #> Warning: KK2-06 Not found in the sampleID files heredata/array_sampleID/
    #> # A tibble: 7,245 × 6
    #> # Groups:   sampleID, antigen [2,415]
    #>    sampleID antigen    Block FBG_Median BG_Median replicate
    #>    <chr>    <chr>      <int>      <int>     <int>     <int>
    #>  1 SID_gen1 MSP3.6         1       5488      1126         1
    #>  2 SID_gen1 ETRAMP10.2     1       6350      1026         1
    #>  3 SID_gen1 GAMA           1      15768      1059         1
    #>  4 SID_gen1 MSRP4          1      65535      1413         1
    #>  5 SID_gen1 MSP4           1      65535      1405         1
    #>  6 SID_gen1 RAMA           1      43966      1085         1
    #>  7 SID_gen1 ASP            1      65535      1092         1
    #>  8 SID_gen1 MSP3.6         1       6596      1343         2
    #>  9 SID_gen1 ETRAMP10.2     1       7123      1136         2
    #> 10 SID_gen1 GAMA           1      17420      1311         2
    #> # … with 7,235 more rows
    ## End(Not run)