[Bioc-sig-seq] using subseq() in Biostrings to insert bases

Vincent Carey stvjc at channing.harvard.edu
Tue Jul 20 06:23:10 CEST 2010


This particular task might be solved with gsub():

> foo <- DNAStringSet('ACTTA')
> gsub("^(..)(.)", "\\1G\\2", foo)
[1] "ACGTTA"

There is of course a more concise solution than the one given here.

On Mon, Jul 19, 2010 at 11:11 PM, Andrew Yee <yee at post.harvard.edu> wrote:
> Is there a way to use subseq() to insert nucleotides?
>
> Take for example foo:
>
> foo <- DNAStringSet('ACTTA')
>
> I'd like to insert e.g. a G between positions 2 and 3 so that foo looks like
> 'ACGTTA'  Is there a way to do this using subseq()?  Or is an alternative
> function recommended?
>
> Thanks,
> Andrew
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-sig-sequencing mailing list
> Bioc-sig-sequencing at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>



More information about the Bioc-sig-sequencing mailing list