[BioC] reading BAM files

James W. MacDonald jmacdon at uw.edu
Mon Nov 26 18:32:51 CET 2012


Hi Hermann,

On 11/26/2012 12:26 PM, Hermann Norpois wrote:
> Hello,
>
> I try to read BAM files - so far without success. And I dont know why.
>
> My Bamfile is wgEncodeOpenChromDnase8988tAlnRep1.bam
> (downloaded from the Encode site)
>
> For example:
>
> library (ShortRead)
>> which<- RangesList(seq1=IRanges(1000,2000),
> + seq2=IRanges(c(100,1000), c(1000,2000)))
>> what<- c("rname", "strand", "pos", "qwidth","seq")
>> param<- ScanBamParam(which=which, what=what)
>> bam<- scanBam ("~/Bam/wgEncodeOpenChromDnase8988tAlnRep1.bam",
> param=param)
> [bam_index_load] fail to load BAM index.
> Fehler in open.BamFile(BamFile(file, index), "rb") :
>    failed to load BAM index
>    file: /home/hnorpois/Bam/wgEncodeOpenChromDnase8988tAlnRep1.bam
>
>
> The mentioned syntax I copied from an introduction to Rsamtools.
> Actually I would like to know a simple syntax that enables me to read
> BAM-files. Can anybody give me a hint.

The hint is in the error message above - 'failed to load BAM index', 
which indicates that you have not yet indexed your bam file. You need to 
first use indexBam(), then you should be able to read in.

Best,

Jim


>
> Thanks Hermann
>
> 	[[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

-- 
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099



More information about the Bioconductor mailing list