Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjohnwright committed May 9, 2019
2 parents 21dd5ca + 59cc313 commit 06e3593
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 170 deletions.
2 changes: 1 addition & 1 deletion src/rest_api/classes/cds.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{:overview overview/widget
:location location/widget
:feature feature/widget
;:sequences sequences/widget
:sequences sequences/widget
:reagents reagents/widget
:external_links external-links/widget
:references references/widget}
Expand Down
1 change: 0 additions & 1 deletion src/rest_api/classes/cds/widgets/overview.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

(defn description [cds]
{:data (:cds.detailed-description/text (first (:cds/detailed-description cds)))
:d (:db/id cds)
:description (str "description of the CDS " (:cds/id cds))})

(defn partial-field [cds]
Expand Down
25 changes: 8 additions & 17 deletions src/rest_api/classes/cds/widgets/sequences.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@
[rest-api.classes.generic-functions :as generic-functions]
[rest-api.formatters.object :as obj :refer [pack-obj]]))

(defn unspliced-sequence-context [c]
{:data (when-let [transcript (-> c
(defn cds-sequence [c]
{:data (when-let [transcript (or
(-> c
:transcript.corresponding-cds/_cds
first
:transcript/_corresponding-cds)]
(sequence-fns/transcript-sequence-features transcript 0 "unspliced"))
:description "the unpliced sequence of the sequence"})

(defn spliced-sequence-context [c]
{:data (when-let [transcript (-> c
:transcript.corresponding-cds/_cds
first
:transcript/_corresponding-cds)]
(sequence-fns/transcript-sequence-features transcript 0 "spliced"))
:description "the unpliced sequence of the sequence"})
:transcript/_corresponding-cds)
c)]
(sequence-fns/transcript-sequence-features transcript 0 :cds))
:description "the spliced sequence of the transcripts without UTR"})

(defn protein-sequence [c]
{:data (when-let [peptide (some->> (:cds/corresponding-protein c)
Expand All @@ -46,9 +40,6 @@

(def widget
{:name generic/name-field
:predicted_exon_structure generic/predicted-exon-structure
:print_blast print-blast
:protein_sequence protein-sequence
:predicted_unit generic/predicted-units
:unspliced_sequence_context unspliced-sequence-context
:spliced_sequence_context spliced-sequence-context})
:cds_sequence cds-sequence})
44 changes: 28 additions & 16 deletions src/rest_api/classes/generic_fields.clj
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@
[(some->> (:cds.corresponding-protein/_protein object)
(map :cds/_corresponding-protein)
(filter #(not= "history" (:method/id (:locatable/method %))))
(map :gene.corresponding-cds/_cds)
first
(map :gene/_corresponding-cds))
first)
"gene"]

:else
Expand Down Expand Up @@ -535,19 +533,33 @@
(corresponding-all-gene gene object role nil))))

"cds"
(when-let [ths (:transcript.corresponding-cds/_cds object)]
(let [genes
(distinct
(flatten
(for [th ths
:let [ghs (:gene.corresponding-transcript/_transcript
(:transcript/_corresponding-cds th))]]
(for [gh ghs
:let [gene (:gene/_corresponding-transcript gh)]]
gene))))]
(flatten
(for [gene genes]
(corresponding-all-gene gene object role nil)))))
(or
(when-let [ths (:transcript.corresponding-cds/_cds object)]
(let [genes
(distinct
(flatten
(for [th ths
:let [ghs (:gene.corresponding-transcript/_transcript
(:transcript/_corresponding-cds th))]]
(for [gh ghs
:let [gene (:gene/_corresponding-transcript gh)]]
gene))))]
(flatten
(for [gene genes]
(corresponding-all-gene gene object role nil)))))
(when-let [ths (:transposon.corresponding-cds/_cds object)]
(let [genes
(distinct
(flatten
(for [th ths
:let [ghs (:gene.corresponding-transposon/_transposon
(:transposon/_corresponding-cds th))]]
(for [gh ghs
:let [gene (:gene/_corresponding-transposon gh)]]
gene))))]
(flatten
(for [gene genes]
(corresponding-all-gene gene object role nil))))))

"protein" ;; need to make it filter for only the row with the protein
(when-let [cdshs (:cds.corresponding-protein/_protein object)]
Expand Down
2 changes: 1 addition & 1 deletion src/rest_api/classes/pseudogene.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
:feature feature/widget
:genetics genetics/widget
:reagents reagents/widget
;:sequences sequences/widget
:sequences sequences/widget
:expression expression/widget
:location location/widget
}
Expand Down
4 changes: 2 additions & 2 deletions src/rest_api/classes/pseudogene/widgets/sequences.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(name strand-kw))
:description "strand orientation of the sequence"})

(defn print-sequence [p]
(defn sequence-context [p]
{:data (when-let [refseqobj (sequence-fns/genomic-obj p)]
(when-let [dna-sequence (sequence-fns/get-sequence refseqobj)]
(let [strand (if-let [strand-kw (:locatable/strand p)]
Expand All @@ -36,4 +36,4 @@
{:name generic/name-field
:predicted_exon_structure generic/predicted-exon-structure
:strand strand
:print_sequence print-sequence})
:sequence_context sequence-context})
Loading

0 comments on commit 06e3593

Please sign in to comment.