chr: Extract chromosome or chunk from file names

Description Usage Arguments Value Examples

Description

Extract chromosome or chunk from file names

Usage

1
2
chr(xs, pattern = ".*chr([^_]+)")
chunk(xs, pattern = ".*chr[^_]+_(\\d+)")

Arguments

xs

File names.

pattern

Extended regular expression pattern (see regex) used to extract the substrings corresponding to chromosome or chunk number from ‘xs’.

Value

chr returns an integer vector of chromosome numbers unless the conversion from character to integer would lead to missing values, in which case a character vector is returned.

chunk returns an integer vector of chunk numbers.

Examples

1
2
3
4
library(genFun)

chr(c("chr5_path/to/the_chr1_3.txt", "chr5_path/to/the_chr2_4.txt"))
chunk(c("chr5_path/to/the_chr1_3.txt", "chr5_path/to/the_chr2_4.txt"))

cbaumbach/genFun documentation built on May 13, 2019, 1:47 p.m.