[BioC] replace nucleotide at fixed position in a DNAStringSet object

Robert Castelo robert.castelo at upf.edu
Fri Sep 13 16:13:58 CEST 2013


hi!!

i'd like to know if there is some efficient way to replace a nucleotide 
at a fixed position in a DNAStringSet object.

let's say we have the following toy DNAStringSet object with 3 DNA 
sequences:

x <- DNAStringSet(c("ATGACCACG", "ACTGGGGAA", "GCCGATGCG"))
x
   A DNAStringSet instance of length 3
     width seq
[1]     9 ATGACCACG
[2]     9 ACTGGGGAA
[3]     9 GCCGATGCG

and a DNAStringSetList object with the following 3 nucleotides

y <- DNAStringSetList(DNAStringSet("G"), DNAStringSet("C"), 
DNAStringSet("C"))
y
DNAStringSetList of length 3
[[1]] G
[[2]] C
[[3]] C

i'd like to replace the, let's say, fourth nucleotide along the DNA 
sequences in 'x' by those in 'y'. i can imagine how to do it coercing 
back and forth to character and so on but i guess there must be some 
more efficient way to do it. my interest come from the fact that the 
DNAStringSet object i have to work with can have many DNA sequences.

thanks!!
robert.

-- 
Robert Castelo, PhD
Associate Professor
Dept. of Experimental and Health Sciences
Universitat Pompeu Fabra (UPF)
Barcelona Biomedical Research Park (PRBB)
Dr Aiguader 88
E-08003 Barcelona, Spain
telf: +34.933.160.514
fax: +34.933.160.550



More information about the Bioconductor mailing list