Extracting and replacing data from deep_mutational_scan objects uses a mixture of list and data frame syntax. $ and [[ extract values from the main data fields (e.g. the gene or where the data is annotated) and [ provides a shortcut to access the main data table, which can otherwise be accessed via x$data.

# S3 method for deep_mutational_scan
[(x, i, j, drop = FALSE, ...)

# S3 method for deep_mutational_scan
[(x, i, j, ...) <- value

Arguments

x

deep_mutational_scan object.

i, j, ...

Indices to access.

drop

Coerce result to lowest possible dimension.

value

Value to set.

Functions

  • [.deep_mutational_scan: Extract

  • [<-.deep_mutational_scan: Assign

Examples

dms <- deepscanscape::deep_scans$p53 # Extract meta data: dms$study
#> NULL
dms$impute_mask
#> NULL
dms[["gene"]]
#> NULL
# Replace meta data dms$gene <- "new_gene" dms$impute_mask <- NA # Quickly access data columns: dms["A"]
#> # A tibble: 191 x 1 #> A #> <dbl> #> 1 -0.772 #> 2 -0.440 #> 3 -0.695 #> 4 -0.240 #> 5 -0.778 #> 6 -0.309 #> 7 -0.544 #> 8 0.154 #> 9 -0.727 #> 10 0.0170 #> # … with 181 more rows
dms[c(1,2,3), "C"]
#> # A tibble: 3 x 1 #> C #> <dbl> #> 1 -0.688 #> 2 -0.722 #> 3 -0.0939
dms[c("position", "wt", "A", "D")]
#> # A tibble: 191 x 4 #> position wt A D #> <dbl> <chr> <dbl> <dbl> #> 1 1 T -0.772 -0.662 #> 2 2 Y -0.440 -0.879 #> 3 3 Q -0.695 -0.890 #> 4 4 G -0.240 -0.542 #> 5 5 S -0.778 -1.01 #> 6 6 Y -0.309 0.0561 #> 7 7 G -0.544 -0.734 #> 8 8 F 0.154 0.138 #> 9 9 R -0.727 -0.0746 #> 10 10 L 0.0170 -0.576 #> # … with 181 more rows
# Quickly modify data columns dms["position"] <- dms["position"] + 1