changeset 98:d714f5ea83d7 draft default tip

planemo upload commit 1a01065a084a817382872154f779b94090a35ebf
author rhpvorderman
date Wed, 10 Jan 2024 12:32:47 +0000
parents fbc6307dd83b
children
files CHANGELOG.md CONTROL_NWK377_PB_IGHC_MID1_40nt_2.txz a.out baseline/wrapper.sh shm_csr.xml show_time_as_float tests/.pytest_cache/.gitignore tests/.pytest_cache/CACHEDIR.TAG tests/.pytest_cache/README.md tests/.pytest_cache/v/cache/lastfailed tests/.pytest_cache/v/cache/nodeids tests/.pytest_cache/v/cache/stepwise tests/__pycache__/test_shm_csr.cpython-37-pytest-6.2.5.pyc tests/__pycache__/test_shm_csr.cpython-39-pytest-7.2.1.pyc tests/__pycache__/test_shm_csr.cpython-39-pytest-7.4.4.pyc tests/data/.~lock.handleiding activeren pas.docx# tests/data/handleiding activeren pas.docx tests/test_shm_csr.py time_ns wrapper.sh
diffstat 20 files changed, 105 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.md	Mon Jan 08 08:50:07 2024 +0000
+++ b/CHANGELOG.md	Wed Jan 10 12:32:47 2024 +0000
@@ -1,3 +1,8 @@
+version 1.10.0
+------------------
++ Fix crashing baseline when only unproductive sequences are present.
++ Replace "fast" option with options to toggle baseline and Change-O indidually.
+
 version 1.9.1
 -----------------
 + Fix error in launch command.
Binary file CONTROL_NWK377_PB_IGHC_MID1_40nt_2.txz has changed
Binary file a.out has changed
--- a/baseline/wrapper.sh	Mon Jan 08 08:50:07 2024 +0000
+++ b/baseline/wrapper.sh	Wed Jan 10 12:32:47 2024 +0000
@@ -1,4 +1,5 @@
 #!/bin/bash
+
 dir="$(cd "$(dirname "$0")" && pwd)"
 
 testID=$1
@@ -79,14 +80,16 @@
 
 echo "$workdir/${outID}.txt"
 
-rows=`tail -n +2 $workdir/${outID}.txt | grep -v "All sequences combined" | grep -n 'Group' | grep -Eoh '^[0-9]+' | tr '\n' ' '`
-rows=($rows)
-#unset rows[${#rows[@]}-1]
+if [[ -f "$workdir/${outID}.txt" ]]
+then
+  rows=`tail -n +2 $workdir/${outID}.txt | grep -v "All sequences combined" | grep -n 'Group' | grep -Eoh '^[0-9]+' | tr '\n' ' '`
+  rows=($rows)
+  #unset rows[${#rows[@]}-1]
 
-cd $dir
-Rscript --verbose $dir/comparePDFs.r $workdir/${outID}.RData $output ${rows[@]} 2>&1
-cp $workdir/result.txt ${output_table}
+  cd $dir
+  Rscript --verbose $dir/comparePDFs.r $workdir/${outID}.RData $output ${rows[@]} 2>&1
+  cp $workdir/result.txt ${output_table}
+fi
 
 
 
-
--- a/shm_csr.xml	Mon Jan 08 08:50:07 2024 +0000
+++ b/shm_csr.xml	Wed Jan 10 12:32:47 2024 +0000
@@ -1,4 +1,4 @@
-<tool id="shm_csr" name="SHM &amp; CSR pipeline" version="1.9.1" profile="16.04">
+<tool id="shm_csr" name="SHM &amp; CSR pipeline" version="1.10.0" profile="16.04">
 	<description></description>
 	<requirements>
 		<requirement type="package" version="3.7.1">python</requirement>
@@ -35,7 +35,7 @@
 			$filter_unique.filter_unique_clone_count
 			$class_filter_cond.class_filter
 			$empty_region_filter
-			$fast
+			$changeo $baseline
 		#else:
 			$__tool_directory__/wrapper.sh "$in_file"
 			custom
@@ -48,7 +48,7 @@
 			2
 			$class_filter_cond.class_filter
 			$empty_region_filter
-			$fast
+			$changeo $baseline
 		#end if
 	]]>
 	</command>
@@ -108,59 +108,57 @@
 			</param>
 		</conditional>
 		<conditional name="naive_output_cond">
-			<param name="naive_output" type="select" label="Output new IMGT archives per class into your history?">
-				<option value="yes">Yes</option>
-				<option value="no" selected="true">No</option>
-			</param>
-			<when value="yes"></when>
-			<when value="no"></when>
-		</conditional>
-		<param name="fast" type="select" label="Fast" help="Skips Change-O/Baseline" >
-			<option value="yes">Yes</option>
-			<option value="no" selected="true">No</option>
-		</param>
+			<param name="naive_output" type="boolean" label="Output new IMGT archives per class into your history?"
+				   checked="no" truevalue="yes" falsevalue="no"/>
+			</conditional>
+		<param name="changeo" type="boolean" label="Run Change-O"
+			   checked="yes" truevalue="yes" falsevalue="no"/>
+		<param name="baseline" type="boolean" label="Run Baseline"
+			   checked="yes" truevalue="yes" falsevalue="no"
+			   help="Baseline is automatically skipped when functionality filter is set to unproductive only."
+		/>
 	</inputs>
 	<outputs>
 		<data format="html" name="out_file" label = "SHM &amp; CSR on ${in_file.name}"/>
 		<data format="imgt_archive" name="naive_output_ca" label = "Filtered IMGT IGA: ${in_file.name}" >
-		    <filter>naive_output_cond['naive_output'] == "yes"</filter>
+		    <filter>naive_output_cond['naive_output'] is True</filter>
 		    <filter>class_filter_cond['class_filter'] != "101_101"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGG"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGM"</filter>
 		</data>
 		<data format="imgt_archive" name="naive_output_cg" label = "Filtered IMGT IGG: ${in_file.name}" >
-		    <filter>naive_output_cond['naive_output'] == "yes"</filter>
+		    <filter>naive_output_cond['naive_output'] is True</filter>
 		    <filter>class_filter_cond['class_filter'] != "101_101"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGA"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGM"</filter>
 		</data>
 		<data format="imgt_archive" name="naive_output_cm" label = "Filtered IMGT IGM: ${in_file.name}" >
-		    <filter>naive_output_cond['naive_output'] == "yes"</filter>
+		    <filter>naive_output_cond['naive_output'] is True</filter>
 		    <filter>class_filter_cond['class_filter'] != "101_101"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGA"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGG"</filter>
 		</data>
 		<data format="imgt_archive" name="naive_output_ce" label = "Filtered IMGT IGE: ${in_file.name}" >
-		    <filter>naive_output_cond['naive_output'] == "yes"</filter>
+		    <filter>naive_output_cond['naive_output'] is True</filter>
 		    <filter>class_filter_cond['class_filter'] != "101_101"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGA"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGG"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGM"</filter>
 		</data>
 		<data format="imgt_archive" name="naive_output_igm_naive" label = "Filtered naive IGM sequences (mutations below 2%): ${in_file.name}">
-			<filter>naive_output_cond['naive_output'] == "yes"</filter>
+			<filter>naive_output_cond['naive_output'] is True</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGA"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGG"</filter>
 		</data>
 		<data format="imgt_archive" name="naive_output_igm_naive_memory" label = "Filtered naive memory IGM sequences (mutations over 2%): ${in_file.name}">
-			<filter>naive_output_cond['naive_output'] == "yes"</filter>
+			<filter>naive_output_cond['naive_output'] is True</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGA"</filter>
 			<filter>class_filter_cond['class_filter'] != "101_101_IGG"</filter>
 		</data>
 		<data format="imgt_archive" name="naive_output_all" label = "Filtered IMGT all: ${in_file.name}" >
-		    <filter>naive_output_cond['naive_output'] == "yes"</filter>
+		    <filter>naive_output_cond['naive_output'] is True</filter>
 		    <filter>class_filter_cond['class_filter'] == "101_101"</filter>
 		</data>
 	</outputs>
Binary file show_time_as_float has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/.pytest_cache/.gitignore	Wed Jan 10 12:32:47 2024 +0000
@@ -0,0 +1,2 @@
+# Created by pytest automatically.
+*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/.pytest_cache/CACHEDIR.TAG	Wed Jan 10 12:32:47 2024 +0000
@@ -0,0 +1,4 @@
+Signature: 8a477f597d28d172789f06886806bc55
+# This file is a cache directory tag created by pytest.
+# For information about cache directory tags, see:
+#	https://bford.info/cachedir/spec.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/.pytest_cache/README.md	Wed Jan 10 12:32:47 2024 +0000
@@ -0,0 +1,8 @@
+# pytest cache directory #
+
+This directory contains data from the pytest's cache plugin,
+which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
+
+**Do not** commit this to version control.
+
+See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/.pytest_cache/v/cache/lastfailed	Wed Jan 10 12:32:47 2024 +0000
@@ -0,0 +1,3 @@
+{
+  "test_shm_csr.py::test_baseline_succeeds": true
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/.pytest_cache/v/cache/nodeids	Wed Jan 10 12:32:47 2024 +0000
@@ -0,0 +1,3 @@
+[
+  "test_shm_csr.py::test_baseline_succeeds"
+]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/.pytest_cache/v/cache/stepwise	Wed Jan 10 12:32:47 2024 +0000
@@ -0,0 +1,1 @@
+[]
\ No newline at end of file
Binary file tests/__pycache__/test_shm_csr.cpython-37-pytest-6.2.5.pyc has changed
Binary file tests/__pycache__/test_shm_csr.cpython-39-pytest-7.2.1.pyc has changed
Binary file tests/__pycache__/test_shm_csr.cpython-39-pytest-7.4.4.pyc has changed
--- a/tests/data/.~lock.handleiding activeren pas.docx#	Mon Jan 08 08:50:07 2024 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Vorderman\, R.H.P. (MOLEPI) ,rhpvorderman,sasc-pc-6,21.02.2023 15:01,file:///home/rhpvorderman/.config/libreoffice/4;
\ No newline at end of file
Binary file tests/data/handleiding activeren pas.docx has changed
--- a/tests/test_shm_csr.py	Mon Jan 08 08:50:07 2024 +0000
+++ b/tests/test_shm_csr.py	Wed Jan 10 12:32:47 2024 +0000
@@ -49,8 +49,31 @@
         return files
     return ()
 
-@pytest.fixture(scope="module")
-def shm_csr_result():
+
+def run_shm_csr(
+    input=str(CONTROL_NWK377_PB_IGHC_MID1_40nt_2),
+    infile_name = "input_data",
+    functionality = "productive",
+    unique = "Sequence.ID",
+    naive_output = "no",
+    naive_output_ca = "None",
+    naive_output_cg = "None",
+    naive_output_cm = "None",
+    naive_output_ce = "None",
+    naive_output_all = "None",
+    naive_output_igm_naive = "None",
+    naive_output_igm_naive_memory = "None",
+    filter_unique = "remove",
+    filter_unique_count = '2',
+    class_filter = '70_70',
+    empty_region_filter = 'FR1',
+    # Skip baseline and changeo by default. These tools cannot be modified
+    # anyway and take most of the test time to execute. The environment
+    # variable can be set to "no" on the CI so the code path is tested
+    # at the time a PR is ready.
+    run_changeo = "yes" if os.environ.get("SHM_CSR_FAST") == "no" else "no",
+    run_baseline = "yes" if os.environ.get("SHM_CSR_FAST") == "no" else "no",
+):
     temp_dir = Path(tempfile.mkdtemp())
     tool_dir = temp_dir / "shm_csr"
     shutil.copytree(
@@ -62,29 +85,8 @@
     output_dir = temp_dir / "outputs"
     output_dir.mkdir(parents=True)
     wrapper = str(tool_dir / "wrapper.sh")
-    input = str(CONTROL_NWK377_PB_IGHC_MID1_40nt_2)
     out_files_path = output_dir / "results"
     out_file = out_files_path / "result.html"
-    infile_name = "input_data"
-    functionality = "productive"
-    unique = "Sequence.ID"
-    naive_output = "no"
-    naive_output_ca = "None"
-    naive_output_cg = "None"
-    naive_output_cm = "None"
-    naive_output_ce = "None"
-    naive_output_all = "None"
-    naive_output_igm_naive = "None"
-    naive_output_igm_naive_memory = "None"
-    filter_unique = "remove"
-    filter_unique_count = '2'
-    class_filter = '70_70'
-    empty_region_filter = 'FR1'
-    # Skip baseline and changeo by default. These tools cannot be modified
-    # anyway and take most of the test time to execute. The environment
-    # variable can be set to "no" on the CI so the code path is tested
-    # at the time a PR is ready.
-    fast = os.environ.get("SHM_CSR_FAST", "yes")
     cmd = [
         "bash",
         wrapper,
@@ -108,7 +110,8 @@
         filter_unique_count,
         class_filter,
         empty_region_filter,
-        fast
+        run_changeo,
+        run_baseline
     ]
     docker_cmd = ["docker", "run", "-v", f"{temp_dir}:{temp_dir}",
                   "--rm",  # Remove container after running
@@ -128,7 +131,12 @@
         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)
+    return Path(out_files_path)
+
+
+@pytest.fixture(scope="module")
+def shm_csr_result():
+    yield run_shm_csr()
 
 
 def test_check_output(shm_csr_result):
@@ -157,3 +165,16 @@
                   ) as validate_h:
             for line in result_h:
                 assert line == validate_h.readline()
+
+
+def test_baseline_succeeds():
+    run_shm_csr(
+        functionality="unproductive",
+        empty_region_filter="None",
+        filter_unique="no",
+        unique="VGene,DGene,JGene,CDR3.IMGT.seq",
+        class_filter="101_101_IGA",
+        naive_output="yes",
+        run_baseline="yes",
+        run_changeo="yes",
+    )
Binary file time_ns has changed
--- a/wrapper.sh	Mon Jan 08 08:50:07 2024 +0000
+++ b/wrapper.sh	Wed Jan 10 12:32:47 2024 +0000
@@ -22,7 +22,8 @@
 filter_unique_count=${18}
 class_filter=${19}
 empty_region_filter=${20}
-fast=${21}
+run_changeo=${21}
+run_baseline=${22}
 BASENAME=$(basename "$title")
 # Cut off .txz or .tgz suffix and also replace spaces with underscores.
 NEW_IMGT_PREFIX="new_IMGT_${BASENAME%.*}"
@@ -410,7 +411,7 @@
   rm 1_Summary.txt
 }
 
-if [[ "$fast" == "no" ]] ; then
+if [[ "$run_baseline" == "yes" ]] ; then
 
     
 
@@ -524,7 +525,7 @@
 
 echo "</div>" >> $output #CSR tab end
 
-if [[ "$fast" == "no" ]] ; then
+if [[ "$run_changeo" == "yes" ]] ; then
 
 	echo "---------------- change-o MakeDB ----------------"