|
|
@@ -72,74 +72,9 @@ |
|
|
|
(s/def ::metadata |
|
|
|
(s/coll-of ::metadat-item)) |
|
|
|
|
|
|
|
(s/def ::lab |
|
|
|
(st/spec |
|
|
|
{:spec string? |
|
|
|
:type :string |
|
|
|
:description "Lab name." |
|
|
|
:swagger/default [] |
|
|
|
:reason "The lab_name must be string."})) |
|
|
|
|
|
|
|
(s/def ::sequencing_platform |
|
|
|
(st/spec |
|
|
|
{:spec string? |
|
|
|
:type :string |
|
|
|
:description "Sequencing Platform." |
|
|
|
:swagger/default [] |
|
|
|
:reason "The sequencing_platform must be string."})) |
|
|
|
|
|
|
|
(s/def ::sequencing_method |
|
|
|
(st/spec |
|
|
|
{:spec string? |
|
|
|
:type :string |
|
|
|
:description "Sequencing Method" |
|
|
|
:swagger/default [] |
|
|
|
:reason "The sequencing_method must be string."})) |
|
|
|
|
|
|
|
(s/def ::library_protocol |
|
|
|
(st/spec |
|
|
|
{:spec string? |
|
|
|
:type :string |
|
|
|
:description "Library protocol." |
|
|
|
:swagger/default [] |
|
|
|
:reason "The library_protocol must be string."})) |
|
|
|
|
|
|
|
(s/def ::library_kit |
|
|
|
(st/spec |
|
|
|
{:spec string? |
|
|
|
:type :string |
|
|
|
:description "Library kit." |
|
|
|
:swagger/default [] |
|
|
|
:reason "The library_kit must be string."})) |
|
|
|
|
|
|
|
(s/def ::read_length |
|
|
|
(st/spec |
|
|
|
{:spec string? |
|
|
|
:type :string |
|
|
|
:description "Read length" |
|
|
|
:swagger/default [] |
|
|
|
:reason "The read_length must be string."})) |
|
|
|
|
|
|
|
(s/def ::date |
|
|
|
(st/spec |
|
|
|
{:spec string? |
|
|
|
:type :string |
|
|
|
:description "Date" |
|
|
|
:swagger/default [] |
|
|
|
:reason "The date must be string."})) |
|
|
|
|
|
|
|
(s/def ::parameters |
|
|
|
(s/keys :req-un [::lab |
|
|
|
::sequencing_platform |
|
|
|
::sequencing_method |
|
|
|
::library_protocol |
|
|
|
::library_kit |
|
|
|
::read_length |
|
|
|
::date])) |
|
|
|
|
|
|
|
(def quartet-rna-report-params-body |
|
|
|
"A spec for the body parameters." |
|
|
|
(s/keys :req-un [::name ::description ::filepath ::metadata ::parameters] |
|
|
|
(s/keys :req-un [::name ::description ::filepath ::metadata] |
|
|
|
:opt-un [::description])) |
|
|
|
|
|
|
|
;;; ------------------------------------------------ Event Metadata ------------------------------------------------ |
|
|
@@ -148,7 +83,7 @@ |
|
|
|
{:name "quartet-rnaseq-report" |
|
|
|
:summary "Generate the QC Report for Quartet RNA-Seq data." |
|
|
|
:params-schema quartet-rna-report-params-body |
|
|
|
:handler (fn [{:keys [name description filepath metadata parameters] :as payload}] |
|
|
|
:handler (fn [{:keys [name description filepath metadata] :as payload}] |
|
|
|
(let [workdir (ff/get-workdir) |
|
|
|
report-file (fs-lib/join-paths workdir "multireport.html") |
|
|
|
log-path (fs-lib/join-paths workdir "log") |
|
|
@@ -160,14 +95,17 @@ |
|
|
|
:payload payload |
|
|
|
:plugin-name "quartet-rnaseq-report" |
|
|
|
:plugin-type "ReportPlugin" |
|
|
|
:plugin-version "v0.1.1" |
|
|
|
:plugin-version "v0.1.3" |
|
|
|
:response response})] |
|
|
|
(fs-lib/create-directories! workdir) |
|
|
|
(spit log-path (json/write-str {:status "Running" :msg ""})) |
|
|
|
(update-process! task-id 0) |
|
|
|
(publish-event! "quartet_rnaseq_report" |
|
|
|
{:data-dir filepath |
|
|
|
:parameters parameters |
|
|
|
:parameters {:name name |
|
|
|
:description description |
|
|
|
:plugin-name "quartet-rnaseq-report" |
|
|
|
:plugin-version "v0.1.3"} |
|
|
|
:metadata metadata |
|
|
|
:dest-dir workdir |
|
|
|
:task-id task-id}) |
|
|
@@ -197,9 +135,14 @@ |
|
|
|
(fs-lib/create-directories! files-keep-dir) |
|
|
|
(fs-api/copy-files! files-keep files-keep-dir {:replace-existing true}))) |
|
|
|
|
|
|
|
(defn date |
|
|
|
[] |
|
|
|
(.format (java.text.SimpleDateFormat. "yyyy-MM-dd") |
|
|
|
(new java.util.Date))) |
|
|
|
|
|
|
|
(defn- quartet-rnaseq-report! |
|
|
|
"Chaining Pipeline: filter-files -> copy-files -> merge_exp_file -> exp2qcdt -> multiqc." |
|
|
|
[datadir parameters metadata dest-dir task-id] |
|
|
|
[{:keys [datadir parameters metadata dest-dir task-id]}] |
|
|
|
(log/info "Generate quartet rnaseq report: " datadir parameters metadata dest-dir) |
|
|
|
(let [metadata-file (fs-lib/join-paths dest-dir |
|
|
|
"results" |
|
|
@@ -239,6 +182,13 @@ |
|
|
|
(decompression-tar files-qualimap-RNA-tar)) |
|
|
|
(update-process! task-id 50) |
|
|
|
(gen-multiqc-config config-path) |
|
|
|
(spit parameters-file (json/write-str {"Report Name" (:name parameters) |
|
|
|
"Description" (:description parameters) |
|
|
|
"Report Tool" (format "%s-%s" |
|
|
|
(:plugin-name parameters) |
|
|
|
(:plugin-version parameters)) |
|
|
|
"Team" "Quartet Team" |
|
|
|
"Date" (date)})) |
|
|
|
(let [exp2qcdt-result (exp2qcdt/call-exp2qcdt! exp-fpkm-filepath exp-count-filepath metadata-file result-dir) |
|
|
|
multiqc-result (if (= (:status exp2qcdt-result) "Success") |
|
|
|
(mq/multiqc result-dir dest-dir {:config config-path :template "default" :title "Quartet RNA report"}) |