merging two DNAStringsets
1
0
Entering edit mode
@ullrich-kristian-4692
Last seen 10.2 years ago
Hello Bioconductor curators, How I can merge two subseqs of one DNAStringSet into one DNAStringSet? seq.list=list() seq.list[1]=paste(rep("AT",50),collapse="") seq.list[2]=paste(rep("GC",50),collapse="") example = DNAStringSet(unlist(seq.list)) length(example) = 2 width(example) = 100 start1 = 1 end1 = 20 start2 = 40 end2 = 60 first.subseq = subseq(example,start1,end1) second.subseq = subseq(example,start2,end2) c(first.subseq,second.subseq) doesn´t paste the sequences together Is there an easy method? Or do i have to loop over all entries? Thank you in anticipation Kristian Ullrich Institute of Plant Biochemistry [[alternative HTML version deleted]]
• 5.4k views
ADD COMMENT
0
Entering edit mode
@valerie-obenchain-4275
Last seen 2.9 years ago
United States
Hi Kristian, To combine all ranges in first.subseq and second.subseq, singleseq <- c(unlist(first.subseq), unlist(second.subseq)) > singleseq 82-letter "DNAString" instance seq: ATATATATATATATATATATGCGCGCGCGCGCGCGC...TATATATATATATATCGCGCGCGCGCGCGCG CGCGC To combine the ranges within first and second and then create a DNAStringSet, here is an approach using unlist and views, seqlist <- list(first.subseq, second.subseq) widths <- sapply(seqlist, function(x) sum(width(x))) seqviews <- successiveViews(singleseq, widths) as(seqviews, "DNAStringSet") A DNAStringSet instance of length 2 width seq [1] 40 ATATATATATATATATATATGCGCGCGCGCGCGCGCGCGC [2] 42 TATATATATATATATATATATCGCGCGCGCGCGCGCGCGCGC Valerie On 06/13/11 04:01, Ullrich, Kristian wrote: > Hello Bioconductor curators, > > How I can merge two subseqs of one DNAStringSet into one DNAStringSet? > > seq.list=list() > seq.list[1]=paste(rep("AT",50),collapse="") > seq.list[2]=paste(rep("GC",50),collapse="") > example = DNAStringSet(unlist(seq.list)) > > length(example) = 2 > width(example) = 100 > start1 = 1 > end1 = 20 > start2 = 40 > end2 = 60 > first.subseq = subseq(example,start1,end1) > second.subseq = subseq(example,start2,end2) > > c(first.subseq,second.subseq) doesn?t paste the sequences together > > Is there an easy method? Or do i have to loop over all entries? > > Thank you in anticipation > > Kristian Ullrich > Institute of Plant Biochemistry > > > > [[alternative HTML version deleted]] > > > > > _______________________________________________ > 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
ADD COMMENT
0
Entering edit mode

Hi Valerie

what is function(x) and what is x in your code ?

ADD REPLY

Login before adding your answer.

Traffic: 819 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6