Git Product home page Git Product logo

utilitybeltcli's Introduction

utilitybeltcli

Lifecycle: experimental

The goal of utilitybeltcli is to make it easier to create R functions that interface with commandline tools.

Installation

You can install the development version of utilitybeltcli from GitHub with:

# install.packages("devtools")
devtools::install_github("selkamand/utilitybeltcli")

Example

Lets say we want to make an R function that wraps the tool ‘mosdepth’.

Quick Start

# Step 1: Load library
library(utilitybeltcli)

# Step 2: Define basic components of the tool (and the R function we want to produce that wraps it)
MosdepthWrapper <- CommandlineWrapper$new(
  base_command = "mosdepth",
  tool_title = "Mosdepth",
  tool_description = "simple R wrapper",
  function_name = "run_mosdepth"
)

# Step 3: describe the paramaters of the tool including:
#   (a) flags (–-verbose)
#   (b) arguments (-–threads <num_threads>)
#   (c) positional arguments (base_command <positional_arg>)
MosdepthWrapper$add_arg(name = "threads", prefix = "--threads")
MosdepthWrapper$add_flag(name = "d4", prefix = "--d4", default = FALSE)
MosdepthWrapper$add_pos(name = "prefix", required = TRUE)
MosdepthWrapper$add_pos(name = "bam_or_cram", required = TRUE)

# Step 4: produce the R function wrapper for the tool
MosdepthWrapper$create_function_wrapping_commandline_tool()

Once run, just paste the function in your custom package wrapping a tool and you’re all set!

utilitybeltcli's People

Contributors

selkamand avatar

Watchers

 avatar

utilitybeltcli's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.