[BioC] using and combining of "subseq"

Kristian Ullrich kullrich at ipb-halle.de
Wed Jun 15 13:36:37 CEST 2011


Hello Biostrings curators,

again the question to you:

Is there an easier way to solve the follwing:

R-code:
####################
####################
library(Biostrings)

#example sequence
seq.list=list()
seq.list[1]="AAAAAAAAAATTTTTTTTTTGGGGGGGGGGCCCCCCCCCC"
seq.list[2]="TTTTTTTTTTGGGGGGGGGGCCCCCCCCCCAAAAAAAAAA"
fas.seq = DNAStringSet(unlist(seq.list))

#defining start and end points of subseq
start1 = 1
end1   = 10

start2 = 21
end2   = 25

#creating first and second subseq
first.subseq = subseq(fas.seq,start1,end1)
second.subseq = subseq(fas.seq,start2,end2)

new.seq = 
DNAStringSet(apply(sapply(list(first.subseq,second.subseq),as.character),1,function(x) 
paste(x,collapse="")))
names(new.seq) = names(fas.seq)
####################
####################

I basically want to combine subseqs from one DNAStringset, something like:

subseq(DNAStringSet, start = c(start1,start2), end = c(end1,end2))

would be nice.

Thank you in anticipation

Kristian Ullrich
-- 
Kristian Ullrich

Leibniz Institute of Plant Biochemistry
Weinberg 3
D-06120 Halle (Saale), Germany
phone +49 345 5582 1221
fax   +49 345 5582 1209
mail  kullrich at ipb-halle.de



More information about the Bioconductor mailing list