R: Create a flowmat using a list a commands.

to_flowmat {flowr} | R Documentation

## Create a flowmat using a list a commands.

### Description

Create a flowmat (data.frame) using a named list a commands.

as.flowmat(): reads a file and checks for required columns. If x is data.frame checks for required columns.

### Usage

    to_flowmat(x, ...)

    ## S3 method for class 'list'
    to_flowmat(x, samplename, ...)

    ## S3 method for class 'data.frame'
    to_flowmat(x, ...)

    ## S3 method for class 'flow'
    to_flowmat(x, ...)

    as.flowmat(x, grp_col, jobname_col, cmd_col, ...)

    is.flowmat(x)

### Arguments

`x` | a named list, where name corresponds to the jobname and value is a vector of commands to run.
`...` | not used
`samplename` | character of length 1 or that of nrow(x) ['samplename']
`grp_col` | column used for grouping, default samplename.
`jobname_col` | column specifying jobname, default jobname
`cmd_col` | column specifying commands to run, default cmd

### Examples

    # Use this link for a few examples:
    # http://docs.flowr.space/tutorial.html#define_modules

    # create a flow mat, starting with a list of commands.
    cmd_sleep = c("sleep 1", "sleep 2")
    cmd_echo = c("echo 'hello'", "echo 'hello'")

    # create a named list
    lst = list("sleep" = cmd_sleep, "echo" = cmd_echo)
    flowmat = to_flowmat(lst, samplename = "samp")

    # read in a tsv; check and confirm format
    ex = file.path(system.file(package = "flowr"), "pipelines")

    flowmat = as.flowmat(file.path(ex, "sleep_pipe.tsv"))

    # if your column names are different than defaults, explicitly specify them.
    flowmat = as.flowmat(file.path(ex, "sleep_pipe.tsv"), jobname_col = "jobname")

    # check if a object is a flowmat
    is.flowmat(flowmat)

    # create a flowdef, from this flowmat
    flowdef = to_flowdef(flowmat)

    # create a flow object using flowmat and flowdef
    fobj = to_flow(flowmat, flowdef)

    # extract a flowmat from a flow (here the samplename also contains the name of the flow)
    flowmat2 = to_flowmat(fobj)

    ## submit the flow to the cluster (execute=TRUE) or do a dry-run (execute=FALSE)
    ## Not run:
    fobj2 = submit_flow(fobj, execute=FALSE)
    fobj3 = submit_flow(fobj, execute=TRUE)

    ## Get the status or kill all the jobs
    status(fobj3)
    kill(fobj3)

    ## End(Not run)

[Package flowr version 0.9.10 Index]