Mercurial > repos > davidvanzessen > argalaxy_tools
changeset 56:7ae6b6b5d890 draft
"planemo upload commit 2d4cb6757e8eff095295550bbde6fd9e2ee0b73d"
author | rhpvorderman |
---|---|
date | Tue, 14 Dec 2021 12:45:47 +0000 |
parents | 2a7dc86d8f85 |
children | 33412e85e669 |
files | complete_immunerepertoire.xml conda_environment.yml mulled_container_build.tsv tests/__pycache__/test_imgt.cpython-39-pytest-6.2.5.pyc tests/data/CONTROL_NWK377_PB_IGHC_MID1_40nt_2.txz tests/test_imgt.py |
diffstat | 6 files changed, 130 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/complete_immunerepertoire.xml Fri Nov 19 10:09:54 2021 +0000 +++ b/complete_immunerepertoire.xml Tue Dec 14 12:45:47 2021 +0000 @@ -1,4 +1,4 @@ -<tool id="complete_immunerepertoire_igg" name="Immune Repertoire pipeline" version="1.0.2"> +<tool id="complete_immunerepertoire_igg" name="Immune Repertoire pipeline" version="1.1.0.alpha1"> <requirements> <requirement type="package" version="2.3">r-gridextra</requirement> <requirement type="package" version="3.0.0">r-ggplot2</requirement> @@ -10,7 +10,13 @@ <requirement type="package" version="1.3.1">r-stringr</requirement> <requirement type="package" version="0.69.6">circos</requirement> <requirement type="package" version="0.23">circos-tools</requirement> - </requirements> + <requirement type="package" version="1.34">tar</requirement> + <requirement type="package" version="6.0">unzip</requirement> + <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> + </requirements> <description> </description> <command interpreter="bash"> complete.sh " @@ -32,7 +38,12 @@ <repeat name="samples" title="Replicate" min="1" default="1"> <param name="sample" type="data" label="Replicate to Process" /> </repeat> - <param name="id" type="text" label="ID" /> + <param name="id" type="text" label="ID"> + <!-- This replace whitespace with _ --> + <sanitizer invalid_char="_" sanitize="true"> + <valid initial="default"/> + </sanitizer> + </param> </repeat> <param name="clonaltype" type="select" label="Clonal Type Definition"> <option value="none">Don't remove duplicates based on clonaltype</option>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conda_environment.yml Tue Dec 14 12:45:47 2021 +0000 @@ -0,0 +1,25 @@ +name: argalaxy-immunerepertoire +channels: + - conda-forge + - bioconda + - defaults + - imperial-college-research-computing +dependencies: + - r-gridextra=2.3 + - r-ggplot2=3.0.0 + - r-plyr=1.8.4 + - r-reshape2=1.4.3 + - r-data.table=1.11.4 + - r-lymphclon=1.3.0 + - r-stringi=1.2.4 + - r-stringr=1.3.1 + - circos=0.69.6 + - circos-tools=0.23 + - bash=4.4.18 + - file=5.39 + - font-ttf-ubuntu=0.83 + - tar=1.34 + - unzip=6.0 + - unrar=0.4 + - p7zip=16.02 + - findutils=4.6.0 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mulled_container_build.tsv Tue Dec 14 12:45:47 2021 +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-reshape2=1.4.3,r-data.table=1.11.4,r-lymphclon=1.3.0,r-stringi=1.2.4,r-stringr=1.3.1,circos=0.69.6,circos-tools=0.23,bash=4.4.18,file=5.39,font-ttf-ubuntu=0.83,tar=1.34,unzip=6.0,unrar=0.4,p7zip=16.02,findutils=4.6.0 bgruening/busybox-bash:0.1 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_imgt.py Tue Dec 14 12:45:47 2021 +0000 @@ -0,0 +1,89 @@ +# Copyright (c) 2021 Leiden University Medical Center +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import os +import shutil +import subprocess +import tempfile +from pathlib import Path +from xml.etree import ElementTree +from xml.etree.ElementTree import Element + +import pytest + +GIT_ROOT = Path(__file__).parent.parent.absolute() +TEST_DIR = Path(__file__).parent +TEST_DATA_DIR = TEST_DIR / "data" +VALIDATION_DATA_DIR = TEST_DIR / "validation_data" +CONTROL_NWK377_PB_IGHC_MID1_40nt_2 = TEST_DATA_DIR / "CONTROL_NWK377_PB_IGHC_MID1_40nt_2.txz" + + +def get_container(): + tool = ElementTree.parse(GIT_ROOT / "complete_immunerepertoire.xml").getroot() + requirements: Element = tool.find("requirements") + container = requirements.find("container") + return container.text + + +@pytest.fixture(scope="module") +def imgt_result(): + temp_dir = Path(tempfile.mkdtemp()) + tool_dir = temp_dir / "imgt" + shutil.copytree(GIT_ROOT, tool_dir) + working_dir = temp_dir / "working" + working_dir.mkdir(parents=True) + output_dir = temp_dir / "outputs" + output_dir.mkdir(parents=True) + wrapper = str(tool_dir / "complete.sh") + sample = CONTROL_NWK377_PB_IGHC_MID1_40nt_2 + input = f"\"ID1\" {sample} {sample} \"ID2\" {sample}" + out_files_path = output_dir / "results" + out_files_path.mkdir(parents=True) + out_file = out_files_path / "result.html" + clonaltype = "none" + gene_selection = dict(species="Homo sapiens functional", + locus="TRA") + filterproductive = "yes" + clonality_method = "none" + cmd = [ + "bash", + wrapper, + input, + str(out_file), + str(out_files_path), + clonaltype, + gene_selection["species"], + gene_selection["locus"], + filterproductive, + clonality_method + ] + docker_cmd = ["docker", "run", "-v", f"{temp_dir}:{temp_dir}", + "-v", f"{sample}:{sample}", + "-w", str(working_dir), + get_container()] + cmd + with open(temp_dir / "stderr", "wt") as stderr_file: + with open(temp_dir / "stdout", "wt") as stdout_file: + subprocess.run(docker_cmd, cwd=working_dir, stdout=stdout_file, + stderr=stderr_file, check=True) + yield Path(out_files_path) + + +def test_check_output(imgt_result): + assert imgt_result.exists()