diffexp {slinky} | R Documentation

## diffexp

### Description

Calculate differential expression scores, subsetting by plate.

### Usage

    diffexp(x, treat, control = "auto", method = "cd",
      split_by_plate = FALSE, where_clause = list(), gold = TRUE,
      inferred = TRUE, verbose = FALSE, ...)

    ## S4 method for signature 'Slinky'
    diffexp(x, treat, control = "auto", method = "cd",
      split_by_plate = FALSE, where_clause = list(), gold = TRUE,
      inferred = TRUE, verbose = FALSE, ...)

### Arguments

`x` | An object of class Slinky
`treat` | A SummarizedExperiment containing the treated samples, or the pert_iname of desired perturbagen. See details.
`control` | A SummarizedExperiment containing the control samples, or the pert_iname of desired controls. Default is 'auto'. See details.
`method` | Scoring method to use. Only `cd` and `ks` are presently supported.
`split_by_plate` | Should the analysis be split by plate? This is one way to control for batch effects, but requires at least two treated sample and two control samples on each plate in the dataset. Default is FALSE. Not supported for method = 'ks'.
`where_clause` | If treat is a pert_iname, further query terms may be specified here (e.g. `pert_type=\"trt_sh\"`).
`gold` | Restrict analysis to gold instances as defined by LINCS. Ignored if treat and control are SummarizedExperiments.
`inferred` | Should the inferred (non-landmark) genes be included in the analysis? Default is TRUE.
`verbose` | Do you want to know how things are going? Default is FALSE.
`...` | Additional arguments for `method`.

### Value

Vectors of scores, one per subset (plate). This function looks for `rna_plate` in `colData(treat)` and `colData(control)` to slice the data into subsets, and then performs differential expression analysis on the subsets. If a perturbation identifier is provided instead of an SummarizedExperiment, the necessary SummarizedExperiment is constructed by calling this package's `toSummarizedExperiment` function (which requires that you have initialized this class with appropriate clue.io key and location of gctx file). Note that the control dataset can be automatically generated by the default option of `control=\"auto\"`. In this case, appropriate same-plate controls are identified for the samples in the treat dataset and loaded. For more complex queries, you can create the requisite SummarizedExperiments yourself with `toSummarizedExperiment`, or create a SummarizedExperiment by any other methods, ensuring that `treat` and `control` contain the `rna_plate` metadata variable for subsetting. Note that this function assumes that each plate represented in `treat` is also represented in `control`

### Examples

    #'
    # for build/demo only.  You MUST use your own key when using the slinky
    # package.
    user_key <- httr::content(httr::GET('https://api.clue.io/temp_api_key'),
                              as='parsed')$user_key
    sl <- Slinky(user_key,
                     system.file('extdata', 'demo.gctx',
                          package='slinky'),
                     system.file('extdata', 'demo_inst_info.txt',
                         package = 'slinky'))
    scores <- diffexp(sl, sl[,1:5], sl[,18:22])
    head(scores)

    # for build/demo only.  You MUST use your own key when using the slinky
    # package.
    ## Not run:
    user_key <- httr::content(httr::GET('https://api.clue.io/temp_api_key'),
                              as='parsed')$user_key
    sl <- Slinky(user_key,
                     system.file('extdata', 'demo.gctx',
                          package='slinky'),
                     system.file('extdata', 'demo_inst_info.txt',
                         package = 'slinky'))
    cd_vector <- diffexp(sl,
                        treat = "amoxicillin",
                        split_by_plate = FALSE,
                        verbose = FALSE)

    ## End(Not run)

[Package slinky version 1.2.2 Index]