Mercurial > repos > davidvanzessen > argalaxy_tools
changeset 57:33412e85e669 draft
"planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
author | rhpvorderman |
---|---|
date | Wed, 02 Feb 2022 10:50:01 +0000 |
parents | 7ae6b6b5d890 |
children | 4c6df851e262 |
files | CHANGES.md build_container.sh complete_immunerepertoire.xml container_hash.tsv create_container_hash.py involucro report_clonality/r_wrapper.sh tests/__pycache__/test_imgt.cpython-39-pytest-6.2.5.pyc tests/test_imgt.py |
diffstat | 9 files changed, 81 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.md Tue Dec 14 12:45:47 2021 +0000 +++ b/CHANGES.md Wed Feb 02 10:50:01 2022 +0000 @@ -1,3 +1,8 @@ +version 1.1.0 +------------- ++ Add a container requirement to allow using docker or singularity. ++ Add an option to download all files at once contained in a zip file. + version 1.0.2 ------------- + Remove some wrongly placed quotes
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build_container.sh Wed Feb 02 10:50:01 2022 +0000 @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e +DEFAULT_BASE_IMAGE="$1" + +python3 create_container_hash.py $DEFAULT_BASE_IMAGE +mulled-build-files --namespace rhpvorderman build-and-test ./container_hash.tsv --verbose +
--- a/complete_immunerepertoire.xml Tue Dec 14 12:45:47 2021 +0000 +++ b/complete_immunerepertoire.xml Wed Feb 02 10:50:01 2022 +0000 @@ -1,4 +1,4 @@ -<tool id="complete_immunerepertoire_igg" name="Immune Repertoire pipeline" version="1.1.0.alpha1"> +<tool id="complete_immunerepertoire_igg" name="Immune Repertoire pipeline" version="1.1.0"> <requirements> <requirement type="package" version="2.3">r-gridextra</requirement> <requirement type="package" version="3.0.0">r-ggplot2</requirement> @@ -15,7 +15,7 @@ <requirement type="package" version="0.4">unrar</requirement> <requirement type="package" version="16.02">p7zip</requirement> <requirement type="package" version="4.6.0">findutils</requirement> - <container type="docker">quay.io/rhpvorderman/mulled-v2-62aaeb9dad7d9973e676594c3aa69e605c73cd0c:80328e762d48b0d7b11c4fa41a5c09ca43d49db9-0</container> + <container type="docker">quay.io/argalaxy/mulled-v2-62aaeb9dad7d9973e676594c3aa69e605c73cd0c:80328e762d48b0d7b11c4fa41a5c09ca43d49db9-0</container> </requirements> <description> </description> <command interpreter="bash">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/container_hash.tsv Wed Feb 02 10:50:01 2022 +0000 @@ -0,0 +1,2 @@ +#targets base_image image_build +r-gridextra=2.3,r-ggplot2=3.0.0,r-plyr=1.8.4,r-data.table=1.11.4,r-reshape2=1.4.3,r-lymphclon=1.3.0,r-stringi=1.2.4,r-stringr=1.3.1,circos=0.69.6,circos-tools=0.23,tar=1.34,unzip=6.0,unrar=0.4,p7zip=16.02,findutils=4.6.0,font-ttf-ubuntu=0.83 bgruening/busybox-bash:latest 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/create_container_hash.py Wed Feb 02 10:50:01 2022 +0000 @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import sys + +from xml.etree import ElementTree +from xml.etree.ElementTree import Element + +DEFAULT_BASE_IMAGE = "bgruening/busybox-bash:latest" +def main(): + try: + base_image = sys.argv[1] + except IndexError: + base_image = DEFAULT_BASE_IMAGE + tool = ElementTree.parse("complete_immunerepertoire.xml").getroot() + requirements: Element = tool.find("requirements") + packages = [] + for req in requirements.findall("requirement"): + if req.get("type") == "package": + name = req.text + version = req.get("version") + package_string = f"{name}={version}" + packages.append(package_string) + with open("container_hash.tsv", mode="wt") as container_hash_file: + container_hash_file.write("#targets\tbase_image\timage_build\n") + container_hash_file.write(",".join(packages) + f"\t{base_image}\t0\n") + + +if __name__ == "__main__": + main()
--- a/report_clonality/r_wrapper.sh Tue Dec 14 12:45:47 2021 +0000 +++ b/report_clonality/r_wrapper.sh Wed Feb 02 10:50:01 2022 +0000 @@ -9,6 +9,8 @@ filterproductive=$7 clonality_method=$8 +ALL_OUTPUTS_ZIP="$outputDir/all_outputs.zip" + dir="$(cd "$(dirname "$0")" && pwd)" useD="false" if grep -q "$species.*${locus}D" "$dir/genes.txt" ; then @@ -334,9 +336,36 @@ echo "</div>" >> $outputFile fi + +# Create zip file with all download files +# Use 7za as it is packaged in the container already. +cd "$outputDir" || exit 1 + +7za a -tzip "$ALL_OUTPUTS_ZIP" -- \ + allUnique.txt VFFrequency.txt VFrequency.txt \ + JFrequency.txt DReadingFrame.txt CDR3LengthPlot.txt \ + AAComposition.txt clonalityComplete.txt + +if [[ "$useD" == "true" ]] ; then + 7za a -tzip "$ALL_OUTPUTS_ZIP" -- \ + DFFrequency.txt DFrequency.txt +fi +for sample in $samples; do + if [[ "$useD" == "true" ]] ; then + 7za a -tzip "$ALL_OUTPUTS_ZIP" -- \ + "HeatmapVD_$sample.txt" "HeatmapDJ_$sample.txt" \ + "${sample}_VD_circos.txt" "${sample}_DJ_circos.txt" + fi + 7za a -tzip "$ALL_OUTPUTS_ZIP" -- \ + "HeatmapVJ_$sample.txt" "${sample}_VJ_circos.txt" +done + +cd $dir || exit 1 + echo "<div class='tabbertab' title='Downloads'>" >> $outputFile echo "<table class='pure-table pure-table-striped'>" >> $outputFile echo "<thead><tr><th>Description</th><th>Link</th></tr></thead>" >> $outputFile +echo "<tr><td>All outputs below in a zip file</td><td><a href='$ALL_OUTPUTS_ZIP'>Download</a></td></tr>" >> $outputFile echo "<tr><td>The filtered dataset</td><td><a href='allUnique.txt'>Download</a></td></tr>" >> $outputFile echo "<tr><td colspan='2' style='background-color:#E0E0E0;'>Gene frequencies</td></tr>" >> $outputFile
--- a/tests/test_imgt.py Tue Dec 14 12:45:47 2021 +0000 +++ b/tests/test_imgt.py Wed Feb 02 10:50:01 2022 +0000 @@ -77,6 +77,12 @@ docker_cmd = ["docker", "run", "-v", f"{temp_dir}:{temp_dir}", "-v", f"{sample}:{sample}", "-w", str(working_dir), + # Run as current user which allows deletion of files. + # It also mitigates some security considerations + "-u", f"{os.getuid()}:{os.getgid()}", + # Run with default seccomp profile to mitigate mitigation slowdown + # http://mamememo.blogspot.com/2020/05/cpu-intensive-rubypython-code-runs.html + "--security-opt", "seccomp=unconfined", get_container()] + cmd with open(temp_dir / "stderr", "wt") as stderr_file: with open(temp_dir / "stdout", "wt") as stdout_file: