BD2KGenomics / toil-rnaseq

UC Santa Cruz Computational Genomics Lab's Toil-based RNA-seq pipeline
Apache License 2.0
40 stars 10 forks source link

Update gencode_hugo_map container to fix ZeroDivisionError when no genes map #154

Closed jvivian closed 6 years ago

jvivian commented 6 years ago

A user with indices generated from non-humans encountered an error when none of the genes mapped:

quay.io/ucsc_cgl/gencode_hugo_mapping:1.0--cb4865d02f9199462e66410f515c4dabbd061e4d -g rsem_genes.results -i rsem_isoforms.results.
Number of unmapped genes: 54146.0, of 0 total genes.
Traceback (most recent call last):
  File "/opt/mapping/gencode_hugo_map.py", line 106, in <module>
    main()
  File "/opt/mapping/gencode_hugo_map.py", line 87, in main
    replace_gene_names(genes[gene], gene_mappings)
  File "/opt/mapping/gencode_hugo_map.py", line 24, in replace_gene_names
    print "{}% of genes succesfully mapped.".format(100 * round(1 - (keyerrors / len(table['gene_id'])), 4))
ZeroDivisionError: float division by zero

A PR to fix the container is located at: https://github.com/BD2KGenomics/cgl-docker-lib/pull/280