sub_crap: Insert cRAP numbers into a character vector

View source: R/make_fasta.R

sub_crapR Documentation

Insert cRAP numbers into a character vector

Description

This function takes a character vector where each element is roughly in the form of a UniProt header e.g. "sp|XXXXXX|YYYY_YYYY Text goes here" and substitutes a cRAP number in place of the first | symbol, e.g. "sp|cRAP001|XXXXXX|YYYY_YYYY Text goes here".

Usage

sub_crap(x, start = 1, width = 3)

Arguments

x

character vector, each element must have two | symbols with some text in between e.g. |sometext|.

start

numeric, the number to increment from, default is 1

width

numeric, how many digits the cRAP number should be, default is 3

Value

Returns a character vector the same length as x.

Examples

# basic use
sub_crap(c("|sometext|", "|moretext|"))

# start from a different number
sub_crap(c("|sometext|", "|moretext|"), start = 88)

# increase number width
sub_crap(c("|sometext|", "|moretext|"), start = 1111, width = 4)


CambridgeCentreForProteomics/camprotR documentation built on Jan. 27, 2023, 8:36 p.m.