BioGenies / tidysq

tidy processing of biological sequences in R
https://BioGenies.github.io/tidysq/
34 stars 2 forks source link

I would like to add x numer of N between concatenated sequences with collapse #98

Open ericgonzalezs opened 1 year ago

ericgonzalezs commented 1 year ago

I would like to concatenate sequences and add a determined number of N between sequences

Let's say I have these sequences

seq1 AACC seq2 CCAA seq3 CCCT

How I could concatenate them and add 2 Ns between them have this

seqNew AACCNNCCAANNCCCT

Or how to add any required amount of Ns between them?

Many thanks.

ErdaradunGaztea commented 1 year ago

For concatenation, there's a tidysq::collapse() function, which would take a single sq object with these three sequences. However, there's no "separator" parameter in here, so first you'd have to add NNs manually. I guess tidysq::paste() might handle that if executed before collapse(), if you pass an sq object with n-1 NN entries and an empty one at the end (tidysq::sq(c(rep("NN", length(your_sequences) - 1), ""), "rna_ext") basically).

Of course, you can replace "NN" with any other expression.

ericgonzalezs commented 1 year ago

It worked, many thanks!