iqbal-lab-org / minos

Variant call adjudication
MIT License
16 stars 5 forks source link

Math error during genotyping #79

Closed bricoletc closed 5 years ago

bricoletc commented 5 years ago

Here's an error log that appeared on multiple samples while running minos adjudicate on 50K CRyPTIC Mtb samples:

Command error:
  Traceback (most recent call last):
    File "/usr/local/bin/minos", line 210, in <module>
      args.func(args)
    File "/usr/local/lib/python3.6/dist-packages/minos/tasks/adjudicate.py", line 22, in run
      adj.run()
    File "/usr/local/lib/python3.6/dist-packages/minos/adjudicator.py", line 152, in run
      self._run_gramtools_with_split_vcf()
    File "/usr/local/lib/python3.6/dist-packages/minos/adjudicator.py", line 332, in _run_gramtools_with_split_vcf
      filtered_outfile=split_vcf_out,
    File "/usr/local/lib/python3.6/dist-packages/minos/gramtools.py", line 245, in write_vcf_annotated_using_coverage_from_gramtools
      filtered_record = update_vcf_record_using_gramtools_allele_depths(vcf_records[i], all_allele_coverage[i][0], all_allele_coverage[i][1], allele_groups, mean_depth, read_error_rate, kmer_size)
      gtyper.run()
    File "/usr/local/lib/python3.6/dist-packages/minos/genotyper.py", line 162, in run
      self._calculate_log_likelihoods()
    File "/usr/local/lib/python3.6/dist-packages/minos/genotyper.py", line 127, in _calculate_log_likelihoods
      non_zeros,
    File "/usr/local/lib/python3.6/dist-packages/minos/genotyper.py", line 76, in _log_likelihood_homozygous
      allele_depth * math.log(mean_depth),
  ValueError: math domain error
  .command.stub: line 99: 24118 Terminated              nxf_trace "$pid" .command.trace

Example of command executed:

Command executed:

  sample_name=$(grep "^#[^#]" /nfs/leia/research/iqbal/mhunt/Cryptic_production/Pipeline_root/00/01/23/46/12346/Pipelines/1/variant_call/0.7.3.ref.3/minos/final.remasked.vcf | awk '{print $NF}') # Extract the sample name from the original vcf
  sample_name_in_file=${sample_name//\//_} # Replace "/" with something reasonable
  minos_outdir=small_vars.minos.11656
  minos adjudicate  --sample_name $sample_name --gramtools_build_dir /hps/nobackup2/zi/Cryptic_releases/nextflow.work.100chunks/82/882e1e9eafc2c6119fb917b4bf2fcd/gramtools.build_dir --reads /nfs/leia/research/iqbal/mhunt/Cryptic_production/Pipeline_root/
00/01/23/46/12346/Pipelines/1/variant_call/0.7.3.ref.3/samtools/rmdup.bam $minos_outdir /nfs/leia/research/iqbal/mhunt/Cryptic_production/Pipeline_refs/3/ref.fa "/hps/nobackup2/zi/Cryptic_releases/nextflow.work.100chunks/b1/9dcef20eef89a7e02e2bbb6eadc6d2
/small_vars_clustered.vcf"

I have reproduced this locally and am looking into it