/target | |||||
/classes | |||||
/checkouts | |||||
pom.xml | |||||
pom.xml.asc | |||||
*.jar | |||||
*.class | |||||
/.lein-* | |||||
/.nrepl-port | |||||
.hgignore | |||||
.hg/ |
Eclipse Public License - v 2.0 | |||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE | |||||
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION | |||||
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. | |||||
1. DEFINITIONS | |||||
"Contribution" means: | |||||
a) in the case of the initial Contributor, the initial content | |||||
Distributed under this Agreement, and | |||||
b) in the case of each subsequent Contributor: | |||||
i) changes to the Program, and | |||||
ii) additions to the Program; | |||||
where such changes and/or additions to the Program originate from | |||||
and are Distributed by that particular Contributor. A Contribution | |||||
"originates" from a Contributor if it was added to the Program by | |||||
such Contributor itself or anyone acting on such Contributor's behalf. | |||||
Contributions do not include changes or additions to the Program that | |||||
are not Modified Works. | |||||
"Contributor" means any person or entity that Distributes the Program. | |||||
"Licensed Patents" mean patent claims licensable by a Contributor which | |||||
are necessarily infringed by the use or sale of its Contribution alone | |||||
or when combined with the Program. | |||||
"Program" means the Contributions Distributed in accordance with this | |||||
Agreement. | |||||
"Recipient" means anyone who receives the Program under this Agreement | |||||
or any Secondary License (as applicable), including Contributors. | |||||
"Derivative Works" shall mean any work, whether in Source Code or other | |||||
form, that is based on (or derived from) the Program and for which the | |||||
editorial revisions, annotations, elaborations, or other modifications | |||||
represent, as a whole, an original work of authorship. | |||||
"Modified Works" shall mean any work in Source Code or other form that | |||||
results from an addition to, deletion from, or modification of the | |||||
contents of the Program, including, for purposes of clarity any new file | |||||
in Source Code form that contains any contents of the Program. Modified | |||||
Works shall not include works that contain only declarations, | |||||
interfaces, types, classes, structures, or files of the Program solely | |||||
in each case in order to link to, bind by name, or subclass the Program | |||||
or Modified Works thereof. | |||||
"Distribute" means the acts of a) distributing or b) making available | |||||
in any manner that enables the transfer of a copy. | |||||
"Source Code" means the form of a Program preferred for making | |||||
modifications, including but not limited to software source code, | |||||
documentation source, and configuration files. | |||||
"Secondary License" means either the GNU General Public License, | |||||
Version 2.0, or any later versions of that license, including any | |||||
exceptions or additional permissions as identified by the initial | |||||
Contributor. | |||||
2. GRANT OF RIGHTS | |||||
a) Subject to the terms of this Agreement, each Contributor hereby | |||||
grants Recipient a non-exclusive, worldwide, royalty-free copyright | |||||
license to reproduce, prepare Derivative Works of, publicly display, | |||||
publicly perform, Distribute and sublicense the Contribution of such | |||||
Contributor, if any, and such Derivative Works. | |||||
b) Subject to the terms of this Agreement, each Contributor hereby | |||||
grants Recipient a non-exclusive, worldwide, royalty-free patent | |||||
license under Licensed Patents to make, use, sell, offer to sell, | |||||
import and otherwise transfer the Contribution of such Contributor, | |||||
if any, in Source Code or other form. This patent license shall | |||||
apply to the combination of the Contribution and the Program if, at | |||||
the time the Contribution is added by the Contributor, such addition | |||||
of the Contribution causes such combination to be covered by the | |||||
Licensed Patents. The patent license shall not apply to any other | |||||
combinations which include the Contribution. No hardware per se is | |||||
licensed hereunder. | |||||
c) Recipient understands that although each Contributor grants the | |||||
licenses to its Contributions set forth herein, no assurances are | |||||
provided by any Contributor that the Program does not infringe the | |||||
patent or other intellectual property rights of any other entity. | |||||
Each Contributor disclaims any liability to Recipient for claims | |||||
brought by any other entity based on infringement of intellectual | |||||
property rights or otherwise. As a condition to exercising the | |||||
rights and licenses granted hereunder, each Recipient hereby | |||||
assumes sole responsibility to secure any other intellectual | |||||
property rights needed, if any. For example, if a third party | |||||
patent license is required to allow Recipient to Distribute the | |||||
Program, it is Recipient's responsibility to acquire that license | |||||
before distributing the Program. | |||||
d) Each Contributor represents that to its knowledge it has | |||||
sufficient copyright rights in its Contribution, if any, to grant | |||||
the copyright license set forth in this Agreement. | |||||
e) Notwithstanding the terms of any Secondary License, no | |||||
Contributor makes additional grants to any Recipient (other than | |||||
those set forth in this Agreement) as a result of such Recipient's | |||||
receipt of the Program under the terms of a Secondary License | |||||
(if permitted under the terms of Section 3). | |||||
3. REQUIREMENTS | |||||
3.1 If a Contributor Distributes the Program in any form, then: | |||||
a) the Program must also be made available as Source Code, in | |||||
accordance with section 3.2, and the Contributor must accompany | |||||
the Program with a statement that the Source Code for the Program | |||||
is available under this Agreement, and informs Recipients how to | |||||
obtain it in a reasonable manner on or through a medium customarily | |||||
used for software exchange; and | |||||
b) the Contributor may Distribute the Program under a license | |||||
different than this Agreement, provided that such license: | |||||
i) effectively disclaims on behalf of all other Contributors all | |||||
warranties and conditions, express and implied, including | |||||
warranties or conditions of title and non-infringement, and | |||||
implied warranties or conditions of merchantability and fitness | |||||
for a particular purpose; | |||||
ii) effectively excludes on behalf of all other Contributors all | |||||
liability for damages, including direct, indirect, special, | |||||
incidental and consequential damages, such as lost profits; | |||||
iii) does not attempt to limit or alter the recipients' rights | |||||
in the Source Code under section 3.2; and | |||||
iv) requires any subsequent distribution of the Program by any | |||||
party to be under a license that satisfies the requirements | |||||
of this section 3. | |||||
3.2 When the Program is Distributed as Source Code: | |||||
a) it must be made available under this Agreement, or if the | |||||
Program (i) is combined with other material in a separate file or | |||||
files made available under a Secondary License, and (ii) the initial | |||||
Contributor attached to the Source Code the notice described in | |||||
Exhibit A of this Agreement, then the Program may be made available | |||||
under the terms of such Secondary Licenses, and | |||||
b) a copy of this Agreement must be included with each copy of | |||||
the Program. | |||||
3.3 Contributors may not remove or alter any copyright, patent, | |||||
trademark, attribution notices, disclaimers of warranty, or limitations | |||||
of liability ("notices") contained within the Program from any copy of | |||||
the Program which they Distribute, provided that Contributors may add | |||||
their own appropriate notices. | |||||
4. COMMERCIAL DISTRIBUTION | |||||
Commercial distributors of software may accept certain responsibilities | |||||
with respect to end users, business partners and the like. While this | |||||
license is intended to facilitate the commercial use of the Program, | |||||
the Contributor who includes the Program in a commercial product | |||||
offering should do so in a manner which does not create potential | |||||
liability for other Contributors. Therefore, if a Contributor includes | |||||
the Program in a commercial product offering, such Contributor | |||||
("Commercial Contributor") hereby agrees to defend and indemnify every | |||||
other Contributor ("Indemnified Contributor") against any losses, | |||||
damages and costs (collectively "Losses") arising from claims, lawsuits | |||||
and other legal actions brought by a third party against the Indemnified | |||||
Contributor to the extent caused by the acts or omissions of such | |||||
Commercial Contributor in connection with its distribution of the Program | |||||
in a commercial product offering. The obligations in this section do not | |||||
apply to any claims or Losses relating to any actual or alleged | |||||
intellectual property infringement. In order to qualify, an Indemnified | |||||
Contributor must: a) promptly notify the Commercial Contributor in | |||||
writing of such claim, and b) allow the Commercial Contributor to control, | |||||
and cooperate with the Commercial Contributor in, the defense and any | |||||
related settlement negotiations. The Indemnified Contributor may | |||||
participate in any such claim at its own expense. | |||||
For example, a Contributor might include the Program in a commercial | |||||
product offering, Product X. That Contributor is then a Commercial | |||||
Contributor. If that Commercial Contributor then makes performance | |||||
claims, or offers warranties related to Product X, those performance | |||||
claims and warranties are such Commercial Contributor's responsibility | |||||
alone. Under this section, the Commercial Contributor would have to | |||||
defend claims against the other Contributors related to those performance | |||||
claims and warranties, and if a court requires any other Contributor to | |||||
pay any damages as a result, the Commercial Contributor must pay | |||||
those damages. | |||||
5. NO WARRANTY | |||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT | |||||
PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" | |||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR | |||||
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF | |||||
TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR | |||||
PURPOSE. Each Recipient is solely responsible for determining the | |||||
appropriateness of using and distributing the Program and assumes all | |||||
risks associated with its exercise of rights under this Agreement, | |||||
including but not limited to the risks and costs of program errors, | |||||
compliance with applicable laws, damage to or loss of data, programs | |||||
or equipment, and unavailability or interruption of operations. | |||||
6. DISCLAIMER OF LIABILITY | |||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT | |||||
PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS | |||||
SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST | |||||
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||||
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE | |||||
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE | |||||
POSSIBILITY OF SUCH DAMAGES. | |||||
7. GENERAL | |||||
If any provision of this Agreement is invalid or unenforceable under | |||||
applicable law, it shall not affect the validity or enforceability of | |||||
the remainder of the terms of this Agreement, and without further | |||||
action by the parties hereto, such provision shall be reformed to the | |||||
minimum extent necessary to make such provision valid and enforceable. | |||||
If Recipient institutes patent litigation against any entity | |||||
(including a cross-claim or counterclaim in a lawsuit) alleging that the | |||||
Program itself (excluding combinations of the Program with other software | |||||
or hardware) infringes such Recipient's patent(s), then such Recipient's | |||||
rights granted under Section 2(b) shall terminate as of the date such | |||||
litigation is filed. | |||||
All Recipient's rights under this Agreement shall terminate if it | |||||
fails to comply with any of the material terms or conditions of this | |||||
Agreement and does not cure such failure in a reasonable period of | |||||
time after becoming aware of such noncompliance. If all Recipient's | |||||
rights under this Agreement terminate, Recipient agrees to cease use | |||||
and distribution of the Program as soon as reasonably practicable. | |||||
However, Recipient's obligations under this Agreement and any licenses | |||||
granted by Recipient relating to the Program shall continue and survive. | |||||
Everyone is permitted to copy and distribute copies of this Agreement, | |||||
but in order to avoid inconsistency the Agreement is copyrighted and | |||||
may only be modified in the following manner. The Agreement Steward | |||||
reserves the right to publish new versions (including revisions) of | |||||
this Agreement from time to time. No one other than the Agreement | |||||
Steward has the right to modify this Agreement. The Eclipse Foundation | |||||
is the initial Agreement Steward. The Eclipse Foundation may assign the | |||||
responsibility to serve as the Agreement Steward to a suitable separate | |||||
entity. Each new version of the Agreement will be given a distinguishing | |||||
version number. The Program (including Contributions) may always be | |||||
Distributed subject to the version of the Agreement under which it was | |||||
received. In addition, after a new version of the Agreement is published, | |||||
Contributor may elect to Distribute the Program (including its | |||||
Contributions) under the new version. | |||||
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient | |||||
receives no rights or licenses to the intellectual property of any | |||||
Contributor under this Agreement, whether expressly, by implication, | |||||
estoppel or otherwise. All rights in the Program not expressly granted | |||||
under this Agreement are reserved. Nothing in this Agreement is intended | |||||
to be enforceable by any entity that is not a Contributor or Recipient. | |||||
No third-party beneficiary rights are created under this Agreement. | |||||
Exhibit A - Form of Secondary Licenses Notice | |||||
"This Source Code may also be made available under the following | |||||
Secondary Licenses when the conditions for such availability set forth | |||||
in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), | |||||
version(s), and exceptions or additional permissions here}." | |||||
Simply including a copy of this Agreement, including this Exhibit A | |||||
is not sufficient to license the Source Code under Secondary Licenses. | |||||
If it is not possible or desirable to put the notice in a particular | |||||
file, then You may include the notice in a location (such as a LICENSE | |||||
file in a relevant directory) where a recipient would be likely to | |||||
look for such a notice. | |||||
You may add additional accurate notices of copyright ownership. |
# quartet-metqc-report | |||||
FIXME: description | |||||
## Installation | |||||
Download from http://example.com/FIXME. | |||||
## Usage | |||||
FIXME: explanation | |||||
## Options | |||||
FIXME: listing of options this app accepts. | |||||
## Examples | |||||
... | |||||
### Bugs | |||||
... | |||||
### Any Other Sections | |||||
### That You Think | |||||
### Might be Useful | |||||
## License | |||||
Copyright © 2021 FIXME | |||||
This program and the accompanying materials are made available under the | |||||
terms of the Eclipse Public License 2.0 which is available at | |||||
http://www.eclipse.org/legal/epl-2.0. | |||||
This Source Code may also be made available under the following Secondary | |||||
Licenses when the conditions for such availability set forth in the Eclipse | |||||
Public License, v. 2.0 are satisfied: GNU General Public License as published by | |||||
the Free Software Foundation, either version 2 of the License, or (at your | |||||
option) any later version, with the GNU Classpath Exception which is available | |||||
at https://www.gnu.org/software/classpath/license.html. |
(defproject tservice/quartet-metqc-report "v0.1.0" | |||||
:description "Visualizes Quality Control(QC) results for Quartet Project." | |||||
:url "https://github.com/tservice-plugins/quartet-metqc-report" | |||||
:license {:name "Eclipse Public License" | |||||
:url "http://www.eclipse.org/legal/epl-v10.html"} | |||||
:min-lein-version "2.5.0" | |||||
:deployable false | |||||
:dependencies | |||||
[[org.clojure/data.csv "1.0.0"] | |||||
[me.raynes/fs "1.4.6"] | |||||
[org.clojure/tools.logging "1.1.0"] | |||||
[org.clojure/core.async "0.4.500" | |||||
:exclusions [org.clojure/tools.reader]]] | |||||
:profiles | |||||
{:provided | |||||
{:dependencies | |||||
[[org.clojure/clojure "1.10.1"] | |||||
[org.clojars.yjcyxky/tservice "0.5.8"]]} | |||||
:uberjar | |||||
{:auto-clean true | |||||
:aot :all | |||||
:omit-source true | |||||
:javac-options ["-target" "1.8", "-source" "1.8"] | |||||
:target-path "target/%s" | |||||
:resource-paths ["resources"] | |||||
:uberjar-name "quartet-metqc-report.tservice-plugin.jar"}}) |
source("renv/activate.R") |
{} |
#!/usr/bin/env bash | |||||
# A wrapper for metqc r package | |||||
# | |||||
# Author: Jingcheng Yang | |||||
# Email: yjcyxky@163.com | |||||
# | |||||
# License: MIT | |||||
# Exit on error. Append "|| true" if you expect an error. | |||||
# set -o errexit | |||||
# Exit on error inside any functions or subshells. | |||||
# set -o errtrace | |||||
# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR | |||||
set -o nounset | |||||
# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip` | |||||
set -o pipefail | |||||
# Turn on traces, useful while debugging but commented out by default | |||||
# set -o xtrace | |||||
show_help() { | |||||
cat <<EOF | |||||
usage: $(echo $0) [-d <DATA_FILE>] [-m <META_FILE>] [-o <RESULT_DIR>] | |||||
-d DATA_FILE Proteomics profiled data. | |||||
-m META_FILE Metadata file. | |||||
-o RESULT_DIR A directory for result files. | |||||
EOF | |||||
} | |||||
while getopts ":hd:m:o:" arg; do | |||||
case "$arg" in | |||||
"d") | |||||
DATA_FILE="$OPTARG" | |||||
;; | |||||
"m") | |||||
META_FILE="$OPTARG" | |||||
;; | |||||
"o") | |||||
RESULT_DIR="$OPTARG" | |||||
;; | |||||
"?") | |||||
echo "Unkown option: $OPTARG" | |||||
exit 1 | |||||
;; | |||||
":") | |||||
echo "No argument value for option $OPTARG" | |||||
;; | |||||
h) | |||||
show_help | |||||
exit 0 | |||||
;; | |||||
*) | |||||
echo "Unknown error while processing options" | |||||
show_help | |||||
exit 1 | |||||
;; | |||||
esac | |||||
done | |||||
if [ -z "$DATA_FILE" ]; then | |||||
echo "-d argument is not specified." | |||||
exit 1 | |||||
elif [ ! -f "$DATA_FILE" ]; then | |||||
echo "$DATA_FILE is not a valid file." | |||||
exit 1 | |||||
else | |||||
DATA_FILE=$(realpath $DATA_FILE) | |||||
fi | |||||
if [ -z "$META_FILE" ]; then | |||||
echo "-m argument is not specified." | |||||
exit 1 | |||||
elif [ ! -f "$META_FILE" ]; then | |||||
echo "$META_FILE is not a valid file." | |||||
exit 1 | |||||
else | |||||
META_FILE=$(realpath $META_FILE) | |||||
fi | |||||
if [ -z "$RESULT_DIR" ]; then | |||||
echo "-o argument is not specified." | |||||
exit 1 | |||||
elif [ ! -d "$RESULT_DIR" ]; then | |||||
echo "$RESULT_DIR is not a valid directory." | |||||
exit 1 | |||||
else | |||||
RESULT_DIR=$(realpath $RESULT_DIR) | |||||
fi | |||||
TEMP=$(mktemp) | |||||
echo "Run script: $TEMP" | |||||
cat <<EOF >"$TEMP" | |||||
#!/usr/bin/env Rscript | |||||
run <- function() { | |||||
# Print traceback message | |||||
on.exit(traceback()) | |||||
library(MetQC) | |||||
print("Running...") | |||||
MetQC::GetPerformance(dt.path="$DATA_FILE", metadata.path="$META_FILE", output.path="$RESULT_DIR") | |||||
MetQC::CountSNR(dt.path="$DATA_FILE", metadata.path="$META_FILE", output.path="$RESULT_DIR") | |||||
MetQC::CountCTR(dt.path="$DATA_FILE", metadata.path="$META_FILE", output.path="$RESULT_DIR") | |||||
} | |||||
run() | |||||
EOF | |||||
printf "\n---------------------\n" | |||||
cat "$TEMP" | |||||
echo "---------------------" | |||||
Rscript $TEMP |
{ | |||||
"R": { | |||||
"Version": "3.6.3", | |||||
"Repositories": [ | |||||
{ | |||||
"Name": "CRAN", | |||||
"URL": "https://cloud.r-project.org" | |||||
} | |||||
] | |||||
}, | |||||
"Packages": { | |||||
"KernSmooth": { | |||||
"Package": "KernSmooth", | |||||
"Version": "2.23-16", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "997471f25a7ed6c782f0090ce52cc63a" | |||||
}, | |||||
"MASS": { | |||||
"Package": "MASS", | |||||
"Version": "7.3-51.5", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "9efe80472b21189ebab1b74169808c26" | |||||
}, | |||||
"Matrix": { | |||||
"Package": "Matrix", | |||||
"Version": "1.2-18", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "08588806cba69f04797dab50627428ed" | |||||
}, | |||||
"MetQC": { | |||||
"Package": "MetQC", | |||||
"Version": "0.3.5", | |||||
"Source": "GitHub", | |||||
"RemoteType": "github", | |||||
"RemoteHost": "api.github.com", | |||||
"RemoteRepo": "MetQC", | |||||
"RemoteUsername": "chinese-quartet", | |||||
"RemoteRef": "v0.3.5", | |||||
"RemoteSha": "73c0f17fee22985a16ca6d670ddeb4b2af462fd7", | |||||
"Hash": "7f59a7bebf21b695a35f212db3f23f9a" | |||||
}, | |||||
"R6": { | |||||
"Package": "R6", | |||||
"Version": "2.5.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "470851b6d5d0ac559e9d01bb352b4021" | |||||
}, | |||||
"RColorBrewer": { | |||||
"Package": "RColorBrewer", | |||||
"Version": "1.1-2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "e031418365a7f7a766181ab5a41a5716" | |||||
}, | |||||
"askpass": { | |||||
"Package": "askpass", | |||||
"Version": "1.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "e8a22846fff485f0be3770c2da758713" | |||||
}, | |||||
"boot": { | |||||
"Package": "boot", | |||||
"Version": "1.3-25", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "bd51734a754b6c2baf28b2d1ebc11e91" | |||||
}, | |||||
"brew": { | |||||
"Package": "brew", | |||||
"Version": "1.0-6", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "92a5f887f9ae3035ac7afde22ba73ee9" | |||||
}, | |||||
"brio": { | |||||
"Package": "brio", | |||||
"Version": "1.1.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "2f01e16ff9571fe70381c7b9ae560dc4" | |||||
}, | |||||
"cachem": { | |||||
"Package": "cachem", | |||||
"Version": "1.0.6", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "648c5b3d71e6a37e3043617489a0a0e9" | |||||
}, | |||||
"callr": { | |||||
"Package": "callr", | |||||
"Version": "3.7.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "461aa75a11ce2400245190ef5d3995df" | |||||
}, | |||||
"class": { | |||||
"Package": "class", | |||||
"Version": "7.3-15", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "4fba6a022803b6c3f30fd023be3fa818" | |||||
}, | |||||
"cli": { | |||||
"Package": "cli", | |||||
"Version": "3.0.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "e3ae5d68dea0c55a12ea12a9fda02e61" | |||||
}, | |||||
"clipr": { | |||||
"Package": "clipr", | |||||
"Version": "0.7.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ebaa97ac99cc2daf04e77eecc7b781d7" | |||||
}, | |||||
"cluster": { | |||||
"Package": "cluster", | |||||
"Version": "2.1.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "db63a44aab5aadcb6bf2f129751d129a" | |||||
}, | |||||
"codetools": { | |||||
"Package": "codetools", | |||||
"Version": "0.2-16", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "89cf4b8207269ccf82fbeb6473fd662b" | |||||
}, | |||||
"colorspace": { | |||||
"Package": "colorspace", | |||||
"Version": "2.0-2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "6baccb763ee83c0bd313460fdb8b8a84" | |||||
}, | |||||
"commonmark": { | |||||
"Package": "commonmark", | |||||
"Version": "1.7", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "0f22be39ec1d141fd03683c06f3a6e67" | |||||
}, | |||||
"cpp11": { | |||||
"Package": "cpp11", | |||||
"Version": "0.3.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "e02edab2bc389c5e4b12949b13df44f2" | |||||
}, | |||||
"crayon": { | |||||
"Package": "crayon", | |||||
"Version": "1.4.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "e75525c55c70e5f4f78c9960a4b402e9" | |||||
}, | |||||
"credentials": { | |||||
"Package": "credentials", | |||||
"Version": "1.3.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "db9463f8f96444ac790bef2076048699" | |||||
}, | |||||
"curl": { | |||||
"Package": "curl", | |||||
"Version": "4.3.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "022c42d49c28e95d69ca60446dbabf88" | |||||
}, | |||||
"data.table": { | |||||
"Package": "data.table", | |||||
"Version": "1.14.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "d1b8b1a821ee564a3515fa6c6d5c52dc" | |||||
}, | |||||
"desc": { | |||||
"Package": "desc", | |||||
"Version": "1.3.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "b6963166f7f10b970af1006c462ce6cd" | |||||
}, | |||||
"devtools": { | |||||
"Package": "devtools", | |||||
"Version": "2.4.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "048d0b914d2cea61f440d35dd3cbddac" | |||||
}, | |||||
"diffobj": { | |||||
"Package": "diffobj", | |||||
"Version": "0.3.4", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "feb5b7455eba422a2c110bb89852e6a3" | |||||
}, | |||||
"digest": { | |||||
"Package": "digest", | |||||
"Version": "0.6.27", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "a0cbe758a531d054b537d16dff4d58a1" | |||||
}, | |||||
"ellipsis": { | |||||
"Package": "ellipsis", | |||||
"Version": "0.3.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "bb0eec2fe32e88d9e2836c2f73ea2077" | |||||
}, | |||||
"evaluate": { | |||||
"Package": "evaluate", | |||||
"Version": "0.14", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ec8ca05cffcc70569eaaad8469d2a3a7" | |||||
}, | |||||
"fansi": { | |||||
"Package": "fansi", | |||||
"Version": "0.5.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "d447b40982c576a72b779f0a3b3da227" | |||||
}, | |||||
"farver": { | |||||
"Package": "farver", | |||||
"Version": "2.1.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "c98eb5133d9cb9e1622b8691487f11bb" | |||||
}, | |||||
"fastmap": { | |||||
"Package": "fastmap", | |||||
"Version": "1.1.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "77bd60a6157420d4ffa93b27cf6a58b8" | |||||
}, | |||||
"foreign": { | |||||
"Package": "foreign", | |||||
"Version": "0.8-75", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "9a7efaa7320b9f327a904d1e615b0b46" | |||||
}, | |||||
"fs": { | |||||
"Package": "fs", | |||||
"Version": "1.5.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "44594a07a42e5f91fac9f93fda6d0109" | |||||
}, | |||||
"gert": { | |||||
"Package": "gert", | |||||
"Version": "1.3.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "72b34cde959b806e86cb99fc12d1ba58" | |||||
}, | |||||
"ggplot2": { | |||||
"Package": "ggplot2", | |||||
"Version": "3.3.5", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "d7566c471c7b17e095dd023b9ef155ad" | |||||
}, | |||||
"gh": { | |||||
"Package": "gh", | |||||
"Version": "1.3.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "38c2580abbda249bd6afeec00d14f531" | |||||
}, | |||||
"gitcreds": { | |||||
"Package": "gitcreds", | |||||
"Version": "0.1.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "f3aefccc1cc50de6338146b62f115de8" | |||||
}, | |||||
"glue": { | |||||
"Package": "glue", | |||||
"Version": "1.4.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "6efd734b14c6471cfe443345f3e35e29" | |||||
}, | |||||
"gtable": { | |||||
"Package": "gtable", | |||||
"Version": "0.3.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ac5c6baf7822ce8732b343f14c072c4d" | |||||
}, | |||||
"highr": { | |||||
"Package": "highr", | |||||
"Version": "0.9", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "8eb36c8125038e648e5d111c0d7b2ed4" | |||||
}, | |||||
"httr": { | |||||
"Package": "httr", | |||||
"Version": "1.4.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "a525aba14184fec243f9eaec62fbed43" | |||||
}, | |||||
"ini": { | |||||
"Package": "ini", | |||||
"Version": "0.3.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "6154ec2223172bce8162d4153cda21f7" | |||||
}, | |||||
"isoband": { | |||||
"Package": "isoband", | |||||
"Version": "0.2.5", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "7ab57a6de7f48a8dc84910d1eca42883" | |||||
}, | |||||
"jsonlite": { | |||||
"Package": "jsonlite", | |||||
"Version": "1.7.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "98138e0994d41508c7a6b84a0600cfcb" | |||||
}, | |||||
"knitr": { | |||||
"Package": "knitr", | |||||
"Version": "1.34", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "aa958054ac6f0360926bb952ea302f0f" | |||||
}, | |||||
"labeling": { | |||||
"Package": "labeling", | |||||
"Version": "0.4.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "3d5108641f47470611a32d0bdf357a72" | |||||
}, | |||||
"lattice": { | |||||
"Package": "lattice", | |||||
"Version": "0.20-38", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "848f8c593fd1050371042d18d152e3d7" | |||||
}, | |||||
"lifecycle": { | |||||
"Package": "lifecycle", | |||||
"Version": "1.0.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "3471fb65971f1a7b2d4ae7848cf2db8d" | |||||
}, | |||||
"magrittr": { | |||||
"Package": "magrittr", | |||||
"Version": "2.0.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "41287f1ac7d28a92f0a286ed507928d3" | |||||
}, | |||||
"memoise": { | |||||
"Package": "memoise", | |||||
"Version": "2.0.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "a0bc51650201a56d00a4798523cc91b3" | |||||
}, | |||||
"mgcv": { | |||||
"Package": "mgcv", | |||||
"Version": "1.8-31", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "4bb7e0c4f3557583e1e8d3c9ffb8ba5c" | |||||
}, | |||||
"mime": { | |||||
"Package": "mime", | |||||
"Version": "0.11", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "8974a907200fc9948d636fe7d85ca9fb" | |||||
}, | |||||
"munsell": { | |||||
"Package": "munsell", | |||||
"Version": "0.5.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "6dfe8bf774944bd5595785e3229d8771" | |||||
}, | |||||
"nlme": { | |||||
"Package": "nlme", | |||||
"Version": "3.1-144", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "e80d41932d3cc235ccbbbb9732ae162e" | |||||
}, | |||||
"nnet": { | |||||
"Package": "nnet", | |||||
"Version": "7.3-12", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "68287aec1f476c41d16ce1ace445800c" | |||||
}, | |||||
"openssl": { | |||||
"Package": "openssl", | |||||
"Version": "1.4.5", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "5406fd37ef0bf9b88c8a4f264d6ec220" | |||||
}, | |||||
"pillar": { | |||||
"Package": "pillar", | |||||
"Version": "1.6.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "43f228eb4b49093d1c8a5c93cae9efe9" | |||||
}, | |||||
"pkgbuild": { | |||||
"Package": "pkgbuild", | |||||
"Version": "1.2.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "725fcc30222d4d11ec68efb8ff11a9af" | |||||
}, | |||||
"pkgconfig": { | |||||
"Package": "pkgconfig", | |||||
"Version": "2.0.3", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "01f28d4278f15c76cddbea05899c5d6f" | |||||
}, | |||||
"pkgload": { | |||||
"Package": "pkgload", | |||||
"Version": "1.2.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "53139eedf68b98eecd5289664969c3f2" | |||||
}, | |||||
"praise": { | |||||
"Package": "praise", | |||||
"Version": "1.0.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "a555924add98c99d2f411e37e7d25e9f" | |||||
}, | |||||
"prettyunits": { | |||||
"Package": "prettyunits", | |||||
"Version": "1.1.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "95ef9167b75dde9d2ccc3c7528393e7e" | |||||
}, | |||||
"processx": { | |||||
"Package": "processx", | |||||
"Version": "3.5.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "0cbca2bc4d16525d009c4dbba156b37c" | |||||
}, | |||||
"ps": { | |||||
"Package": "ps", | |||||
"Version": "1.6.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "32620e2001c1dce1af49c49dccbb9420" | |||||
}, | |||||
"purrr": { | |||||
"Package": "purrr", | |||||
"Version": "0.3.4", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "97def703420c8ab10d8f0e6c72101e02" | |||||
}, | |||||
"rappdirs": { | |||||
"Package": "rappdirs", | |||||
"Version": "0.3.3", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "5e3c5dc0b071b21fa128676560dbe94d" | |||||
}, | |||||
"rcmdcheck": { | |||||
"Package": "rcmdcheck", | |||||
"Version": "1.3.3", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ed95895886dab6d2a584da45503555da" | |||||
}, | |||||
"rematch2": { | |||||
"Package": "rematch2", | |||||
"Version": "2.1.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "76c9e04c712a05848ae7a23d2f170a40" | |||||
}, | |||||
"remotes": { | |||||
"Package": "remotes", | |||||
"Version": "2.4.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "a85ebb35721573b196317b49ddd2dfe4" | |||||
}, | |||||
"renv": { | |||||
"Package": "renv", | |||||
"Version": "0.13.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "9f10d9db5b50400c348920c5c603385e" | |||||
}, | |||||
"rlang": { | |||||
"Package": "rlang", | |||||
"Version": "0.4.11", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "515f341d3affe0de9e4a7f762efb0456" | |||||
}, | |||||
"roxygen2": { | |||||
"Package": "roxygen2", | |||||
"Version": "7.1.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "eb9849556c4250305106e82edae35b72" | |||||
}, | |||||
"rpart": { | |||||
"Package": "rpart", | |||||
"Version": "4.1-15", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "9787c1fcb680e655d062e7611cadf78e" | |||||
}, | |||||
"rprojroot": { | |||||
"Package": "rprojroot", | |||||
"Version": "2.0.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "249d8cd1e74a8f6a26194a91b47f21d1" | |||||
}, | |||||
"rstudioapi": { | |||||
"Package": "rstudioapi", | |||||
"Version": "0.13", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "06c85365a03fdaf699966cc1d3cf53ea" | |||||
}, | |||||
"rversions": { | |||||
"Package": "rversions", | |||||
"Version": "2.1.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "f88fab00907b312f8b23ec13e2d437cb" | |||||
}, | |||||
"scales": { | |||||
"Package": "scales", | |||||
"Version": "1.1.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "6f76f71042411426ec8df6c54f34e6dd" | |||||
}, | |||||
"sessioninfo": { | |||||
"Package": "sessioninfo", | |||||
"Version": "1.1.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "308013098befe37484df72c39cf90d6e" | |||||
}, | |||||
"spatial": { | |||||
"Package": "spatial", | |||||
"Version": "7.3-11", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "f27a078d834614513608da2c08031130" | |||||
}, | |||||
"stringi": { | |||||
"Package": "stringi", | |||||
"Version": "1.7.4", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ebaccb577da50829a3bb1b8296f318a5" | |||||
}, | |||||
"stringr": { | |||||
"Package": "stringr", | |||||
"Version": "1.4.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "0759e6b6c0957edb1311028a49a35e76" | |||||
}, | |||||
"survival": { | |||||
"Package": "survival", | |||||
"Version": "3.1-8", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ad25122f95d04988f6f79d69aaadd53d" | |||||
}, | |||||
"sys": { | |||||
"Package": "sys", | |||||
"Version": "3.4", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "b227d13e29222b4574486cfcbde077fa" | |||||
}, | |||||
"testthat": { | |||||
"Package": "testthat", | |||||
"Version": "3.0.4", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "575216c9946ca70016c3ffb9c31709ba" | |||||
}, | |||||
"tibble": { | |||||
"Package": "tibble", | |||||
"Version": "3.1.4", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "5e8ad5621e5c94b24ec07b88eee13df8" | |||||
}, | |||||
"usethis": { | |||||
"Package": "usethis", | |||||
"Version": "2.0.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "360e904f9e623286e1a0c6ca0a98c5f6" | |||||
}, | |||||
"utf8": { | |||||
"Package": "utf8", | |||||
"Version": "1.2.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "c9c462b759a5cc844ae25b5942654d13" | |||||
}, | |||||
"vctrs": { | |||||
"Package": "vctrs", | |||||
"Version": "0.3.8", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ecf749a1b39ea72bd9b51b76292261f1" | |||||
}, | |||||
"viridisLite": { | |||||
"Package": "viridisLite", | |||||
"Version": "0.4.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "55e157e2aa88161bdb0754218470d204" | |||||
}, | |||||
"waldo": { | |||||
"Package": "waldo", | |||||
"Version": "0.3.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ad8cfff5694ac5b3c354f8f2044bd976" | |||||
}, | |||||
"whisker": { | |||||
"Package": "whisker", | |||||
"Version": "0.4", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ca970b96d894e90397ed20637a0c1bbe" | |||||
}, | |||||
"withr": { | |||||
"Package": "withr", | |||||
"Version": "2.4.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "ad03909b44677f930fa156d47d7a3aeb" | |||||
}, | |||||
"xfun": { | |||||
"Package": "xfun", | |||||
"Version": "0.26", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "a270216f7ffda25e53298293046d1d05" | |||||
}, | |||||
"xml2": { | |||||
"Package": "xml2", | |||||
"Version": "1.3.2", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "d4d71a75dd3ea9eb5fa28cc21f9585e2" | |||||
}, | |||||
"xopen": { | |||||
"Package": "xopen", | |||||
"Version": "1.0.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "6c85f015dee9cc7710ddd20f86881f58" | |||||
}, | |||||
"yaml": { | |||||
"Package": "yaml", | |||||
"Version": "2.2.1", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "2826c5d9efb0a88f657c7a679c7106db" | |||||
}, | |||||
"zip": { | |||||
"Package": "zip", | |||||
"Version": "2.2.0", | |||||
"Source": "Repository", | |||||
"Repository": "CRAN", | |||||
"Hash": "c7eef2996ac270a18c2715c997a727c5" | |||||
} | |||||
} | |||||
} |
library/ | |||||
local/ | |||||
lock/ | |||||
python/ | |||||
staging/ |
local({ | |||||
# the requested version of renv | |||||
version <- "0.13.0" | |||||
# the project directory | |||||
project <- getwd() | |||||
# avoid recursion | |||||
if (!is.na(Sys.getenv("RENV_R_INITIALIZING", unset = NA))) | |||||
return(invisible(TRUE)) | |||||
# signal that we're loading renv during R startup | |||||
Sys.setenv("RENV_R_INITIALIZING" = "true") | |||||
on.exit(Sys.unsetenv("RENV_R_INITIALIZING"), add = TRUE) | |||||
# signal that we've consented to use renv | |||||
options(renv.consent = TRUE) | |||||
# load the 'utils' package eagerly -- this ensures that renv shims, which | |||||
# mask 'utils' packages, will come first on the search path | |||||
library(utils, lib.loc = .Library) | |||||
# check to see if renv has already been loaded | |||||
if ("renv" %in% loadedNamespaces()) { | |||||
# if renv has already been loaded, and it's the requested version of renv, | |||||
# nothing to do | |||||
spec <- .getNamespaceInfo(.getNamespace("renv"), "spec") | |||||
if (identical(spec[["version"]], version)) | |||||
return(invisible(TRUE)) | |||||
# otherwise, unload and attempt to load the correct version of renv | |||||
unloadNamespace("renv") | |||||
} | |||||
# load bootstrap tools | |||||
bootstrap <- function(version, library) { | |||||
# attempt to download renv | |||||
tarball <- tryCatch(renv_bootstrap_download(version), error = identity) | |||||
if (inherits(tarball, "error")) | |||||
stop("failed to download renv ", version) | |||||
# now attempt to install | |||||
status <- tryCatch(renv_bootstrap_install(version, tarball, library), error = identity) | |||||
if (inherits(status, "error")) | |||||
stop("failed to install renv ", version) | |||||
} | |||||
renv_bootstrap_tests_running <- function() { | |||||
getOption("renv.tests.running", default = FALSE) | |||||
} | |||||
renv_bootstrap_repos <- function() { | |||||
# check for repos override | |||||
repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) | |||||
if (!is.na(repos)) | |||||
return(repos) | |||||
# if we're testing, re-use the test repositories | |||||
if (renv_bootstrap_tests_running()) | |||||
return(getOption("renv.tests.repos")) | |||||
# retrieve current repos | |||||
repos <- getOption("repos") | |||||
# ensure @CRAN@ entries are resolved | |||||
repos[repos == "@CRAN@"] <- "https://cloud.r-project.org" | |||||
# add in renv.bootstrap.repos if set | |||||
default <- c(FALLBACK = "https://cloud.r-project.org") | |||||
extra <- getOption("renv.bootstrap.repos", default = default) | |||||
repos <- c(repos, extra) | |||||
# remove duplicates that might've snuck in | |||||
dupes <- duplicated(repos) | duplicated(names(repos)) | |||||
repos[!dupes] | |||||
} | |||||
renv_bootstrap_download <- function(version) { | |||||
# if the renv version number has 4 components, assume it must | |||||
# be retrieved via github | |||||
nv <- numeric_version(version) | |||||
components <- unclass(nv)[[1]] | |||||
methods <- if (length(components) == 4L) { | |||||
list( | |||||
renv_bootstrap_download_github | |||||
) | |||||
} else { | |||||
list( | |||||
renv_bootstrap_download_cran_latest, | |||||
renv_bootstrap_download_cran_archive | |||||
) | |||||
} | |||||
for (method in methods) { | |||||
path <- tryCatch(method(version), error = identity) | |||||
if (is.character(path) && file.exists(path)) | |||||
return(path) | |||||
} | |||||
stop("failed to download renv ", version) | |||||
} | |||||
renv_bootstrap_download_impl <- function(url, destfile) { | |||||
mode <- "wb" | |||||
# https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 | |||||
fixup <- | |||||
Sys.info()[["sysname"]] == "Windows" && | |||||
substring(url, 1L, 5L) == "file:" | |||||
if (fixup) | |||||
mode <- "w+b" | |||||
utils::download.file( | |||||
url = url, | |||||
destfile = destfile, | |||||
mode = mode, | |||||
quiet = TRUE | |||||
) | |||||
} | |||||
renv_bootstrap_download_cran_latest <- function(version) { | |||||
repos <- renv_bootstrap_download_cran_latest_find(version) | |||||
message("* Downloading renv ", version, " ... ", appendLF = FALSE) | |||||
downloader <- function(type) { | |||||
tryCatch( | |||||
utils::download.packages( | |||||
pkgs = "renv", | |||||
destdir = tempdir(), | |||||
repos = repos, | |||||
type = type, | |||||
quiet = TRUE | |||||
), | |||||
condition = identity | |||||
) | |||||
} | |||||
# first, try downloading a binary on Windows + macOS if appropriate | |||||
binary <- | |||||
!identical(.Platform$pkgType, "source") && | |||||
!identical(getOption("pkgType"), "source") && | |||||
Sys.info()[["sysname"]] %in% c("Darwin", "Windows") | |||||
if (binary) { | |||||
info <- downloader(type = "binary") | |||||
if (!inherits(info, "condition")) { | |||||
message("OK (downloaded binary)") | |||||
return(info[1, 2]) | |||||
} | |||||
} | |||||
# otherwise, try downloading a source tarball | |||||
info <- downloader(type = "source") | |||||
if (inherits(info, "condition")) { | |||||
message("FAILED") | |||||
return(FALSE) | |||||
} | |||||
# report success and return | |||||
message("OK (downloaded source)") | |||||
info[1, 2] | |||||
} | |||||
renv_bootstrap_download_cran_latest_find <- function(version) { | |||||
all <- renv_bootstrap_repos() | |||||
for (repos in all) { | |||||
db <- tryCatch( | |||||
as.data.frame( | |||||
x = utils::available.packages(repos = repos), | |||||
stringsAsFactors = FALSE | |||||
), | |||||
error = identity | |||||
) | |||||
if (inherits(db, "error")) | |||||
next | |||||
entry <- db[db$Package %in% "renv" & db$Version %in% version, ] | |||||
if (nrow(entry) == 0) | |||||
next | |||||
return(repos) | |||||
} | |||||
fmt <- "renv %s is not available from your declared package repositories" | |||||
stop(sprintf(fmt, version)) | |||||
} | |||||
renv_bootstrap_download_cran_archive <- function(version) { | |||||
name <- sprintf("renv_%s.tar.gz", version) | |||||
repos <- renv_bootstrap_repos() | |||||
urls <- file.path(repos, "src/contrib/Archive/renv", name) | |||||
destfile <- file.path(tempdir(), name) | |||||
message("* Downloading renv ", version, " ... ", appendLF = FALSE) | |||||
for (url in urls) { | |||||
status <- tryCatch( | |||||
renv_bootstrap_download_impl(url, destfile), | |||||
condition = identity | |||||
) | |||||
if (identical(status, 0L)) { | |||||
message("OK") | |||||
return(destfile) | |||||
} | |||||
} | |||||
message("FAILED") | |||||
return(FALSE) | |||||
} | |||||
renv_bootstrap_download_github <- function(version) { | |||||
enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") | |||||
if (!identical(enabled, "TRUE")) | |||||
return(FALSE) | |||||
# prepare download options | |||||
pat <- Sys.getenv("GITHUB_PAT") | |||||
if (nzchar(Sys.which("curl")) && nzchar(pat)) { | |||||
fmt <- "--location --fail --header \"Authorization: token %s\"" | |||||
extra <- sprintf(fmt, pat) | |||||
saved <- options("download.file.method", "download.file.extra") | |||||
options(download.file.method = "curl", download.file.extra = extra) | |||||
on.exit(do.call(base::options, saved), add = TRUE) | |||||
} else if (nzchar(Sys.which("wget")) && nzchar(pat)) { | |||||
fmt <- "--header=\"Authorization: token %s\"" | |||||
extra <- sprintf(fmt, pat) | |||||
saved <- options("download.file.method", "download.file.extra") | |||||
options(download.file.method = "wget", download.file.extra = extra) | |||||
on.exit(do.call(base::options, saved), add = TRUE) | |||||
} | |||||
message("* Downloading renv ", version, " from GitHub ... ", appendLF = FALSE) | |||||
url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) | |||||
name <- sprintf("renv_%s.tar.gz", version) | |||||
destfile <- file.path(tempdir(), name) | |||||
status <- tryCatch( | |||||
renv_bootstrap_download_impl(url, destfile), | |||||
condition = identity | |||||
) | |||||
if (!identical(status, 0L)) { | |||||
message("FAILED") | |||||
return(FALSE) | |||||
} | |||||
message("OK") | |||||
return(destfile) | |||||
} | |||||
renv_bootstrap_install <- function(version, tarball, library) { | |||||
# attempt to install it into project library | |||||
message("* Installing renv ", version, " ... ", appendLF = FALSE) | |||||
dir.create(library, showWarnings = FALSE, recursive = TRUE) | |||||
# invoke using system2 so we can capture and report output | |||||
bin <- R.home("bin") | |||||
exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" | |||||
r <- file.path(bin, exe) | |||||
args <- c("--vanilla", "CMD", "INSTALL", "-l", shQuote(library), shQuote(tarball)) | |||||
output <- system2(r, args, stdout = TRUE, stderr = TRUE) | |||||
message("Done!") | |||||
# check for successful install | |||||
status <- attr(output, "status") | |||||
if (is.numeric(status) && !identical(status, 0L)) { | |||||
header <- "Error installing renv:" | |||||
lines <- paste(rep.int("=", nchar(header)), collapse = "") | |||||
text <- c(header, lines, output) | |||||
writeLines(text, con = stderr()) | |||||
} | |||||
status | |||||
} | |||||
renv_bootstrap_platform_prefix <- function() { | |||||
# construct version prefix | |||||
version <- paste(R.version$major, R.version$minor, sep = ".") | |||||
prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-") | |||||
# include SVN revision for development versions of R | |||||
# (to avoid sharing platform-specific artefacts with released versions of R) | |||||
devel <- | |||||
identical(R.version[["status"]], "Under development (unstable)") || | |||||
identical(R.version[["nickname"]], "Unsuffered Consequences") | |||||
if (devel) | |||||
prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r") | |||||
# build list of path components | |||||
components <- c(prefix, R.version$platform) | |||||
# include prefix if provided by user | |||||
prefix <- renv_bootstrap_platform_prefix_impl() | |||||
if (!is.na(prefix) && nzchar(prefix)) | |||||
components <- c(prefix, components) | |||||
# build prefix | |||||
paste(components, collapse = "/") | |||||
} | |||||
renv_bootstrap_platform_prefix_impl <- function() { | |||||
# if an explicit prefix has been supplied, use it | |||||
prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA) | |||||
if (!is.na(prefix)) | |||||
return(prefix) | |||||
# if the user has requested an automatic prefix, generate it | |||||
auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) | |||||
if (auto %in% c("TRUE", "True", "true", "1")) | |||||
return(renv_bootstrap_platform_prefix_auto()) | |||||
# empty string on failure | |||||
"" | |||||
} | |||||
renv_bootstrap_platform_prefix_auto <- function() { | |||||
prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity) | |||||
if (inherits(prefix, "error") || prefix %in% "unknown") { | |||||
msg <- paste( | |||||
"failed to infer current operating system", | |||||
"please file a bug report at https://github.com/rstudio/renv/issues", | |||||
sep = "; " | |||||
) | |||||
warning(msg) | |||||
} | |||||
prefix | |||||
} | |||||
renv_bootstrap_platform_os <- function() { | |||||
sysinfo <- Sys.info() | |||||
sysname <- sysinfo[["sysname"]] | |||||
# handle Windows + macOS up front | |||||
if (sysname == "Windows") | |||||
return("windows") | |||||
else if (sysname == "Darwin") | |||||
return("macos") | |||||
# check for os-release files | |||||
for (file in c("/etc/os-release", "/usr/lib/os-release")) | |||||
if (file.exists(file)) | |||||
return(renv_bootstrap_platform_os_via_os_release(file, sysinfo)) | |||||
# check for redhat-release files | |||||
if (file.exists("/etc/redhat-release")) | |||||
return(renv_bootstrap_platform_os_via_redhat_release()) | |||||
"unknown" | |||||
} | |||||
renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) { | |||||
# read /etc/os-release | |||||
release <- utils::read.table( | |||||
file = file, | |||||
sep = "=", | |||||
quote = c("\"", "'"), | |||||
col.names = c("Key", "Value"), | |||||
comment.char = "#", | |||||
stringsAsFactors = FALSE | |||||
) | |||||
vars <- as.list(release$Value) | |||||
names(vars) <- release$Key | |||||
# get os name | |||||
os <- tolower(sysinfo[["sysname"]]) | |||||
# read id | |||||
id <- "unknown" | |||||
for (field in c("ID", "ID_LIKE")) { | |||||
if (field %in% names(vars) && nzchar(vars[[field]])) { | |||||
id <- vars[[field]] | |||||
break | |||||
} | |||||
} | |||||
# read version | |||||
version <- "unknown" | |||||
for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) { | |||||
if (field %in% names(vars) && nzchar(vars[[field]])) { | |||||
version <- vars[[field]] | |||||
break | |||||
} | |||||
} | |||||
# join together | |||||
paste(c(os, id, version), collapse = "-") | |||||
} | |||||
renv_bootstrap_platform_os_via_redhat_release <- function() { | |||||
# read /etc/redhat-release | |||||
contents <- readLines("/etc/redhat-release", warn = FALSE) | |||||
# infer id | |||||
id <- if (grepl("centos", contents, ignore.case = TRUE)) | |||||
"centos" | |||||
else if (grepl("redhat", contents, ignore.case = TRUE)) | |||||
"redhat" | |||||
else | |||||
"unknown" | |||||
# try to find a version component (very hacky) | |||||
version <- "unknown" | |||||
parts <- strsplit(contents, "[[:space:]]")[[1L]] | |||||
for (part in parts) { | |||||
nv <- tryCatch(numeric_version(part), error = identity) | |||||
if (inherits(nv, "error")) | |||||
next | |||||
version <- nv[1, 1] | |||||
break | |||||
} | |||||
paste(c("linux", id, version), collapse = "-") | |||||
} | |||||
renv_bootstrap_library_root_name <- function(project) { | |||||
# use project name as-is if requested | |||||
asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE") | |||||
if (asis) | |||||
return(basename(project)) | |||||
# otherwise, disambiguate based on project's path | |||||
id <- substring(renv_bootstrap_hash_text(project), 1L, 8L) | |||||
paste(basename(project), id, sep = "-") | |||||
} | |||||
renv_bootstrap_library_root <- function(project) { | |||||
path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) | |||||
if (!is.na(path)) | |||||
return(path) | |||||
path <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) | |||||
if (!is.na(path)) { | |||||
name <- renv_bootstrap_library_root_name(project) | |||||
return(file.path(path, name)) | |||||
} | |||||
prefix <- renv_bootstrap_profile_prefix() | |||||
paste(c(project, prefix, "renv/library"), collapse = "/") | |||||
} | |||||
renv_bootstrap_validate_version <- function(version) { | |||||
loadedversion <- utils::packageDescription("renv", fields = "Version") | |||||
if (version == loadedversion) | |||||
return(TRUE) | |||||
# assume four-component versions are from GitHub; three-component | |||||
# versions are from CRAN | |||||
components <- strsplit(loadedversion, "[.-]")[[1]] | |||||
remote <- if (length(components) == 4L) | |||||
paste("rstudio/renv", loadedversion, sep = "@") | |||||
else | |||||
paste("renv", loadedversion, sep = "@") | |||||
fmt <- paste( | |||||
"renv %1$s was loaded from project library, but this project is configured to use renv %2$s.", | |||||
"Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.", | |||||
"Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.", | |||||
sep = "\n" | |||||
) | |||||
msg <- sprintf(fmt, loadedversion, version, remote) | |||||
warning(msg, call. = FALSE) | |||||
FALSE | |||||
} | |||||
renv_bootstrap_hash_text <- function(text) { | |||||
hashfile <- tempfile("renv-hash-") | |||||
on.exit(unlink(hashfile), add = TRUE) | |||||
writeLines(text, con = hashfile) | |||||
tools::md5sum(hashfile) | |||||
} | |||||
renv_bootstrap_load <- function(project, libpath, version) { | |||||
# try to load renv from the project library | |||||
if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) | |||||
return(FALSE) | |||||
# warn if the version of renv loaded does not match | |||||
renv_bootstrap_validate_version(version) | |||||
# load the project | |||||
renv::load(project) | |||||
TRUE | |||||
} | |||||
renv_bootstrap_profile_load <- function(project) { | |||||
# if RENV_PROFILE is already set, just use that | |||||
profile <- Sys.getenv("RENV_PROFILE", unset = NA) | |||||
if (!is.na(profile) && nzchar(profile)) | |||||
return(profile) | |||||
# check for a profile file (nothing to do if it doesn't exist) | |||||
path <- file.path(project, "renv/local/profile") | |||||
if (!file.exists(path)) | |||||
return(NULL) | |||||
# read the profile, and set it if it exists | |||||
contents <- readLines(path, warn = FALSE) | |||||
if (length(contents) == 0L) | |||||
return(NULL) | |||||
# set RENV_PROFILE | |||||
profile <- contents[[1L]] | |||||
if (nzchar(profile)) | |||||
Sys.setenv(RENV_PROFILE = profile) | |||||
profile | |||||
} | |||||
renv_bootstrap_profile_prefix <- function() { | |||||
profile <- renv_bootstrap_profile_get() | |||||
if (!is.null(profile)) | |||||
return(file.path("renv/profiles", profile)) | |||||
} | |||||
renv_bootstrap_profile_get <- function() { | |||||
profile <- Sys.getenv("RENV_PROFILE", unset = "") | |||||
renv_bootstrap_profile_normalize(profile) | |||||
} | |||||
renv_bootstrap_profile_set <- function(profile) { | |||||
profile <- renv_bootstrap_profile_normalize(profile) | |||||
if (is.null(profile)) | |||||
Sys.unsetenv("RENV_PROFILE") | |||||
else | |||||
Sys.setenv(RENV_PROFILE = profile) | |||||
} | |||||
renv_bootstrap_profile_normalize <- function(profile) { | |||||
if (is.null(profile) || profile %in% c("", "default")) | |||||
return(NULL) | |||||
profile | |||||
} | |||||
# load the renv profile, if any | |||||
renv_bootstrap_profile_load(project) | |||||
# construct path to library root | |||||
root <- renv_bootstrap_library_root(project) | |||||
# construct library prefix for platform | |||||
prefix <- renv_bootstrap_platform_prefix() | |||||
# construct full libpath | |||||
libpath <- file.path(root, prefix) | |||||
# attempt to load | |||||
if (renv_bootstrap_load(project, libpath, version)) | |||||
return(TRUE) | |||||
# load failed; inform user we're about to bootstrap | |||||
prefix <- paste("# Bootstrapping renv", version) | |||||
postfix <- paste(rep.int("-", 77L - nchar(prefix)), collapse = "") | |||||
header <- paste(prefix, postfix) | |||||
message(header) | |||||
# perform bootstrap | |||||
bootstrap(version, libpath) | |||||
# exit early if we're just testing bootstrap | |||||
if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) | |||||
return(TRUE) | |||||
# try again to load | |||||
if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { | |||||
message("* Successfully installed and loaded renv ", version, ".") | |||||
return(renv::load()) | |||||
} | |||||
# failed to download or load renv; warn the user | |||||
msg <- c( | |||||
"Failed to find an renv installation: the project will not be loaded.", | |||||
"Use `renv::activate()` to re-initialize the project." | |||||
) | |||||
warning(paste(msg, collapse = "\n"), call. = FALSE) | |||||
}) |
external.libraries: | |||||
ignored.packages: | |||||
package.dependency.fields: Imports, Depends, LinkingTo | |||||
r.version: | |||||
snapshot.type: all | |||||
use.cache: TRUE | |||||
vcs.ignore.library: TRUE |
git+git://github.com/chinese-quartet/quartet-metabolite-report@v1.0.0 |
info: | |||||
name: QC Report for Quartet Metabolomics | |||||
version: v0.1.1 | |||||
description: Generate the QC Report for Quartet Metabolomics data. | |||||
category: Report | |||||
home: https://github.com/tservice-plugins/quartet-metqc-report | |||||
source: PGx | |||||
short_name: quartet-metqc-report | |||||
icons: | |||||
- src: "" | |||||
type: image/png | |||||
sizes: 192x192 | |||||
author: PGx | |||||
plugin: | |||||
name: quartet-metqc-report | |||||
display-name: QC Report for Quartet Metabolomics | |||||
lazy-load: false | |||||
init: | |||||
# Unpack environment file to the directory, repository/envs/quartet-metqc-report | |||||
- step: unpack-env | |||||
envname: quartet-metqc-report | |||||
postunpack: chmod a+x {{ENV_DEST_DIR}}/bin/metqc.sh | |||||
- step: load-namespace | |||||
namespace: tservice.plugins.quartet-metqc-report | |||||
- step: register-plugin | |||||
entrypoint: tservice.plugins.quartet-metqc-report/metadata | |||||
- step: init-event | |||||
entrypoint: tservice.plugins.quartet-metqc-report/events-init |
(ns tservice.plugins.quartet-metqc-report | |||||
(:require [clojure.data.json :as json] | |||||
[clojure.spec.alpha :as s] | |||||
[spec-tools.core :as st] | |||||
[clojure.tools.logging :as log] | |||||
[tservice.lib.files :as ff] | |||||
[tservice.api.config :refer [add-env-to-path]] | |||||
[tservice.lib.fs :as fs-lib] | |||||
[tservice.vendor.multiqc :as mq] | |||||
[tservice.plugins.quartet-metqc-report.metqc :as metqc] | |||||
[tservice.api.task :refer [make-events-init publish-event! make-plugin-metadata create-task! update-process!]])) | |||||
;;; ------------------------------------------------ Event Specs ------------------------------------------------ | |||||
(s/def ::metadata_file | |||||
(st/spec | |||||
{:spec (s/and string? #(re-matches #"^[a-zA-Z0-9]+:\/\/(\/|\.\/)[a-zA-Z0-9_]+.*" %)) | |||||
:type :string | |||||
:description "File path for metadata file, such as file:///xxx/xxx/metadata.csv" | |||||
:swagger/default nil | |||||
:reason "The filepath must be string."})) | |||||
(s/def ::data_file | |||||
(st/spec | |||||
{:spec (s/and string? #(re-matches #"^[a-zA-Z0-9]+:\/\/(\/|\.\/)[a-zA-Z0-9_]+.*" %)) | |||||
:type :string | |||||
:description "File path for metabolomics profiled data, such as file:///xxx/xxx/data.csv" | |||||
:swagger/default nil | |||||
:reason "The filepath must be string."})) | |||||
(s/def ::name | |||||
(st/spec | |||||
{:spec string? | |||||
:type :string | |||||
:description "The name of the report" | |||||
:swagger/default "" | |||||
:reason "Not a valid name"})) | |||||
(s/def ::description | |||||
(st/spec | |||||
{:spec string? | |||||
:type :string | |||||
:description "Description of the report" | |||||
:swagger/default "" | |||||
:reason "Not a valid description."})) | |||||
(def quartet-metqc-report-params-body | |||||
"A spec for the body parameters." | |||||
(s/keys :req-un [::name ::data_file ::metadata_file] | |||||
:opt-un [::description])) | |||||
;;; ------------------------------------------------ Event Metadata ------------------------------------------------ | |||||
(def metadata | |||||
(make-plugin-metadata | |||||
{:name "quartet-metqc-report" | |||||
:summary "Visualizes Quality Control(QC) results from metabolomics data for Quartet Project." | |||||
:params-schema quartet-metqc-report-params-body | |||||
:handler (fn [{:keys [name data_file metadata_file description] | |||||
:or {description (format "Quality control report for %s" name)} | |||||
:as payload}] | |||||
(let [payload (merge {:description description} payload) | |||||
data-file (metqc/correct-filepath data_file) | |||||
metadata-file (metqc/correct-filepath metadata_file) | |||||
workdir (metqc/dirname data-file) | |||||
log-path (fs-lib/join-paths workdir "log") | |||||
response {:report (format "%s/multiqc_report.html" workdir) | |||||
:log log-path | |||||
:response-type :data2report} | |||||
task-id (create-task! {:name name | |||||
:description description | |||||
:payload payload | |||||
:plugin-name "quartet-metqc-report" | |||||
:plugin-type "ReportPlugin" | |||||
:plugin-version "v0.1.0" | |||||
:response response}) | |||||
result-dir (fs-lib/join-paths workdir "results")] | |||||
(fs-lib/create-directories! result-dir) | |||||
(log/info (format "Create a report %s with %s in %s" name payload workdir)) | |||||
(spit log-path (json/write-str {:status "Running" | |||||
:msg ""})) | |||||
(update-process! task-id 0) | |||||
(publish-event! "quartet_metqc_report" | |||||
{:data-file data-file | |||||
:metadata-file metadata-file | |||||
:dest-dir workdir | |||||
:task-id task-id | |||||
:metadata {:name name | |||||
:description description | |||||
:plugin-name "quartet-metqc-report" | |||||
:plutin-type "ReportPlugin" | |||||
:plugin-version "v0.1.0"}}) | |||||
response)) | |||||
:plugin-type :ReportPlugin | |||||
:response-type :data2report})) | |||||
(defn update-log-process! | |||||
"Update message into log file and process into database." | |||||
[log-path coll task-id process] | |||||
(spit log-path (json/write-str coll)) | |||||
(update-process! task-id process)) | |||||
(defn date | |||||
[] | |||||
(.format (java.text.SimpleDateFormat. "yyyy-MM-dd") | |||||
(new java.util.Date))) | |||||
(defn- make-report! | |||||
[{:keys [data-file metadata-file dest-dir metadata task-id]}] | |||||
(let [log-path (fs-lib/join-paths dest-dir "log") | |||||
result-dir (fs-lib/join-paths dest-dir "results") | |||||
parameters-file (fs-lib/join-paths result-dir "general_information.json") | |||||
results (ff/chain-fn-coll [(fn [] | |||||
(update-process! task-id 20) | |||||
(metqc/call-metqc! data-file metadata-file result-dir)) | |||||
(fn [] | |||||
(update-process! task-id 50) | |||||
(spit parameters-file (json/write-str {"Report Name" (:name metadata) | |||||
"Description" (:description metadata) | |||||
"Report Tool" (format "%s-%s" | |||||
(:plugin-name metadata) | |||||
(:plugin-version metadata)) | |||||
"Team" "Quartet Team" | |||||
"Date" (date)})) | |||||
{:status "Success" :msg ""}) | |||||
(fn [] | |||||
(update-process! task-id 80) | |||||
(mq/multiqc result-dir dest-dir | |||||
{:template "quartet_metabolite_report" | |||||
:title "Quartet Report for Metabolomics" | |||||
:env {:PATH (add-env-to-path "quartet-metqc-report")}}))] | |||||
(fn [result] (= (:status result) "Success"))) | |||||
status (:status (last results)) | |||||
msg (apply str (map :msg results)) | |||||
process (if (= status "Success") 100 -1)] | |||||
(log/info (format "Running batch command: %s" (pr-str results))) | |||||
(update-log-process! log-path {:status status | |||||
:msg msg} | |||||
task-id process))) | |||||
;;; --------------------------------------------------- Lifecycle ---------------------------------------------------- | |||||
(def events-init | |||||
"Automatically called during startup; start event listener for quartet_metqc_report events." | |||||
(make-events-init "quartet_metqc_report" make-report!)) |
(ns tservice.plugins.quartet-metqc-report.metqc | |||||
"A wrapper for metqc tool." | |||||
(:require [tservice.api.config :refer [add-env-to-path]] | |||||
[tservice.lib.files :refer [is-localpath? get-plugin-jar-env-dir]] | |||||
[clojure.string :as clj-str] | |||||
[tservice.lib.fs :as fs-lib] | |||||
[clojure.java.shell :as shell :refer [sh]] | |||||
[clojure.java.io :refer [file]])) | |||||
(defn call-metqc! | |||||
"Call metqc bash script. more details on https://github.com/chinese-quartet/MetQC | |||||
exp-file: Proteomics profiled data. | |||||
meta-file: proteomics metadata. | |||||
result-dir: A directory for result files. | |||||
" | |||||
[exp-file meta-file result-dir] | |||||
(shell/with-sh-env {:PATH (add-env-to-path "quartet-metqc-report") | |||||
:R_PROFILE_USER (fs-lib/join-paths (get-plugin-jar-env-dir "quartet-metqc-report") "Rprofile") | |||||
:LC_ALL "en_US.utf-8" | |||||
:LANG "en_US.utf-8"} | |||||
(let [command ["bash" "-c" | |||||
(format "metqc.sh -d %s -m %s -o %s" exp-file meta-file result-dir)] | |||||
result (apply sh command) | |||||
status (if (= (:exit result) 0) "Success" "Error") | |||||
msg (str (:out result) "\n" (:err result))] | |||||
{:status status | |||||
:msg msg}))) | |||||
(defn correct-filepath | |||||
[filepath] | |||||
(if (is-localpath? filepath) | |||||
(clj-str/replace filepath #"^file:\/\/" "") | |||||
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)))) |