while getopts ":hd:m:o:" arg; do | while getopts ":hd:m:o:" arg; do | ||||
case "$arg" in | case "$arg" in | ||||
"e") | |||||
"d") | |||||
DATA_FILE="$OPTARG" | DATA_FILE="$OPTARG" | ||||
;; | ;; | ||||
"m") | "m") |
}, | }, | ||||
"ProtQC": { | "ProtQC": { | ||||
"Package": "ProtQC", | "Package": "ProtQC", | ||||
"Version": "0.1.0", | |||||
"Version": "0.1.3", | |||||
"Source": "GitHub", | "Source": "GitHub", | ||||
"RemoteType": "github", | "RemoteType": "github", | ||||
"RemoteHost": "api.github.com", | "RemoteHost": "api.github.com", | ||||
"RemoteRepo": "ProtQC", | "RemoteRepo": "ProtQC", | ||||
"RemoteUsername": "chinese-quartet", | "RemoteUsername": "chinese-quartet", | ||||
"RemoteRef": "v0.1.2", | |||||
"RemoteSha": "22fbe4ad61d183530f737335d7c730de876d85bc", | |||||
"Hash": "6ce010c606427ed07ea8f8925577564c" | |||||
"RemoteRef": "v0.1.3", | |||||
"RemoteSha": "01edb13db10e24e38aa06299bfe7b69e009cd134", | |||||
"Hash": "c5ae657d64a2afd72770effa4767a049" | |||||
}, | }, | ||||
"R6": { | "R6": { | ||||
"Package": "R6", | "Package": "R6", |
# Unpack environment file to the directory, repository/envs/quartet-protqc-report | # Unpack environment file to the directory, repository/envs/quartet-protqc-report | ||||
- step: unpack-env | - step: unpack-env | ||||
envname: quartet-protqc-report | envname: quartet-protqc-report | ||||
postunpack: chmod a+x {{ENV_DEST_DIR}}/quartet-protqc-report/bin/protqc.sh | |||||
- step: load-namespace | - step: load-namespace | ||||
namespace: tservice.plugins.quartet-protqc-report | namespace: tservice.plugins.quartet-protqc-report | ||||
- step: register-plugin | - step: register-plugin |
[spec-tools.core :as st] | [spec-tools.core :as st] | ||||
[clojure.tools.logging :as log] | [clojure.tools.logging :as log] | ||||
[tservice.lib.files :as ff] | [tservice.lib.files :as ff] | ||||
[tservice.api.storage.fs :as fs-api] | |||||
[clojure.string :as clj-str] | |||||
[tservice.lib.fs :as fs-lib] | [tservice.lib.fs :as fs-lib] | ||||
[tservice.vendor.multiqc :as mq] | [tservice.vendor.multiqc :as mq] | ||||
[tservice.plugins.quartet-protqc-report.protqc :as protqc] | [tservice.plugins.quartet-protqc-report.protqc :as protqc] | ||||
(let [payload (merge {:description description} payload) | (let [payload (merge {:description description} payload) | ||||
data-file (protqc/correct-filepath data_file) | data-file (protqc/correct-filepath data_file) | ||||
metadata-file (protqc/correct-filepath metadata_file) | metadata-file (protqc/correct-filepath metadata_file) | ||||
workdir (fs-api/dirname data-file) | |||||
workdir (protqc/dirname data-file) | |||||
log-path (fs-lib/join-paths workdir "log") | log-path (fs-lib/join-paths workdir "log") | ||||
response {:report (format "%s/multireport.html" workdir) | response {:report (format "%s/multireport.html" workdir) | ||||
:log log-path | :log log-path | ||||
:response response}) | :response response}) | ||||
result-dir (fs-lib/join-paths workdir "results")] | result-dir (fs-lib/join-paths workdir "results")] | ||||
(fs-lib/create-directories! result-dir) | (fs-lib/create-directories! result-dir) | ||||
(log/info (format "Create a report %s with %s" name payload)) | |||||
(log/info (format "Create a report %s with %s in %s" name payload workdir)) | |||||
(spit log-path (json/write-str {:status "Running" | (spit log-path (json/write-str {:status "Running" | ||||
:msg ""})) | :msg ""})) | ||||
(update-process! task-id 0) | (update-process! task-id 0) |
(:require [tservice.api.config :refer [add-env-to-path]] | (:require [tservice.api.config :refer [add-env-to-path]] | ||||
[tservice.lib.files :refer [is-localpath?]] | [tservice.lib.files :refer [is-localpath?]] | ||||
[clojure.string :as clj-str] | [clojure.string :as clj-str] | ||||
[clojure.java.shell :as shell :refer [sh]])) | |||||
[clojure.java.shell :as shell :refer [sh]] | |||||
[clojure.java.io :refer [file]])) | |||||
(defn call-protqc! | (defn call-protqc! | ||||
"Call protqc bash script. more details on https://github.com/chinese-quartet/ProtQC | "Call protqc bash script. more details on https://github.com/chinese-quartet/ProtQC | ||||
(if (is-localpath? filepath) | (if (is-localpath? filepath) | ||||
(clj-str/replace filepath #"^file:\/\/" "") | (clj-str/replace filepath #"^file:\/\/" "") | ||||
filepath)) | filepath)) | ||||
(defn ^String basename | |||||
"Returns the basename of 'path'. | |||||
This works by calling getName() on a java.io.File instance. It's prefered | |||||
over last-dir-in-path for that reason. | |||||
Parameters: | |||||
path - String containing the path for an item in iRODS. | |||||
Returns: | |||||
String containing the basename of path." | |||||
[^String path] | |||||
(.getName (file path))) | |||||
(defn ^String dirname | |||||
"Returns the dirname of 'path'. | |||||
This works by calling getParent() on a java.io.File instance. | |||||
Parameters: | |||||
path - String containing the path for an item in iRODS. | |||||
Returns: | |||||
String containing the dirname of path." | |||||
[^String path] | |||||
(when path (.getParent (file path)))) |