R/get_id.R

Defines functions get_id

Documented in get_id

##' get id at specific position
##'
##'
##' @title get_id
##' @param x sequence description line
##' @param sep separator to split x
##' @param position id position
##' @return id
##' @export
##' @author Guangchuang Yu
##' @examples
##' fa_file <- system.file("extdata/HA.fas", package="seqmagick")
##' x <- fa_read(fa_file)
##' get_id(names(x)[1:5], sep = " ", position=1)
get_id <- function(x, sep=" ", position) {
    res <- tokenize(x, sep)
    sapply(res, function(x) x[position])
}

Try the seqmagick package in your browser

Any scripts or data that you put into this service are public.

seqmagick documentation built on July 9, 2023, 7:36 p.m.