How to avoid gaps in a long sequence in R

I have a DNA sequence of length 50k as my argument in fasta format.
I want to pick substring from it for this i use following code

Library (stringi)
stri_sub(x, from= , to= )

But it reads the black spaces as well please tell me how to resolve this problem

Could you perhaps make a little example, which reproduced the challenge you are experiencing?

Perhaps this is what you mean:

library('tidyverse')
"ACG             ACTG" %>% str_replace_all(' ','')
[1] "ACGACTG"

abd then you can do:

"ACG             ACTG" %>% str_replace_all(' ','') %>% str_sub(start = 2, end = 4)
[1] "CGA"

?

3 Likes