Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw ex-info on hgvs->vcf for a variant containing ambiguous coordinates #27

Merged
merged 3 commits into from
Jun 17, 2019

Conversation

totakke
Copy link
Member

@totakke totakke commented Jun 13, 2019

Current hgvs->vcf throws NPE when a variant containing ambiguous coordinates is supplied.

(require '[varity.hgvs-to-vcf :as h2v]
         '[clj-hgvs.core :as hgvs])

(h2v/hgvs->vcf-variants (hgvs/parse "NM_007294:c.1-?_80+?del")
                        "path/to/fasta.fa"
                        "path/to/refGene.txt")
;; NullPointerException   clojure.lang.Numbers.ops (Numbers.java:1018)

NM_007294:c.1-?_80+?del is totally correct as a coding DNA HGVS, but it
cannot be converted to a VCF variant because genomic positions are underspecified.
I modified cds-coord->genomic-pos to throw ex-info with :ambiguous-coordinate
error type when such a coordinate is passed.

(try
  (h2v/hgvs->vcf-variants (hgvs/parse "NM_007294:c.1-?_80+?del")
                          "path/to/fasta.fa"
                          "path/to/refGene.txt")
  (catch Exception e
    (ex-data e)))
;;=> {:type :varity.hgvs-to-vcf.cdna/ambiguous-coordinate,
;;    :coordinate {:start {:position 80, :offset 1, :region nil}, :end {}}}

This patch is useful for error handling on hgvs->vcf.

And besides, I removed oraclejdk from CI because they cause build failure (Build #229).
That may be resolved if using Trusty instead of Xenial, but I think only tests with OpenJDK are enough for this library.

I confirmed lein test :all passed.

@codecov
Copy link

codecov bot commented Jun 14, 2019

Codecov Report

Merging #27 into master will decrease coverage by 0.16%.
The diff coverage is 2.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #27      +/-   ##
==========================================
- Coverage    38.4%   38.24%   -0.17%     
==========================================
  Files          13       13              
  Lines        1471     1480       +9     
  Branches       31       31              
==========================================
+ Hits          565      566       +1     
- Misses        875      883       +8     
  Partials       31       31
Impacted Files Coverage Δ
src/varity/hgvs_to_vcf/cdna.clj 7.85% <2.08%> (+0.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ef6dbe...d402fe2. Read the comment docs.

@totakke totakke requested a review from alumi June 14, 2019 09:48
Copy link
Member

@alumi alumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍and thank you for fixing the CI config!

@alumi alumi merged commit 2995996 into master Jun 17, 2019
@alumi alumi deleted the fix/ambiguous-coord-ex branch June 17, 2019 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants