Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jguhlin committed Jun 15, 2017
1 parent 83ab28b commit 2c1ce49
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/odg/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
"get-biological-processes" (query/biological-processes @config options (rest args))
"get-biological-processes-all-genes" (query/biological-processes-all-genes @config options (rest args))
"get-ipr-terms-all-genes" (query/ipr-terms-all-genes @config options (rest args))
"get-pfam-domains-all-genes" (query/pfam-domains-all-genes @config options (rest args))
"list-species" (query/print-species @config options)

; Testing Fn's
Expand Down
37 changes: 37 additions & 0 deletions src/odg/query.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,43 @@ RETURN
(.write wrtr "\n")
))))))

(defn pfam-domains-all-genes
[config options args]
(db/connect (get-in config [:global :db_path]) (:memory options))

(let [species (:species options)
version (:version options)
version-label (batch/dynamic-label (str species " " version))]

(println "Exporting PFam_Domains members for all Proteins in " species version)

(let [idx (batch/convert-name species version)
output (:output-file options)]
(with-open [wrtr (clojure.java.io/writer (str output "_pfam_domains.tsv"))]
(.write wrtr (clojure.string/join
"\t"
["Gene" "PFam_Domains"]))
(.write wrtr "\n")

; TODO:
; Return Gene ID if it's attached...

(let [q (str "MATCH (x:Protein)-[:HAS_ANALYSIS]-(pfam:PFAM)
WHERE x:`" version-label"`
RETURN DISTINCT x.id, collect(pfam.definition) AS pfam ORDER BY x.id")
results (db/query q {}
(into []
(doall
(map
(fn [x]
[(get x "x.id") (get x "pfam")])
results))))]
; (println q)
(doseq [result results]
(.write wrtr (clojure.string/join "\t" [(first result) (clojure.string/join "|" (distinct (into [] (second result))))]))
(.write wrtr "\n")
))))))

; GO term summary by replicon
;
;MATCH (n:Landmark)
Expand Down

0 comments on commit 2c1ce49

Please sign in to comment.