The structure is supposed to be a list. Flattening is done by extracting the given fields (return.fields
)
and applying the additional function (return.extra
). This is mainly to be used within sapply
and similar.
Usage
structure2vector(d, return.fields = NULL, return.extra = NULL)
kinetics2vector(
d,
condition = NULL,
return.fields = c("Synthesis", "Half-life"),
return.extra = NULL
)
Arguments
- d
the data structure
- return.fields
which fields should be extracted directly (may be NULL)
- return.extra
apply a function returning a flat list or vector (may be NULL)
- condition
if the original grandR object had
Condition
set, which condition to extract (NULL otherwise)
Examples
sars <- ReadGRAND(system.file("extdata", "sars.tsv.gz", package = "grandR"),
design=c("Condition",Design$dur.4sU,Design$Replicate))
#> Warning: Duplicate gene symbols (n=1, e.g. MATR3) present, making unique!
sars <- Normalize(sars)
fit <- FitKineticsGeneLeastSquares(sars,"SRSF6")$Mock
print(fit)
#> $data
#> Name Condition Replicate duration.4sU duration.4sU.original no4sU
#> 1 Mock.no4sU.A Mock A 0 no4sU TRUE
#> 2 Mock.1h.A Mock A 1 1h FALSE
#> 3 Mock.2h.A Mock A 2 2h FALSE
#> 4 Mock.2h.B Mock B 2 2h FALSE
#> 5 Mock.3h.A Mock A 3 3h FALSE
#> 6 Mock.4h.A Mock A 4 4h FALSE
#> 7 Mock.no4sU.A Mock A 0 no4sU TRUE
#> 8 Mock.1h.A Mock A 1 1h FALSE
#> 9 Mock.2h.A Mock A 2 2h FALSE
#> 10 Mock.2h.B Mock B 2 2h FALSE
#> 11 Mock.3h.A Mock A 3 3h FALSE
#> 12 Mock.4h.A Mock A 4 4h FALSE
#> Value use time Type
#> 1 1352.9261 TRUE 0 Old
#> 2 949.1078 TRUE 1 Old
#> 3 694.7509 TRUE 2 Old
#> 4 814.7388 TRUE 2 Old
#> 5 546.2433 TRUE 3 Old
#> 6 328.4560 TRUE 4 Old
#> 7 0.0000 TRUE 0 New
#> 8 275.2315 TRUE 1 New
#> 9 503.5086 TRUE 2 New
#> 10 626.5115 TRUE 2 New
#> 11 672.5057 TRUE 3 New
#> 12 836.2817 TRUE 4 New
#>
#> $residuals
#> Name Type Absolute Relative
#> 1 Mock.no4sU.A old 70.210176 0.05473556
#> 2 Mock.1h.A old -21.017981 -0.02166521
#> 3 Mock.2h.A old -38.961101 -0.05310136
#> 4 Mock.2h.B old 81.026835 0.11043412
#> 5 Mock.3h.A old -8.667473 -0.01561958
#> 6 Mock.4h.A old -91.226323 -0.21736992
#> 7 Mock.no4sU.A new 0.000000 NaN
#> 8 Mock.1h.A new -37.358670 -0.11951327
#> 9 Mock.2h.A new -45.495290 -0.08286879
#> 10 Mock.2h.B new 77.507573 0.14117854
#> 11 Mock.3h.A new -55.299413 -0.07598107
#> 12 Mock.4h.A new -26.751828 -0.03099744
#>
#> $Synthesis
#> [1] 358.2743
#>
#> $Degradation
#> [1] 0.2793092
#>
#> $`Half-life`
#> [1] 2.481648
#>
#> $conf.lower
#> Synthesis Degradation Half-life
#> 316.9675391 0.2509529 2.2529248
#>
#> $conf.upper
#> Synthesis Degradation Half-life
#> 399.5811302 0.3076655 2.7620608
#>
#> $f0
#> [1] 1282.716
#>
#> $logLik
#> 'log Lik.' -64.91331 (df=3)
#>
#> $rmse
#> [1] 54.08212
#>
#> $rmse.new
#> [1] 46.98688
#>
#> $rmse.old
#> [1] 60.34886
#>
#> $total
#> [1] 7600.262
#>
#> $type
#> [1] "equi"
#>
kinetics2vector(fit)
#> Synthesis Half-life
#> 358.274335 2.481648