tag:blogger.com,1999:blog-8532065960756482590.post4715969279352296289..comments2024-03-20T03:17:16.259-04:00Comments on Jermdemo: Chromosome bias in R, my notebookJermdemohttp://www.blogger.com/profile/01662705354227625640noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-8532065960756482590.post-85231773948072919702010-12-29T09:27:31.312-05:002010-12-29T09:27:31.312-05:00wow it's great to see someone use this approac...wow it's great to see someone use this approachJermdemohttps://www.blogger.com/profile/01662705354227625640noreply@blogger.comtag:blogger.com,1999:blog-8532065960756482590.post-42162111031706225042010-12-28T16:39:49.774-05:002010-12-28T16:39:49.774-05:00Jeremy;
Thanks much for this post. The residual pl...Jeremy;<br />Thanks much for this post. The residual plot approach is a really nice way to display the chromsome variability. I needed exactly this for a recent project, and incorporated your code and Martin's Rsamtools suggestion into an Rscript:<br /><br /><a href="https://github.com/chapmanb/mgh_projects/blob/master/cg_101112/chr_bias.R" rel="nofollow">https://github.com/chapmanb/mgh_projects/blob/master/cg_101112/chr_bias.R</a>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8532065960756482590.post-67980359229114764142010-12-24T14:41:30.690-05:002010-12-24T14:41:30.690-05:00Nice description! Counts within regions can be ret...Nice description! Counts within regions can be retrieved efficiently with Rsamtools::countBam using as the 'param' argument a ScanBamParam with appropriate 'which'. I did<br /><br /> seqlengths2gr <- function(x, strand="*")<br /> ## convert 'seqlengths' of BSgenome to sGRanges<br /> GRanges(names(x), IRanges(1, x), strand=strand)<br /> gr <- seqlengths2gr(seqlengths(Scerevisiae))<br /><br />and then <br /><br /> cnt <- countBam(fl, param=ScanBamParam(which=gr))<br /><br />'cnt' is then a data frame with counts of reads aligning to each chromosome, <br /><br /> > head(cnt)<br /> space start end width file records nucleotides<br /> 1 2micron 1 6318 6318 SRR002051 2068 68244<br /> 2 chrI 1 230208 230208 SRR002051 34984 1154472<br /> 3 chrII 1 813178 813178 SRR002051 104042 3433386<br /> 4 chrIII 1 316617 316617 SRR002051 31024 1023792<br /> 5 chrIV 1 1531919 1531919 SRR002051 214682 7084506<br /> 6 chrIX 1 439885 439885 SRR002051 35439 1169487Anonymoushttps://www.blogger.com/profile/06298306470769574244noreply@blogger.com