Question: How to save the result from calling matchPWM?
0
gravatar for Yisong Zhen
5.9 years ago by
Yisong Zhen200
Yisong Zhen200 wrote:
Dear Users, I called the matchPWM method in Biostrings package. The return object is XStringViews and I want to save the "hit" result in a file. It seemed that once there was a method named write.XStringViews, but I searched and found no corresponding information, maybe it already deprecated and not maintained any more. So, my question is, Is there any alternative way to save the result so that I can locate the motif hits in multiple sequences? Thanks in advance. Yisong [[alternative HTML version deleted]]
biostrings • 737 views
ADD COMMENTlink modified 5.9 years ago by Hervé Pagès ♦♦ 14k • written 5.9 years ago by Yisong Zhen200
Answer: How to save the result from calling matchPWM?
0
gravatar for Hervé Pagès
5.9 years ago by
Hervé Pagès ♦♦ 14k
United States
Hervé Pagès ♦♦ 14k wrote:
Hi Yisong, Remember to search the 2 strands of the chromosome. The matchPWM method for DNAString/MaskedDNAString/character objects does not automatically do this for you. This is done with something like: plus_hits <- matchPWM(pwm, chr3R) minus_hits <- matchPWM(reverseComplement(pwm), chr3R) You can save the hits as a tabulated file. For this you first need to turn the 2 XStringViews object into a data.frame, which can be done with something like: df <- rbind(data.frame(chrom="chr3R", start=start(plus_hits), end=end(plus_hits), strand="+"), data.frame(chrom="chr3R", start=start(minus_hits), end=end(minus_hits), strand="-")) or, if you also want to save the hit sequences: df <- rbind(data.frame(chrom="chr3R", start=start(plus_hits), end=end(plus_hits), strand="+", seq=as.character(plus_hits)), data.frame(chrom="chr3R", start=start(minus_hits), end=end(minus_hits), strand="-", seq=as.character(minus_hits))) (Note that this will report the hit sequences with respect to the + strand, even for hits on the - strand. If you don't want this, replace 'as.character(minus_hits)' above with 'as.character(reverseComplement(minus_hits))'.) Then use something like write.table() to write 'df' to a file. If you're looping over the chromosomes to find all the hits in the genome, you can call write.table() with 'append=TRUE' to send all the hits to the same file. HTH, H. On 11/11/2013 11:36 PM, Yisong Zhen wrote: > Dear Users, > > I called the matchPWM method in Biostrings package. The return object is > XStringViews and I want to save the "hit" result in a file. It seemed that > once there was a method named write.XStringViews, but I searched and found > no corresponding information, maybe it already deprecated and > not maintained any more. So, my question is, Is there any alternative way > to save the result so that I can locate the motif hits in > multiple sequences? Thanks in advance. > > Yisong > > [[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 > -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fhcrc.org Phone: (206) 667-5791 Fax: (206) 667-1319
ADD COMMENTlink written 5.9 years ago by Hervé Pagès ♦♦ 14k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 304 users visited in the last hour