Crop sequences between two positions
seq_crop_position(x, position_in = 1, position_out = -1)
a DNA, RNA or AA vector.
an integer giving the position where to start cropping.
an integer giving the position where to stop cropping.
A cropped DNA, RNA or AA vector.
stri_sub
from stringi and
str_sub
from stringr
for the underlying implementation.
Other string operations:
seq-replace
,
seq_combine()
,
seq_count_pattern()
,
seq_crop_pattern()
,
seq_detect_pattern()
,
seq_extract_pattern()
,
seq_extract_position()
,
seq_remove_pattern()
,
seq_remove_position()
,
seq_replace_position()
,
seq_split_kmer()
,
seq_split_pattern()
x <- dna("ACGTTAGTGTAGCCGT")
# Drop the first 3 nucleotides (ACG)
seq_crop_position(x, position_in = 4)
#> DNA vector of 1 sequences
#> > TTAGTGTAGCCGT
# Crop codon between position 4 and 6
seq_crop_position(x, position_in = 4, position_out = 6)
#> DNA vector of 1 sequences
#> > TTA