Skip to content

Commit

Permalink
Enable defining other-names for product in API split POST #304
Browse files Browse the repository at this point in the history
  • Loading branch information
mluypaert committed Jul 15, 2020
1 parent d9f9940 commit 194a9c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/wormbase/names/gene.clj
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,21 @@
(wnu/qualify-keys "gene")
(assoc :product product)
(wne/transform-ident-ref-values))
{biotype :gene/biotype product :product} cdata
{p-seq-name :gene/sequence-name
p-biotype :gene/biotype} product
{biotype :gene/biotype} cdata
{p-seq-name :gene/sequence-name
p-biotype :gene/biotype
p-other-names :gene/other-names} product
prov (wnp/assoc-provenance request payload :event/split-gene)
species (get-in from-gene [:gene/species :species/latin-name])
new-data (merge {:gene/species (s/conform :gene/species species)}
new-data (->> (merge {:gene/species (s/conform :gene/species species)}
(assoc product
:db/id p-seq-name
:gene/biotype p-biotype
:gene/other-names p-other-names
:gene/status :gene.status/live))
;;Remove potential nil values (:gene/other-names)
(remove (comp nil? val))
(into {}))
curr-bt (d/entid db (:gene/biotype from-gene))
new-bt (d/entid db biotype)
p-gene-lur [:gene/sequence-name p-seq-name]
Expand Down
3 changes: 2 additions & 1 deletion src/wormbase/specs/gene.clj
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
:description "The data requried to update a Gene."}))

(s/def ::product (stc/spec
{:spec (s/keys :req-un [:gene/sequence-name :gene/biotype])}))
{:spec (s/keys :req-un [:gene/sequence-name :gene/biotype]
:opt-un [:gene/other-names])}))

(s/def ::split (stc/spec
{:spec (s/keys :req-un [:gene/biotype ::product])
Expand Down

0 comments on commit 194a9c4

Please sign in to comment.