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

Fix format of uncertain protein mutation #8

Merged
merged 2 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject clj-hgvs "0.4.6"
(defproject clj-hgvs "0.4.7-SNAPSHOT"
:description "Clojure(Script) library for handling HGVS"
:url "https://github.com/chrovis/clj-hgvs"
:license {:name "Apache License, Version 2.0"
Expand Down
4 changes: 2 additions & 2 deletions src/clj_hgvs/mutation.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@
(defrecord UncertainMutation [mutation]
Mutation
(format [this] (format this nil))
(format [this _]
(str "(" (format mutation) ")"))
(format [this opts]
(str "(" (format mutation opts) ")"))
(plain [this]
{:mutation "uncertain-mutation"
:content-mutation (plain mutation)})
Expand Down
20 changes: 16 additions & 4 deletions test/clj_hgvs/mutation_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,29 @@
(def uncertain-mutation2 (mut/uncertain-mutation
(mut/rna-substitution (coord/rna-coordinate 306 nil nil) "g" "u")))

(def uncertain-mutation3s "(Cys123Gly)")
(def uncertain-mutation3ss "(C123G)")
(def uncertain-mutation3k :protein)
(def uncertain-mutation3 (mut/uncertain-mutation
(mut/protein-substitution "Cys"
(coord/protein-coordinate 123)
"Gly")))

(deftest format-uncertain-mutation-test
(testing "returns a string expression of an uncertain mutation"
(are [m s] (= (mut/format m nil) s)
uncertain-mutation1 uncertain-mutation1s
uncertain-mutation2 uncertain-mutation2s)))
(are [m o s] (= (mut/format m o) s)
uncertain-mutation1 nil uncertain-mutation1s
uncertain-mutation2 nil uncertain-mutation2s
uncertain-mutation3 nil uncertain-mutation3s
uncertain-mutation3 {:amino-acid-format :short} uncertain-mutation3ss)))

(deftest parse-uncertain-mutation-test
(testing "returns a correct UncertainMutation"
(are [s k m] (= (mut/parse-uncertain-mutation s k) m)
uncertain-mutation1s uncertain-mutation1k uncertain-mutation1
uncertain-mutation2s uncertain-mutation2k uncertain-mutation2)))
uncertain-mutation2s uncertain-mutation2k uncertain-mutation2
uncertain-mutation3s uncertain-mutation3k uncertain-mutation3
uncertain-mutation3ss uncertain-mutation3k uncertain-mutation3)))

(deftest plain-uncertain-mutation-test
(testing "returns a plain map representing UncertainMutation"
Expand Down