tag_subtract — tag_subtract • protGear
Description: \\_End_Function_\\ #

# tag_subtract

Source: `R/cv_estimation_tag_functions.R`
`tag_subtract.Rd`

\\_End_Function_\\ #

    tag_subtract(
      dataC_mfi,
      tag_antigens,
      mean_best_CV_var,
      tag_file,
      batch_vars,
      sampleID_var = "sampleID",
      antigen_var = "antigen"
    )

## Arguments

dataC_mfi

  A dataframe

tag_antigens

  A character vector with the names of proteins or antigens used as TAG.

mean_best_CV_var

  A character string containing the identifier of the variable with the MFI values.

tag_file

  A data frame with variables `antigen, TAG, TAG_name` to show the TAG for the different antigens or proteins in dataC_mfi

batch_vars

  A list of characters identifying variables in dataC_mfi for indicating batch.

sampleID_var

  A character string containing the name of the sample identifier variable. Default set to 'sampleID'

antigen_var

  A character string containing the name of the features/protein variable. Default to 'antigen'

## Value

A data frame of TAG values subtracted

## Details

Subtract the purification TAG data

## Examples

    tag_file <- readr::read_csv(system.file("extdata", "TAG_antigens.csv",
    package="protGear"))
    #> Rows: 126 Columns: 3
    #> ── Column specification ────────────────────────────────────────────────────────
    #> Delimiter: ","
    #> chr (2): antigen, TAG_name
    #> dbl (1): TAG
    #>
    #> ℹ Use `spec()` to retrieve the full column specification for this data.
    #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
    tag_antigens <- c("CD4TAG", "GST", "MBP")
    batch_vars <- list(machine = "m1", day = "0520")
    dataC <- readr::read_csv(system.file("extdata", "dataC.csv",
     package="protGear"))
    #> Rows: 567 Columns: 11
    #> ── Column specification ────────────────────────────────────────────────────────
    #> Delimiter: ","
    #> chr (3): sampleID, antigen, iden
    #> dbl (8): sample_array_ID, FMedian, BGMedian, FMedianBG_correct, Block, Colum...
    #>
    #> ℹ Use `spec()` to retrieve the full column specification for this data.
    #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
    ## this file has 3 lab replicates and the default names
    dataCV <- cv_estimation(dataC  ,lab_replicates=3)
    #> Warning: The replicates are as expected per sample per antigen
    dataCV_best2 <- best_CV_estimation(dataCV,slide_id = "iden",
    lab_replicates = 3, cv_cut_off = 20)
    #> Adding missing grouping variables: `row`
    tag_subtract(dataCV_best2,tag_antigens=tag_antigens,
    mean_best_CV_var="mean_best_CV",
     tag_file = tag_file,antigen_var = "antigen", batch_vars = batch_vars)
    #> # A tibble: 126 × 35
    #>    sampleID sample_ar…¹   TAG antigen  meanX   sdX sdX2_X3 sdX1_X3 sdX1_X2   CVX
    #>    <chr>          <dbl> <dbl> <chr>    <dbl> <dbl>   <dbl>   <dbl>   <dbl> <dbl>
    #>  1 0.0085            11     0 AMA1      643.  98.5    70      69.3   139.  15.3
    #>  2 0.0255             8     0 AMA1      699   52.6    74.2    33.9    40.3  7.52
    #>  3 0.076              5     0 AMA1      633.  81.3    35.4    77.1   112.  12.8
    #>  4 0.23               2     0 AMA1     1725.  60.5    32.5    84.8    52.3  3.51
    #>  5 0.73              19     0 AMA1     2504. 119.    166.     61.5   105.   4.75
    #>  6 177.78             4     0 AMA1    58262  709.    994.    383.    612.   1.22
    #>  7 19.75             10     0 AMA1    64143. 353.    476.    367.    109.   0.55
    #>  8 2.19              16     0 AMA1     9243  383.    528.    156.    372.   4.15
    #>  9 533                1     0 AMA1    53180. 559.    117.    735.    619.   1.05
    #> 10 59.26              7     0 AMA1    61601  894.   1078.   1111.     32.5  1.45
    #> # … with 116 more rows, 25 more variables: CVX2_X3 <dbl>, CVX1_X3 <dbl>,
    #> #   CVX1_X2 <dbl>, cvCat_all <chr>, cvSelected_all <dbl>, iden <chr>,
    #> #   `1` <dbl>, `2` <dbl>, `3` <dbl>, x <chr>, meanX1_X2 <dbl>, meanX1_X3 <dbl>,
    #> #   meanX2_X3 <dbl>, meanSelected <dbl>, mean_best_CV <dbl>, best_CV <dbl>,
    #> #   best_CV_cat <chr>, TAG_name <chr>, CD4TAG <dbl>, GST <dbl>, MBP <dbl>,
    #> #   TAG_mfi <dbl>, mean_best_CV_tag <dbl>, machine <chr>, day <chr>, and
    #> #   abbreviated variable name ¹​sample_array_ID