[BioC] using and combining of "subseq"

Harris A. Jaffee hj at jhu.edu
Wed Jun 15 20:09:36 CEST 2011

x1 = "AAAAAAAAAATTTTTTTTTTGGGGGGGGGGCCCCCCCCCC"
x2 = "TTTTTTTTTTGGGGGGGGGGCCCCCCCCCCAAAAAAAAAA"
X = DNAStringSet(c(x1, x2))

> X
A DNAStringSet instance of length 2
width seq
    40 AAAAAAAAAATTTTTTTTTTGGGGGGGGGGCCCCCCCCCC
    40 TTTTTTTTTTGGGGGGGGGGCCCCCCCCCCAAAAAAAAAA

> start1 = 1
> end1   = 10
>
> start2 = 21
> end2   = 25

s1 = subseq(X, start1, end1)
s2 = subseq(X, start2, end2)

A DNAStringSet instance of length 2
width seq
    15 AAAAAAAAAAGGGGG
    15 TTTTTTTTTTCCCCC

On Jun 15, 2011, at 7:36 AM, Kristian Ullrich wrote:

> 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="AAAAAAAAAATTTTTTTTTTGGGGGGGGGGCCCCCCCCCC"
> seq.list="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
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/
> gmane.science.biology.informatics.conductor