Learn R Programming

flowr (version 0.9.11)

to_flowmat: 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 list to_flowmat(x, samplename, ...)

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

# S3 method for 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

Run this code
# NOT RUN {
# Use this link for a few examples:
# http://flow-r.github.io/flowr/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)
# }
# NOT RUN {


# }

Run the code above in your browser using DataLab