Skip to content

Commit

Permalink
fixing 500 error caused when it is an insertion but we don't know the…
Browse files Browse the repository at this point in the history
… inserted sequence
  • Loading branch information
adamjohnwright committed Jun 13, 2019
1 parent 64426dd commit 736e1da
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
22 changes: 12 additions & 10 deletions src/rest_api/classes/pcr_oligo/widgets/sequence.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@
[rest-api.classes.generic-fields :as generic]
[rest-api.formatters.object :as obj :refer [pack-obj]]))

; tested with WBPaper00006202_Y41D4B_1.1
(defn segment [p]
{:data (when-let [refseqobj (sequence-fns/genomic-obj p)]
(let [s (sequence-fns/get-sequence refseqobj)]
{:dna s
:length (count s)
:start (:start refseqobj)
:stop (:stop refseqobj)
:end (:stop refseqobj)
:ref (:seqname refseqobj)
:refseq (:seqname refseqobj)}))
{:data (if (contains? p :oligo/id);e.g. OK2488_external_b
{:dna (:oligo/sequence p)
:length (:oligo/length p)}
(when-let [refseqobj (sequence-fns/genomic-obj p)] ;e.g. cenix:10-b12
(let [s (sequence-fns/get-sequence refseqobj)]
{:dna s
:length (count s)
:start (:start refseqobj)
:stop (:stop refseqobj)
:end (:stop refseqobj)
:ref (:seqname refseqobj)
:refseq (:seqname refseqobj)})))
:description "Sequence/segment data about this PCR product"})

(defn oligos [p]
Expand Down
22 changes: 13 additions & 9 deletions src/rest_api/classes/variation/widgets/molecular_details.clj
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,11 @@

length-change (if-let [insertion (:variation/insertion variation)]
(or (if-let [insertion-str (let [insertion (or (:variation.insertion/text insertion)
(:transposon-family/id
(first
(:variation/transposon-insertion variation))))]
(or
(:transposon-family/id
(first
(:variation/transposon-insertion variation)))
"-"))]
(if (= insertion "Mos") "<Mos>" insertion))]
(if (contains? variation :variation/deletion)
(- (count insertion-str)
Expand Down Expand Up @@ -415,12 +417,14 @@
(contains? variation :variation/insertion)
(let [insertion (:variation/insertion variation)
insert-str (or (if-let [insert-value (:variation.insertion/text insertion)]
(if (= strand "+")
insert-value
(generic-functions/dna-reverse-complement insert-value)))
(:transposon-family/id
(first
(:variation/transposon-insertion variation))))]
(if (= strand "+")
insert-value
(generic-functions/dna-reverse-complement insert-value)))
(or
(:transposon-family/id
(first
(:variation/transposon-insertion variation)))
"-"))]
(str/replace
(:sequence wildtype-positive)
#"\-+"
Expand Down

0 comments on commit 736e1da

Please sign in to comment.