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)
http://cancerit.github.io/alleleCount/
GNU Affero General Public License v3.0
43 stars 8 forks source link

Confusing error when input is unmapped #71

Open keiranmraine opened 3 years ago

keiranmraine commented 3 years ago

This code isn't intended for unmapped BAM files, but logging how it appears.

When an alignment file is not mapped you will see an error similar to this:

[ERROR] (src/bam_access.c: bam_access_get_position_base_counts:454 errno: No such file or directory) Error detected (-2) when trying to iterate through region.
[ERROR] (./src/alleleCounter.c: main:448 errno: None) Error retrieving stats from bam file for position :65885569

The error doesn't print the contig correctly for some reason at this line:

https://github.com/cancerit/alleleCount/blob/b2158f0a9e7958332674bda0d73fdf39df8a1843/c/src/alleleCounter.c#L448

Rather than this being confusing, this should be prevented by checking the header contains @SQ lines and giving an appropriate message if they are absent.