Skip to contents

Samples corresponding to a differential expression contrast

Usage

contrastSamples(object, ...)

# S4 method for DESeqAnalysis
contrastSamples(object, i, quiet = FALSE, return = c("character", "list"))

Arguments

object

Object.

i

Indices specifying elements to extract or replace. Indices are numeric or character vectors, empty (missing), or NULL.

For more information:

help(topic = "Extract", package = "base")

quiet

logical(1). Perform command quietly, suppressing messages.

return

character(1). Return type. Uses match.arg() internally and defaults to the first argument in the character vector.

...

Additional arguments.

Value

  • character: Sample identifiers, corresponding to the column names of DESeqDataSet.

  • list: Named list containing "contrast" and "samples" elements: (1) "contrast": character vector containing metadata on "factor", "numerator", and "denominator" contrast elements; (2) "samples": ``listcontaining"numerator"` and `"denominator"` of sample identifiers corresponding to column names of `DESeqDataSet`.

Details

Match the samples in a DESeqDataSet used to define contrast in a corresponding DESeqResults object. Note that this only works for simple (e.g. pairwise) contrasts and will intentionally error for more complex comparisons.

Note

Updated 2023-09-26.

Examples

data(deseq)

## DESeqAnalysis ====
x <- contrastSamples(deseq, i = 1L, return = "list")
#> Contrast: condition_B_vs_A
#> Factor column: condition
#> Numerator samples: "sample7", "sample8", "sample9", "sample10", "sample11"...
#> Denominator samples: "sample1", "sample2", "sample3", "sample4", "sample5"...
print(x)
#> $contrast
#>      factor   numerator denominator 
#> "condition"         "B"         "A" 
#> 
#> $samples
#> $samples$numerator
#> [1] "sample7"  "sample8"  "sample9"  "sample10" "sample11" "sample12"
#> 
#> $samples$denominator
#> [1] "sample1" "sample2" "sample3" "sample4" "sample5" "sample6"
#> 
#> 

x <- contrastSamples(deseq, i = 1L, return = "character")
#> Contrast: condition_B_vs_A
#> Factor column: condition
#> Numerator samples: "sample7", "sample8", "sample9", "sample10", "sample11"...
#> Denominator samples: "sample1", "sample2", "sample3", "sample4", "sample5"...
print(x)
#>  [1] "sample7"  "sample8"  "sample9"  "sample10" "sample11" "sample12"
#>  [7] "sample1"  "sample2"  "sample3"  "sample4"  "sample5"  "sample6"