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

Null Iterator Error #69

Open nitishnih opened 3 years ago

nitishnih commented 3 years ago

Hi,

I recently installed alleleCount v4.2.1 on an HPC cluster using gcc 7.4.0. The installation ran without any problems. However, when testing with example data I receive a long error message, see attached, but here is the top section:

Reading locis
Done reading locis
[E::sam_itr_next] Null iterator
[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 Y:2934912
*** Error in `alleleCounter': double free or corruption (out): 0x0000000000414b20 ***

The command run was: alleleCounter -l gender.loci -b test.bam -o test.out

The input files gender.loci and test.bam are from this repository. Running the same command with v4.0.0 works without any errors.

Can you help troubleshoot the problem? Thanks.

keiranmraine commented 3 years ago

Please can you:

  1. Confirm that this is reproducible, the error message states errno: No such file or directory
  2. Provide the complete command line you used
  3. Confirm you input BAM/CRAM header has matching contig naming conventions, message states it is expecting without chr prefix (Y:2934912).

Our internal large-scale CI ran with no errors on the 4.2.1 release.

nitishnih commented 3 years ago

Thanks for your response, @keiranmraine

  1. I apologize, but I am not exactly sure what you mean when you refer to the error message and reproducibility. I decided to rebuild alleleCount and try the same test again. Here is the full log. Note that certain paths and addresses have been sanitized. To summarize what I show in the log:
  1. The complete command line is alleleCounter -l gender.loci -b test.bam -o test.out

  2. I am not sure about this either, but I ran samtools view -H test.bam and include the output in the full log

Either I am testing the new version of alleleCount incorrectly or I am incorrectly installing the latest version, which differs from how we installed previous versions.

keiranmraine commented 3 years ago

I can confirm a change in the htslib behaviour causes this (1.10 I suspect). I believe it was intended to ensure that applications notice that a contig isn't in the file. We'll have to look into this in more depth.

The problem is that the BAM file that you are using only contains chr 22 (without prefix) but the gender.loci only looks at Y. A BAM file with data for a single chromosome can be processed, BUT a full complement of contigs need to be listed in the @SQ headers due to this

You would need to use the loci_22.txt or loci_snp6.txt files with test.bam, otherwise you aren't testing any counts (although this is run during the install).

nitishnih commented 3 years ago

Thanks @keiranmraine for the clarification. That makes sense!

sunnaa0423 commented 5 months ago

Hi

I got the similar error with alleleCounter(v4.3.0) too!

alleleCounter -l $myPath1/G1000_loci_hg38_chr1.txt -b $myPath2/ABCD_hg38_bwa_sort_rmdup.bam -o out_chr1.txt

And it outputs this info: Reading locis Done reading locis [E::sam_itr_next] Null iterator [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 1:809641 Segmentation fault (core dumped)

Could you please give me some advice? Thanks

Sunna

AndyMenzies commented 5 months ago

Could you check the chromosome names between your loci and bam files are consistent. The default for hg38 is to include the chr prefix but your loci file looks to contain position 1:809641 and not chr1:809641