Skip to contents

Load matrix and baseline data from .sem files

Usage

loadSEM(semFile, semId = NULL, bl = NULL)

Arguments

semFile

A path to a .sem file. Expects header of file to be in format #BASELINE:{bl} where bl is the numeric baseline value. If matrix does not include baseline header, must be specified in bl.

semId

A unique id for the sem as a character. Defaults to semFile file name without the extension.

bl

numeric baseline value for the SEM. Overrides baseline specified in semFile header.

Value

A SNPEffectMatrix object

Examples

# write a tmp file to hold a SEM
m <- matrix(rnorm(16), nrow = 4)
colnames(m) <- c("A", "C", "G", "T")
tf <- tempfile()
write.table(m, tf, quote = FALSE, sep = "\t", row.names = FALSE)

loadSEM(tf, semId = "sem_id", bl = 1)
#> An object of class SNPEffectMatrix
#> semId:  sem_id
#> baseline:  1
#> sem:
#>             A           C          G          T
#>         <num>       <num>      <num>      <num>
#> 1:  0.1181949 -0.20608719 -2.2741149  1.0743459
#> 2: -1.9117205  0.01917759  2.6825572 -0.6650882
#> 3:  0.8620865  0.02956075 -0.3612213  1.1139524
#> 4: -0.2432367  0.54982754  0.2133557 -0.2458964