Hi Jonathan,

Thanks for your response and codes. That saves me a lot of time to look over the webs. Your answers are great!  but if I try to create a table using python or other scripts and then input the table to R for statistics, how can I decide the range (e.g. start and end) when I count the reads in each position across the chromosomes/genome? Can you give me more suggestions? Thanks.

Best,

John  



________________________________
 From: Jonathan Cairns <Jonathan.Cairns@cancer.org.uk>

 <bioconductor@r-project.org> 
Sent: Monday, September 17, 2012 10:38 AM
Subject: RE: [BioC] ChiPseq input files?

Hi John,

I would try the Rsamtools package. You'd need something like this (warning, untested code):

library(Rsamtools)

bamFile = "path/to/Bamfile.bam"
p <- ScanBamParam(what=c("rname", "strand", "pos", "qwidth"))
bam <- scanBam(bamFile, param=p)[[1]]

BayesPeak accepts data.frames or RangedDatas. I would suggest the easiest thing to do is construct a RangedData:

library(IRanges)
IR <- IRanges(start=bam[["pos"]], width=bam[["qwidth"]])
x <- RangedData(ranges=IR, strand=bam[["strand"]], space=bam[["rname"]])

chipseq accepts GRanges by preference:

library(GenomicRanges)
y <- GRanges(seqnames=bam[["rname"]], ranges=IR, strand=bam[["strand"]])

There may be a faster/cleverer way of doing it, but this should work.

Jonathan


________________________________________
From: bioconductor-bounces@r-project.org [bioconductor-bounces@r-project.or
Sent: 17 September 2012 15:04
To: bioconductor@r-project.org
Subject: [BioC] ChiPseq input files?

Hi,

I am wondering how to simply prepare the input files for R BayesPeak and chipseq packages, assuming BAM files already generated by BWA and samtools.   Thanks.

John
        [[alternative HTML version deleted]]


NOTICE AND DISCLAIMER
This e-mail (including any attachments) is intended for ...{{dropped:19}}

