cancerit / alleleCount

Support code for NGS copy number algorithms. Takes a file of locations and a [cr|b]am file and generates a count of coverage of each allele [ACGT] at that location (given any filter settings)

Home Page:http://cancerit.github.io/alleleCount/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Throw informative error when BAM index missing

sdentro opened this issue · comments

Currently alleleCounter throws a trace when it is run on a BAM file that has not been indexed. The trace does not mention the missing index, which would be a helpful message.

Example trace:

[ERROR] (src/bam_access.c: bam_access_openhts:55 errno: No such file or directory) HTS index file temp.bam failed to open.
[ERROR] (./src/alleleCounter.c: main:255 errno: None) Error trying to open sequence/index files 'temp.bam'.
*** glibc detected *** alleleCounter: free(): invalid pointer: 0x0000003b6b352a38 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3b6b0722ef]
/lib64/libc.so.6(cfree+0x4b)[0x3b6b07273b]
alleleCounter(hfile_destroy+0x2e)[0x44e5be]
alleleCounter(hclose+0x34)[0x44e664]
alleleCounter(bgzf_close+0x6c)[0x44889c]
alleleCounter(hts_close+0x3d)[0x40a84d]
alleleCounter(bam_access_closehts+0x34)[0x407d14]
alleleCounter(main+0xde)[0x45514e]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x3b6b01d994]
alleleCounter[0x407b89]
======= Memory map: ========
00400000-00461000 r-xp 00000000 00:bd 4069614364                         /home/sdentro/software/bin/alleleCounter
00660000-00661000 rw-p 00060000 00:bd 4069614364                         /home/sdentro/software/bin/alleleCounter
1a8fd000-1a926000 rw-p 1a8fd000 00:00 0                                  [heap]
3629000000-362900d000 r-xp 00000000 08:01 3040234                        /lib64/libgcc_s-4.1.2-20080825.so.1
362900d000-362920d000 ---p 0000d000 08:01 3040234                        /lib64/libgcc_s-4.1.2-20080825.so.1
362920d000-362920e000 rw-p 0000d000 08:01 3040234                        /lib64/libgcc_s-4.1.2-20080825.so.1
3b6ac00000-3b6ac1c000 r-xp 00000000 08:01 3039897                        /lib64/ld-2.5.so
3b6ae1b000-3b6ae1c000 r--p 0001b000 08:01 3039897                        /lib64/ld-2.5.so
3b6ae1c000-3b6ae1d000 rw-p 0001c000 08:01 3039897                        /lib64/ld-2.5.so
3b6b000000-3b6b14d000 r-xp 00000000 08:01 3040106                        /lib64/libc-2.5.so
3b6b14d000-3b6b34d000 ---p 0014d000 08:01 3040106                        /lib64/libc-2.5.so
3b6b34d000-3b6b351000 r--p 0014d000 08:01 3040106                        /lib64/libc-2.5.so
3b6b351000-3b6b352000 rw-p 00151000 08:01 3040106                        /lib64/libc-2.5.so
3b6b352000-3b6b357000 rw-p 3b6b352000 00:00 0 
3b6b800000-3b6b816000 r-xp 00000000 08:01 3040117                        /lib64/libpthread-2.5.so
3b6b816000-3b6ba15000 ---p 00016000 08:01 3040117                        /lib64/libpthread-2.5.so
3b6ba15000-3b6ba16000 r--p 00015000 08:01 3040117                        /lib64/libpthread-2.5.so
3b6ba16000-3b6ba17000 rw-p 00016000 08:01 3040117                        /lib64/libpthread-2.5.so
3b6ba17000-3b6ba1b000 rw-p 3b6ba17000 00:00 0 
3b6c800000-3b6c814000 r-xp 00000000 08:01 2499963                        /usr/lib64/libz.so.1.2.3
3b6c814000-3b6ca13000 ---p 00014000 08:01 2499963                        /usr/lib64/libz.so.1.2.3
3b6ca13000-3b6ca14000 rw-p 00013000 08:01 2499963                        /usr/lib64/libz.so.1.2.3
2b70dfa83000-2b70dfa85000 rw-p 2b70dfa83000 00:00 0 
2b70dfa96000-2b70dfb98000 rw-p 2b70dfa96000 00:00 0 
7fff87887000-7fff8789c000 rw-p 7ffffffe9000 00:00 0                      [stack]
7fff878d6000-7fff878d9000 r-xp 7fff878d6000 00:00 0                      [vdso]
ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0                  [vsyscall]
Aborted 

The first 2 lines of the error indicate the missing index file:

[ERROR] (src/bam_access.c: bam_access_openhts:55 errno: No such file or directory) HTS index file temp.bam failed to open.
[ERROR] (./src/alleleCounter.c: main:255 errno: None) Error trying to open sequence/index files 'temp.bam'.