Read and replace the contents of a qseaSet. qsea exports accessors for most slots, but none for libraries or enrichment, and no replacement functions at all. These generics fill those gaps, so that code never has to reach into a slot with @.

getLibraries(object, ...)

# S4 method for class 'qseaSet'
getLibraries(object, type = NULL)

setLibraries(object, ...)

# S4 method for class 'qseaSet'
setLibraries(object, value, type = NULL)

getEnrichment(object, ...)

# S4 method for class 'qseaSet'
getEnrichment(object, name = NULL)

setEnrichment(object, ...)

# S4 method for class 'qseaSet'
setEnrichment(object, value, name = NULL)

setCounts(object, ...)

# S4 method for class 'qseaSet'
setCounts(object, value)

setRegions(object, ...)

# S4 method for class 'qseaSet'
setRegions(object, value)

setSampleTable(object, ...)

# S4 method for class 'qseaSet'
setSampleTable(object, value)

setParameters(object, ...)

# S4 method for class 'qseaSet'
setParameters(object, values)

setCNV(object, ...)

# S4 method for class 'qseaSet'
setCNV(object, value)

Arguments

object

qseaSet The object to query or modify.

...

Additional arguments passed to methods. Not used by the qseaSet methods.

type

character(1) or NULL Which library table to return or replace: "file_name" for the pulldown libraries, "input_file" for the input libraries. NULL returns the whole list. Default: NULL.

value

The replacement value: a matrix for setCounts(), a GRanges for setRegions() and setCNV(), a data.frame for setSampleTable(), and a data.frame/matrix (or a list when type/name is NULL) for setLibraries() and setEnrichment().

name

character(1) or NULL Which element of the enrichment slot to return or replace, such as "parameters", "factors", "pattern_name", "density" or "n". NULL returns or replaces the whole list. Default: NULL.

values

list Named list of parameters to merge into the parameters slot. Entries with an existing name are overwritten, the rest are left alone.

Value

  • getLibraries(): the libraries slot, a named list, or the single table named by type. Returns NULL when the set has no such table.

  • getEnrichment(): the enrichment slot, a named list, or the single element named by name. Returns NULL when absent.

  • setCounts(), setRegions(), setSampleTable(), setParameters(), setLibraries(), setEnrichment() and setCNV(): the updated qseaSet.

Details

The setters replace a slot without checking it against the rest of the object, so a sequence of calls can leave a qseaSet temporarily inconsistent (different numbers of samples in the count matrix and the sample table, say). Replace every affected slot before using the result.

Zygosity has no setter here because qsea already exports one, qsea::setZygosity().

Examples

data(exampleTumourNormal, package = "mesa")

# The pulldown library table, and the whole libraries slot
head(getLibraries(exampleTumourNormal, "file_name"))
#>          qsea_initial_reads qsea_initial_pairs qsea_initial_r1s
#> Colon1_N           12692133            6116269           365136
#> Colon1_T           22233219           10682235           677941
#> Colon2_N           13665557            6502600           486823
#> Colon2_T           17523260            8458460           566689
#> Lung1_N            24124310           11812879           459951
#> Lung1_T            14777077            7199265           346529
#>          qsea_mapq_filtered_pairs qsea_size_filtered_pairs qsea_filtered_r1s
#> Colon1_N                  4139702                  3973684            245156
#> Colon1_T                  8020873                  7651545            505870
#> Colon2_N                  4495478                  4293332            355784
#> Colon2_T                  6233320                  6093846            375273
#> Lung1_N                   8612047                  8246187            301844
#> Lung1_T                   5571896                  5368445            248324
#>          total_fragments valid_fragments library_factor     offset
#> Colon1_N         4218840         3745354      1.0160834 0.08361333
#> Colon1_T         8157415         7428804      0.9149047 0.11792761
#> Colon2_N         4649116         4195483      0.9700701 0.09683869
#> Colon2_T         6469119         5878535      0.9537051 0.04782413
#> Lung1_N          8548031         7747154      1.0365441 0.08932700
#> Lung1_T          5616769         5208468      1.0701382 0.09292399
#>          fragment_median fragment_mean fragment_sd     relH     GoGe
#> Colon1_N             213      218.0500    92.52174 5.567633 2.554300
#> Colon1_T             205      209.9108    87.52641 4.921130 2.425149
#> Colon2_N             209      213.7803    89.08940 5.399262 2.508576
#> Colon2_T             206      211.7649    83.38018 5.686246 2.529553
#> Lung1_N              170      179.5662    77.17606 4.463002 2.235803
#> Lung1_T              169      178.6148    75.22787 4.406991 2.218343
#>          fragments_without_pattern prop_without_pattern initial_reads
#> Colon1_N                    580041                0.137      15094748
#> Colon1_T                   1288747                0.158      26915464
#> Colon2_N                    662701                0.143      16356706
#> Colon2_T                    634997                0.098      20229952
#> Lung1_N                    1408605                0.165      27826064
#> Lung1_T                     915532                0.163      17027817
#>          mapped_reads properly_paired_reads contamination_filtered_reads
#> Colon1_N     14500990              13383100                     15094748
#> Colon1_T     25724228              23594272                     26915464
#> Colon2_N     15582886              14233090                     16356706
#> Colon2_T     19406362              18074018                     20229952
#> Lung1_N      26718181              25564316                     27826064
#> Lung1_T      16328648              15492908                     17027817
#>          dedup_reads prop_final
#> Colon1_N    12709013  0.4962460
#> Colon1_T    22267932  0.5520101
#> Colon2_N    13695862  0.5129985
#> Colon2_T    17532815  0.5811714
#> Lung1_N     24136005  0.5568272
#> Lung1_T     14785786  0.6117599
names(getLibraries(exampleTumourNormal))
#> [1] "file_name"  "input_file"

# The fitted enrichment parameters
head(getEnrichment(exampleTumourNormal, "parameters"))
#>          a        b        c
#> Colon1_N 3 38.94236 3.691682
#> Colon1_T 3 33.24228 3.664828
#> Colon2_N 3 39.08955 3.691246
#> Colon2_T 3 48.25952 3.743099
#> Lung1_N  3 32.55499 3.743398
#> Lung1_T  3 26.14876 3.719395

# Replacing a slot returns a new qseaSet
sampleTable <- qsea::getSampleTable(exampleTumourNormal)
sampleTable$batch <- "A"
qs <- setSampleTable(exampleTumourNormal, sampleTable)
head(qsea::getSampleTable(qs))
#>          sample_name    group patient        type tumour tissue age gender
#> Colon1_N    Colon1_N Colon1_N  Colon1 NormalColon Normal  Colon  80      F
#> Colon1_T    Colon1_T Colon1_T  Colon1         CRC Tumour  Colon  80      F
#> Colon2_N    Colon2_N Colon2_N  Colon2 NormalColon Normal  Colon  67      F
#> Colon2_T    Colon2_T Colon2_T  Colon2         CRC Tumour  Colon  67      F
#> Lung1_N      Lung1_N  Lung1_N   Lung1  NormalLung Normal   Lung  64      F
#> Lung1_T      Lung1_T  Lung1_T   Lung1        LUAD Tumour   Lung  64      F
#>          stage batch
#> Colon1_N  <NA>     A
#> Colon1_T   III     A
#> Colon2_N  <NA>     A
#> Colon2_T    IV     A
#> Lung1_N   <NA>     A
#> Lung1_T    IIA     A

# Parameters are merged, not replaced wholesale
qs <- setParameters(exampleTumourNormal, list(minMapQual = 10))
qsea::getParameters(qs)$minMapQual
#> [1] 10