[BioC] BAM files to Genomic Ranges object

Steve Lianoglou mailinglist.honeypot at gmail.com
Mon Jan 14 17:27:57 CET 2013


Hi,

On Mon, Jan 14, 2013 at 5:20 AM,  <jluis.lavin at unavarra.es> wrote:
> First of all I want to thank Herve Pages and Martin Morgan for their kind
> answers. And I want to apologize for this delay answering back, but I was
> offline for a few days...
>
> I used Herve code to read my BAM files into GRanges objects, but I don't
> seem to be able to use that Granges object into the cpgDensityCalc
> function.
> This is how I try to do it:
>
> -(My files are in the working directory already)
>
> library(Mus.musculus)
> library(Repitools)
> library(GenomicRanges)
> library(Rsamtools)
>
>  bam_files <- list.files(pattern="*.bam")
>    gr_list <- lapply(bam_files,
>                      function(bam_file)
>                        as(readGappedAlignments(bam_file), "GRanges"))
>    names(gr_list) <- bam_files
>
> require(BSgenome.Mmusculus.UCSC.mm9)
>
> cpdens <- cpgDensityCalc(gr_list, organism=Mmusculus, window =600)
>
> -And I get the following error:
>
> Error in function (classes, fdef, mtable)  :
> unable to find an inherited method for function "cpgDensityCalc", for
> signature "character", "BSgenome"
>
> What does this error mean?

It means that your `gr_list` isn't what you think it is -- it's a
character, perhaps "try-error"?

Look at `head(gr_list)` ... what do you see?

> *I'm awfully sorry for my lack of intermediate-advance R scripting
> knowledge, I'm trying to fix that...

Reading through an Introduction to R might be helpful, if you haven't
done so already.

Bioconductor uses the S4 class system in R, and it would be helpful to
understand some parts of that too. If you look. If you look at
previous bioc courses online, you will often find that Martin does a
quick intro to these things at the beginning of many sessions:

http://bioconductor.org/help/course-materials/

Look for courses that were run at The Hutch (in Seattle)

Perhaps the intro slides here will bear fruit:

http://bioconductor.org/help/course-materials/2010/SeattleIntro/

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the Bioconductor mailing list