Dear list,
I have an error when I try to import a Bam file with the respective 
index using both method in Rsamtools "ScanBam()" and 
"open(BamFile())".The sorted file was created with "sortBam()" and the 
indexed with the function "indexBam()".
For the sorting I obtain also a warning that I would like to understand. 
Is this happen because the file is too big and so it first splitted in 
more files and then merged?

I am using the following code (with the relative output):
 > sortedFile <- sortBam("xxx.bam", "xxx_sorted", byQname=FALSE, 
maxMemory=512)
[1] "xxx_sorted.bam"
Warning message:
In .local(file, destination, ...) : [bam_sort_core] merging from 2 files...

 > indexedFile <- indexBam("xxx_sorted.bam")
 > bf = open(BamFile(sortedFile, indexedFile))
Error in open.BamFile(BamFile("xxx_sorted.bam",  :
   failed to load BAM index
   file: xxx_sorted.bam.bai
In addition: Warning message:
In open.BamFile(BamFile("xxx_sorted.bam",  :
   [bam_index_load] fail to load BAM index.

 > param <- ScanBamParam(flag=scanBamFlag(isUnmappedQuery=FALSE), 
what=c("qname", "pos", "qwidth", "rname"))
 > aln <- scanBam(sortedFile, index=indexedFile, param=param)
Error in open.BamFile(BamFile(file, index), "rb") :
   failed to load BAM index
   file: xxx_sorted.bam.bai
In addition: Warning message:
In open.BamFile(BamFile(file, index), "rb") :
   [bam_index_load] fail to load BAM index.


Any suggestions is welcomed.
Cheers,
Francesco


 > sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] C/en_US.UTF-8/C/C/C/C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Rsamtools_1.8.0     Biostrings_2.24.1   GenomicRanges_1.8.3 
IRanges_1.14.2      BiocGenerics_0.2.0

loaded via a namespace (and not attached):
[1] bitops_1.0-4.1 stats4_2.15.0  tools_2.15.0   zlibbioc_1.2.0



-- 

*Francesco Mattia Mancuso*
Bioinformatician

- Bioinformatics Core Facility
- Proteomics Core Facility

CRG-Centre for Genomic Regulation (Room 439)
C/ Dr. Aiguader, 88 (Edif. PRBB)
08003 Barcelona, Spain

Mail: francesco.mancuso@crg.eu <mailto:francesco.mancuso@crg.eu>
Phone: +34 933160202
http://www.crg.es/bioinformatics_unit

	[[alternative HTML version deleted]]

