systemdf: Wrapper of system calls in which input and output are all...

Description Usage Arguments Details Value Author(s) Examples

Description

Wrapper of system calls in which input and output are all table-like files

Usage

1
systemdf(cmd, envir = parent.frame(), verbose = FALSE)

Arguments

cmd

shell command

envir

environment where to look for variables encoded in cmd

verbose

whether print messages

Details

This function (system + data frame) provides a convinient way to invoke system calls in R. Since most of system calls expect tables as inputs and outputs, systemdf does following things step by step:

A simple example is as follows:

1
2
3
    bed1 = circlize::generateRandomBed(nr = 1000)
    bed2 = circlize::generateRandomBed(nr = 1000)
    df = systemdf("bedtools closest -a `bed1` -b `bed2` | awk '$1==\"chr1\"'")  

Value

A data frame. Sometimes column names may be lost.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

1
2
3
4
if(Sys.info()["sysname"] %in% c("Linux", "Darwin")) {
    df = data.frame(x = sample(1:10, 10), y = sample(11:20, 10))
    systemdf("sort -k1,1n `df`")
}

eilslabs/epic documentation built on May 16, 2019, 1:24 a.m.