bioinformatics - Trim DNA sequence using R -


i have dna sequence files , many sequences start "cccatgcagacatagtg" or "ctccatgcagacatagtg" , have tag sequence "atgca". want remove "atgca" "cc" , "ctc". final product "gacatagtg".

does know r function can that? tried trimlrpatterns in biostrings not work since trim end not within sequence. please let me know if have solution that. thanks.

try this:

# dummy dna mydna <- c("cccatgcagacatagtg","ctccatgcagacatagtg") # define tag tag <- "atgca"  # remove character(s) before tag, including tag. gsub(paste0("^.*",tag),"",mydna)  # output # [1] "gacatagtg" "gacatagtg" 

Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -