Permalink
Browse files

More tutorial testing, tutorial updates.

  • Loading branch information...
jmchilton committed May 24, 2018
1 parent e8a860c commit 016b92348097ed93a1d22ee54f1b18d32ad1beb8
@@ -53,6 +53,8 @@ to check if a tool contains only best-practice ``requirement`` tags. The ``lint`
command can also be fed the ``--biocontainers`` flag to check if a
BioContainers_ container has been registered that is compatible with that tool.

.. include:: _writing_containers_linter_explain.rst

The Conda exercises project template has an example tool (``exercise3``) that we
can use to demonstrate ``--biocontainers``. If you are continuing from the Conda
tutorial, simply move to ``../exercise3`` otherwise using ``planemo project_init``
@@ -79,8 +81,6 @@ to grab the exercise as show below.
.. INFO: BioContainer best-practice container found [quay.io/biocontainers/seqtk:1.2--1].
Failed linting

.. include:: _writing_containers_linter_explain.rst

::

$ planemo test --biocontainers seqtk_seq.cwl
@@ -1,15 +1,13 @@
#!/bin/bash

SCRIPTS_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_DIRECTORY="${SCRIPTS_DIRECTORY}/../.."

set -o xtrace

set -e

shopt -s expand_aliases # Needed for conda_env test

# Preconditions:
# - seqtk not on PATH
# - seqtk_example doesn't exist and in home directory
# - conda_exercises doesn't exist in home directory.
# - seqtk environment is absent
@@ -24,8 +22,7 @@ conda remove --force --yes --name '__seqtk@1.2' --all || true

echo "Setup completed seqtk example"
# TODO: project_init once in master branch
# planemo project_init --template=seqtk_complete_cwl seqtk_example
cp -r $PROJECT_DIRECTORY/project_templates/seqtk_complete_cwl seqtk_example
planemo project_init --template=seqtk_complete_cwl seqtk_example
cd seqtk_example

echo "Check conda_requirements - should see them linting properly"
@@ -52,8 +49,7 @@ planemo test --no-container seqtk_seq.cwl
cd

# TODO: project_init once in master branch
# planemo project_init --template conda_exercises_cwl conda_exercises
cp -r $PROJECT_DIRECTORY/project_templates/conda_exercises_cwl conda_exercises
planemo project_init --template conda_exercises_cwl conda_exercises
cd conda_exercises/exercise_1

ls
@@ -1,37 +1,47 @@
#!/bin/bash

SCRIPTS_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_DIRECTORY="${SCRIPTS_DIRECTORY}/../.."

set -o xtrace

set -e

# Preconditions
# - seqtk not on PATH
# - Planemo installed
# - seqtk_example directory doesn't exist in the home directory.
# - conda_exercises directory doesn't exist in the home directory.
# - conda_answers directory doesn't exist in the home directory.
# - conda_testing directory doesn't exist in the home directory
# - docker running and sudo-less access available via the docker command.

cd
rm -rf conda_exercises
rm -rf conda_answers_cwl
rm -rf conda_testing


echo "Setup completed seqtk example"
# TODO: project_init once in master branch
# planemo project_init --template=conda_exercies_cwl conda_exercies
cp -r $PROJECT_DIRECTORY/project_templates/conda_exercies_cwl conda_exercies
planemo project_init --template=conda_exercies_cwl conda_exercies
cd conda_exercies

cd conda_exercises/exercise_3

echo "We should see biocontainer found for this tool, but not a Docker container"
planemo lint --biocontainers seqtk_seq.cwl | true

echo "This should pass and we should see container was used."
planemo test --biocontainers --engine cwltool seqtk_seq.cwl
planemo test --biocontainers seqtk_seq.cwl

echo "This should fail without biocontainers"
planemo test seqtk_seq.cwl

cd ..

echo "Run seqtk exercise answers"
planemo project_init --template=conda_answers_cwl conda_answers
cd conda_answers/exercise_3

planemo lint --biocontainers seqtk_seq.cwl
planemo test seqtk_seq.cwl


planemo project_init --template=conda_testing_cwl conda_testing
cd conda_testing/
echo "Should show quay.io/biocontainers/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:03dc1d2818d9de56938078b8b78b82d967c1f820-0 is built"
@@ -0,0 +1,94 @@
#!/usr/bin/env cwl-runner
cwlVersion: 'v1.0'
class: CommandLineTool
id: "seqtk_seq"
label: "Convert to FASTA (seqtk)"
hints:
DockerRequirement:
dockerPull: quay.io/biocontainers/seqtk:1.2--1
SoftwareRequirement:
packages:
- package: seqtk
version:
- "1.2"
inputs:
input1:
type: File
doc: |
Input FASTA file.
inputBinding:
position: 1
prefix: "-a"
outputs:
output1:
type: File
outputBinding:
glob: out
baseCommand:
- "seqtk"
- "seq"
arguments: []
stdout: out
doc: |

Usage: seqtk seq [options] <in.fq>|<in.fa>

Options: -q INT mask bases with quality lower than INT [0]
-X INT mask bases with quality higher than INT [255]
-n CHAR masked bases converted to CHAR; 0 for lowercase [0]
-l INT number of residues per line; 0 for 2^32-1 [0]
-Q INT quality shift: ASCII-INT gives base quality [33]
-s INT random seed (effective with -f) [11]
-f FLOAT sample FLOAT fraction of sequences [1]
-M FILE mask regions in BED or name list FILE [null]
-L INT drop sequences with length shorter than INT [0]
-c mask complement region (effective with -M)
-r reverse complement
-A force FASTA output (discard quality)
-C drop comments at the header lines
-N drop sequences containing ambiguous bases
-1 output the 2n-1 reads only
-2 output the 2n reads only
-V shift quality by '(-Q) - 33'
-U convert all bases to uppercases
-S strip of white spaces in sequences

$namespaces:
s: http://schema.org/
$schemas:
- http://schema.org/docs/schema_org_rdfa.html

s:mainEntity:
class: s:SoftwareSourceCode
s:name: seqtk
s:about: 'Toolkit for processing sequences in FASTA/Q formats'
s:url: https://github.com/lh3/seqtk
s:codeRepository: https://github.com/lh3/seqtk

s:license:
- https://opensource.org/licenses/MIT

s:targetProduct:
class: s:SoftwareApplication
s:softwareVersion: "1.2"
s:applicationCategory: commandline tool
s:programmingLanguage: C
s:publication:
- class: s:ScholarlyArticle
id: http://dx.doi.org/10.1093/bioinformatics/bts635

s:author:
- class: s:Person
s:name: "Heng Li"
s:sameAs:
- id: https://orcid.org/0000-0003-4874-2874

s:downloadUrl: https://github.com/galaxyproject/planemo/blob/master/project_templates/seqtk_complete_cwl/seqtk_seq.cwl
s:codeRepository: https://github.com/galaxyproject/planemo

s:author:
class: s:Person
s:name: John Chilton
s:email: mailto:jmchilton@gmail.com
s:sameAs:
- id: https://orcid.org/0000-0002-6794-0756
@@ -0,0 +1,4 @@

input1:
class: File
path: test-data/2.fastq
@@ -0,0 +1,6 @@

- doc: test generated from example command
job: seqtk_seq_job.json
outputs:
output1:
path: test-data/2.fasta
@@ -0,0 +1,6 @@
>EAS54_6_R1_2_1_413_324
CCCTTCTTGTCTTCAGCGTTTCTCC
>EAS54_6_R1_2_1_540_792
TTGGCAGGCCAAGGCCGATGGATCA
>EAS54_6_R1_2_1_443_348
GTTGCTTCTGGCGTGGGTGGGGGGG
@@ -0,0 +1,12 @@
@EAS54_6_R1_2_1_413_324
CCCTTCTTGTCTTCAGCGTTTCTCC
+
;;3;;;;;;;;;;;;7;;;;;;;88
@EAS54_6_R1_2_1_540_792
TTGGCAGGCCAAGGCCGATGGATCA
+
;;;;;;;;;;;7;;;;;-;;;3;83
@EAS54_6_R1_2_1_443_348
GTTGCTTCTGGCGTGGGTGGGGGGG
+EAS54_6_R1_2_1_443_348
;;;;;;;;;;;9;7;;.7;393333
@@ -0,0 +1,4 @@

input1:
class: File
path: test-data/2.fastq
@@ -1,9 +1,6 @@

- doc: test generated from example command
job:
input1:
class: File
path: test-data/2.fastq
job: seqtk_seq_job.json
outputs:
output1:
path: test-data/2.fasta
@@ -0,0 +1,28 @@
#!/bin/bash

# Usage: DOC_TEST_RUNNER="https://raw.githubusercontent.com/galaxyproject/planemo/master/scripts/run_doc_test.sh"
# DOCS=building bash <(curl -s "$DOC_TEST_RUNNER")
# DOCS=conda bash <(curl -s "$DOC_TEST_RUNNER")
# DOCS=conda_cwl bash <(curl -s "$DOC_TEST_RUNNER")

set -e

: ${PLANEMO_TARGET:="."}
: ${PLANEMO_VIRTUAL_ENV:=".venv-doc-tests"}
: ${DOCS:="building"}

# Ensure Planemo is installed.
if [ ! -d "${PLANEMO_VIRTUAL_ENV}" ]; then
virtualenv "${PLANEMO_VIRTUAL_ENV}"
. "${PLANEMO_VIRTUAL_ENV}"/bin/activate
pip install -U pip>7
# Intentionally expand wildcards in PLANEMO_TARGET.
shopt -s extglob
pip install ${PLANEMO_TARGET}
fi
. "${PLANEMO_VIRTUAL_ENV}"/bin/activate

planemo conda_init | true
export PATH="$HOME/miniconda3/bin:$PATH"

bash docs/tests/tests_"${DOCS}".sh
@@ -1,5 +1,7 @@
#!/bin/bash

# Usage: http://planemo.readthedocs.io/en/latest/test_format.html#galaxy-testing-template

: ${PLANEMO_TARGET:="planemo==0.52.0"}
: ${PLANEMO_OPTIONS:=""} # e.g. PLANEMO_OPTIONS="--verbose"
: ${PLANEMO_PROFILE_NAME:="wxflowtest"}
@@ -8,19 +10,20 @@
: ${PLANEMO_TEST_STYLE:="serve_and_test"} # profile_serve_and_test, serve_and_test, docker_serve_and_test, test, docker_test, docker_test_path_paste
: ${PLANEMO_SERVE_DATABASE_TYPE:="postgres"} # used if not using Docker with PLANEMO_TEST_STYLE
: ${PLANEMO_DOCKER_GALAXY_IMAGE:="quay.io/bgruening/galaxy:18.01"} # used if used Docker with PLANEMO_TEST_STYLE
: ${PLANEMO_VIRTUAL_ENV:=".venv"}

GALAXY_URL="http://localhost:$PLANEMO_SERVE_PORT"

# Ensure Planemo is installed.
if [ ! -d .venv ]; then
virtualenv .venv
. .venv/bin/activate
pip install -U pip
if [ ! -d "${PLANEMO_VIRTUAL_ENV}" ]; then
virtualenv "${PLANEMO_VIRTUAL_ENV}"
. "${PLANEMO_VIRTUAL_ENV}"/bin/activate
pip install -U pip>7
# Intentionally expand wildcards in PLANEMO_TARGET.
shopt -s extglob
pip install ${PLANEMO_TARGET}
fi
. .venv/bin/activate
. "${PLANEMO_VIRTUAL_ENV}"/bin/activate

# Run test.
# This example shows off a bunch of different ways one could test with Planemo,

0 comments on commit 016b923

Please sign in to comment.