argparsing {HelloRanges} | R Documentation

## Argument parsing details

### Description

HelloRanges uses docopt for parsing the argument string passed as the `cmd` argument to functions like `bedtools_intersect`. `bedtools` has its own style of argument formatting. Here we document the subtle differences.

### Details

Here are the specific differences:

- docopt requires that multi-character arguments are prefixed by two hyphens, e.g., --bed. However, `bedtools` expects only a single hyphen. It turns out docopt is robust to the single-hyphen case, except for the first argument. Since the typical convention is to first indicate the file, e.g., -a or -i, this incompatibility does not often arise in practice.

- docopt does not allow values of argument to be space-separated, while `bedtools` often expects space separation for multi-valued arguments. As a compromise, HelloRanges expects the values to be comma-separated. Thus, -b b.bed c.bed needs to be -b b.bed,c.bed.

- Most shells support nested commands within parentheses, e.g., -b < (grep foo file.bed), but docopt does not support that. Instead, nested commands should be enclosed in double quotes, e.g., -b < "grep foo file.bed". Such constructs are supported via `pipe`.

### Author(s)

Michael Lawrence

[Package HelloRanges version 1.10.0 Index]