AlleicImbalance error reading in BAM files
Entering edit mode
JK ▴ 10
Last seen 7.1 years ago
United States



I have bam files generated by using Bowtie2 and samtools. I am getting the following error message when trying to use the package AllelicImbalance:

I would appreciate help on why this happens.

Thank you,


> reads <- impBamGAL(pathToFiles,searchArea,verbose=FALSE)
Error in FUN("C:\\Users\\karjo01\\Applications\\R-3.1.1\\library\\AllelicImbalance/AGP001_bowtie2.bam"[[1L]],  : 
  failed to build index
  file: C:\Users\karjo01\Applications\R-3.1.1\library\AllelicImbalance/AGP001_bowtie2.bam
In addition: Warning messages:
1: In FUN("C:\\Users\\karjo01\\Applications\\R-3.1.1\\library\\AllelicImbalance/AGP001_bowtie2.bam"[[1L]],  :
  [bam_index_core] the alignment is not sorted (HWI:1:X:1:1101:1439:2191): 6-th chr > 2-th chr
2: In FUN("C:\\Users\\karjo01\\Applications\\R-3.1.1\\library\\AllelicImbalance/AGP001_bowtie2.bam"[[1L]],  :
  [bam_index_build2] fail to index the BAM file.
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
 [1] AllelicImbalance_1.4.0  GenomicAlignments_1.2.1 Rsamtools_1.18.2        Biostrings_2.34.1       XVector_0.6.0           GenomicRanges_1.18.4   
 [7] GenomeInfoDb_1.2.4      IRanges_2.0.1           S4Vectors_0.4.0         BiocGenerics_0.12.1    

loaded via a namespace (and not attached):
 [1] acepack_1.3-3.3          AnnotationDbi_1.28.1     base64enc_0.1-2          BatchJobs_1.4            BBmisc_1.7               Biobase_2.26.0          
 [7] BiocParallel_1.0.0       biomaRt_2.22.0           biovizBase_1.14.1        bitops_1.0-6             brew_1.0-6               BSgenome_1.34.1         
[13] checkmate_1.4            cluster_1.15.3           codetools_0.2-9          colorspace_1.2-4         DBI_0.3.1                dichromat_2.0-0         
[19] digest_0.6.4             fail_1.2                 foreach_1.4.2            foreign_0.8-61           Formula_1.1-2            GenomicFeatures_1.18.3  
[25] Gviz_1.10.5              Hmisc_3.14-5             iterators_1.0.7          lattice_0.20-29          latticeExtra_0.6-26      matrixStats_0.10.0      
[31] munsell_0.4.2            nnet_7.3-8               plyr_1.8.1               R.methodsS3_1.6.1        RColorBrewer_1.0-5       Rcpp_0.11.3             
[37] RCurl_1.95-4.3           rpart_4.1-8              RSQLite_0.11.4           rtracklayer_1.26.2       scales_0.2.4             sendmailR_1.2-1         
[43] splines_3.1.1            stringr_0.6.2            survival_2.37-7          tools_3.1.1              VariantAnnotation_1.12.8 XML_3.98-1.1            
[49] zlibbioc_1.12.0         
allelicimbalance • 843 views
Entering edit mode
Last seen 1 day ago
United States

It looks like the BAM file needs to be sorted, see Rsamtools ?sortBam and I guess indexed via indexBam on the same page.


Login before adding your answer.

Traffic: 351 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6