Skip to contents

This is used to add additional columns to the Coldata table by giving additional semantics to existing columns.

Usage

DesignSemantics(...)

Arguments

...

named parameter list of functions (see details)

Value

a named list; the names should correspond to column names in the Coldata table, and the values are functions to add semantics to this table

Details

DesignSemantics returns a list of functions that is supposed to be used as semantics parameter when calling MakeColdata. For each design vector element matching a name of this list the corresponding function is called by MakeColdata to add additional columns.

Each function takes two parameters, the first being the original column in the Coldata table column, the second being its name.

Semantics.time is such a predefined function: Contents such as 3h or 30min are converted into a numerical value (in hours), and no4sU is converted into 0.

Semantics.concentration is such a predefined function: Contents such as 200uM or 1mM are converted into a numerical value (in uM), and no4sU is converted into 0.

By default, Semantics.time is used for the names duration.4sU and Experimental.time, and Semantics.concentration is used for concentration.4sU

See also

Examples


Semantics.time(c("5h","30min","no4sU"),"Test")
#>   Test
#> 1  5.0
#> 2  0.5
#> 3  0.0


myfun <- function(s,name) {
        r<-Semantics.time(s,name)
        cbind(r,data.frame(hpi=paste0(r$duration.4sU+3,"h")))
}
sars <- ReadGRAND(system.file("extdata", "sars.tsv.gz", package = "grandR"),
                  design=function(names)
                    MakeColdata(names,c("Cell",Design$dur.4sU,Design$Replicate),
                  semantics=DesignSemantics(duration.4sU=myfun)),
                  verbose=TRUE)
#> Checking file...
#> Reading files...
#> Warning: Duplicate gene symbols (n=1, e.g. MATR3) present, making unique!
#> Processing...
Coldata(sars)
#>                      Name Cell Replicate duration.4sU hpi duration.4sU.original
#> Mock.no4sU.A Mock.no4sU.A Mock         A            0  3h                 no4sU
#> Mock.1h.A       Mock.1h.A Mock         A            1  4h                    1h
#> Mock.2h.A       Mock.2h.A Mock         A            2  5h                    2h
#> Mock.2h.B       Mock.2h.B Mock         B            2  5h                    2h
#> Mock.3h.A       Mock.3h.A Mock         A            3  6h                    3h
#> Mock.4h.A       Mock.4h.A Mock         A            4  7h                    4h
#> SARS.no4sU.A SARS.no4sU.A SARS         A            0  3h                 no4sU
#> SARS.1h.A       SARS.1h.A SARS         A            1  4h                    1h
#> SARS.2h.A       SARS.2h.A SARS         A            2  5h                    2h
#> SARS.2h.B       SARS.2h.B SARS         B            2  5h                    2h
#> SARS.3h.A       SARS.3h.A SARS         A            3  6h                    3h
#> SARS.4h.A       SARS.4h.A SARS         A            4  7h                    4h
#>              no4sU
#> Mock.no4sU.A  TRUE
#> Mock.1h.A    FALSE
#> Mock.2h.A    FALSE
#> Mock.2h.B    FALSE
#> Mock.3h.A    FALSE
#> Mock.4h.A    FALSE
#> SARS.no4sU.A  TRUE
#> SARS.1h.A    FALSE
#> SARS.2h.A    FALSE
#> SARS.2h.B    FALSE
#> SARS.3h.A    FALSE
#> SARS.4h.A    FALSE