Skip to contents

Methods for AnansiWeb S7 container class

Arguments

x

input, AnansiWeb object

Value

The desired information from an AnansiWeb object

See also

Examples

# Setup
web <- randomWeb(n_samp = 36)

# Accessors
dimnames(web)
#> $y
#>  [1] "y_1"  "y_2"  "y_3"  "y_4"  "y_5"  "y_6"  "y_7"  "y_8"  "y_9"  "y_10"
#> [11] "y_11" "y_12"
#> 
#> $x
#> [1] "x_1" "x_2" "x_3" "x_4" "x_5" "x_6" "x_7" "x_8"
#> 
dim(web)
#> [1] 12  8
names(web)
#> [1] "y" "x"

# Getters and setters:

tableX(web)[1:5, 1:5]
#>                       x
#> sample_id                      x_1        x_2        x_3        x_4         x_5
#>   anansi_ID_sample_1_1  1.36977586 -0.7175387  0.3624240  0.7432281 -0.91592054
#>   anansi_ID_sample_2_1 -0.02011003  0.3616948  2.1693445  0.5571536  0.07326746
#>   anansi_ID_sample_3_1 -0.10921759  1.3990043  0.1391305 -1.2485832  1.23817132
#>   anansi_ID_sample_4_1  0.26466174  0.3726990  1.3763265 -0.2078743  0.71837134
#>   anansi_ID_sample_5_1  0.30384826 -1.5656443 -0.4914500  0.4239695  0.53946650
tableY(web)[1:5, 1:5]
#>                       y
#> sample_id                     y_1        y_2        y_3        y_4        y_5
#>   anansi_ID_sample_1_1 -0.2217445  1.3939778  1.8034834 -0.3780286 -0.4892583
#>   anansi_ID_sample_2_1 -1.0095287  0.3602783 -0.1050687  1.7361110 -1.1660523
#>   anansi_ID_sample_3_1  0.4807253  0.6545503  0.9824534 -0.8452478 -0.4796690
#>   anansi_ID_sample_4_1  1.6044073  1.0521554 -1.7133026 -0.9615715  0.1153482
#>   anansi_ID_sample_5_1 -1.5150245 -1.9795551 -0.8320195  1.0174911 -1.7680484
dictionary(web)
#> 12 x 8 sparse Matrix of class "ngCMatrix"
#>       x
#> y      x_1 x_2 x_3 x_4 x_5 x_6 x_7 x_8
#>   y_1    |   .   |   |   |   |   .   |
#>   y_2    |   .   .   |   .   |   |   .
#>   y_3    |   .   .   .   .   .   |   |
#>   y_4    |   .   .   .   .   |   .   .
#>   y_5    |   |   .   .   |   |   .   .
#>   y_6    .   |   .   .   .   .   |   .
#>   y_7    |   |   .   .   .   |   |   .
#>   y_8    .   |   .   .   |   |   .   .
#>   y_9    |   |   |   |   |   .   .   |
#>   y_10   |   |   |   .   |   .   |   |
#>   y_11   .   |   .   .   .   |   |   |
#>   y_12   |   .   |   .   |   .   |   .
head(metadata(web))
#>                      sample_id repeated group_ab subtype    score_a    score_b
#> anansi_ID_sample_1_1  sample_1    rep_1        a       x -0.7189809  2.7151442
#> anansi_ID_sample_2_1  sample_2    rep_1        a       z -1.1165613 -1.3393870
#> anansi_ID_sample_3_1  sample_3    rep_1        a       z -0.7802699 -0.6460152
#> anansi_ID_sample_4_1  sample_4    rep_1        a       z -1.7769585 -0.9324546
#> anansi_ID_sample_5_1  sample_5    rep_1        b       y -0.4278349 -0.7690869
#> anansi_ID_sample_6_1  sample_6    rep_1        b       z -2.0310270  0.3715798
#>                         score_c
#> anansi_ID_sample_1_1  0.3376581
#> anansi_ID_sample_2_1 -0.6075021
#> anansi_ID_sample_3_1 -0.2955603
#> anansi_ID_sample_4_1 -0.1345371
#> anansi_ID_sample_5_1  0.8147844
#> anansi_ID_sample_6_1 -0.2729217

# Assign some random metadata
metadata(web) <- data.frame(
    id = row.names(tableY(web)),
    a = rnorm(36),
    b = sample(c("a", "b"), 36, TRUE),
    row.names = "id"
)

# Coerce to list
weblist <- as.list(web)

# Coerce to Data.frame
webdf <- as.data.frame(web)

# Coerce to MultiAssayExperiment
mae <- asMAE(web)

# Coerce to TreeSummarizedExperiment
tse <- asTSE(web)