Skip to content

Commit

Permalink
Enabled defining other-names for products in batch API split operation
Browse files Browse the repository at this point in the history
  • Loading branch information
mluypaert committed Sep 4, 2020
1 parent a1a87a8 commit bb3df6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
17 changes: 10 additions & 7 deletions ids/src/wormbase/ids/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,17 @@
:gene/species [:species/latin-name]}
pull-from-gene (partial d/pull db (conj '[*] pull-attr-specs))
id-template (identifier-format db :gene/id)
new-data (map (fn [{:keys [from-id product-sequence-name product-biotype]}]
new-data (map (fn [{:keys [from-id product-sequence-name product-biotype product-other-names]}]
(let [from-gene (pull-from-gene from-id)
from-species (:gene/species from-gene)]
{:db/id product-sequence-name
:gene/sequence-name product-sequence-name
:gene/biotype product-biotype
:gene/species (find from-species :species/latin-name)
:gene/status :gene.status/live}))
from-species (:gene/species from-gene)
product {:db/id product-sequence-name
:gene/sequence-name product-sequence-name
:gene/biotype product-biotype
:gene/species (find from-species :species/latin-name)
:gene/status :gene.status/live}]
(if (not (nil? product-other-names))
(assoc product :gene/other-names product-other-names)
product)))
xs)]
(some->> xs
(mapcat (fn [{:keys [from-id new-biotype product-sequence-name]}]
Expand Down
4 changes: 3 additions & 1 deletion src/wormbase/specs/gene.clj
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@
(s/def ::new-biotype (s/nilable :gene/biotype))
(s/def ::product-biotype :gene/biotype)
(s/def ::product-sequence-name :gene/sequence-name)
(s/def ::batch-split-item (s/keys :req-un [::from-id ::new-biotype ::product-sequence-name ::product-biotype]))
(s/def ::product-other-names :gene/other-names)
(s/def ::batch-split-item (s/keys :req-un [::from-id ::new-biotype ::product-sequence-name ::product-biotype]
:opt-un [::product-other-names]))
(s/def ::split-gene-batch (stc/spec
{:spec (s/coll-of ::batch-split-item :min-count 1)
:description "A collection of mappings describing the genes to be split."}))
Expand Down

0 comments on commit bb3df6e

Please sign in to comment.