How to avoid gaps in a long sequence in R


#1

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


#2

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"

?