11The Basics
22====================================================
33
4- This guide is going to demonstrate building up Galaxy tools wrappers for
5- commands from Heng Li's Seqtk _ package - a package for processing sequence
6- data in FASTA and FASTQ files. For fully worked through Seqtk wrappers -
7- checkout Eric Rasche's `wrappers <https://github.com/galaxyproject/tools-
8- iuc/tree/master/tools/seqtk> `_ on Github.
4+ .. include :: _writing_using_seqtk.rst
95
10- To get started let's install Seqtk, download an example FASTQ file, and test
11- out the a simple Seqtk command - ``seq `` which converts FASTQ files into
12- FASTA. Here we are going to use ``brew `` to install seqtk - but however you
13- obtain it should be fine.
14-
15- ::
16-
17- $ brew tap homebrew/science
18- $ brew install seqtk
19- ==> Installing seqtk from homebrew/homebrew-science
20- ==> Downloading https://github.com/lh3/seqtk/archive/73866e7.tar.gz
21- ######################################################################## 100.0%
22- ==> make
23- /home/john/.linuxbrew/Cellar/seqtk/1.0-r68: 3 files, 208K, built in 2 seconds
24- $ wget https://raw.githubusercontent.com/galaxyproject/galaxy-test-data/master/2.fastq
25- $ seqtk seq
26-
27- Usage: seqtk seq [options] <in.fq>|<in.fa>
28-
29- Options: -q INT mask bases with quality lower than INT [0]
30- -X INT mask bases with quality higher than INT [255]
31- -n CHAR masked bases converted to CHAR; 0 for lowercase [0]
32- -l INT number of residues per line; 0 for 2^32-1 [0]
33- -Q INT quality shift: ASCII-INT gives base quality [33]
34- -s INT random seed (effective with -f) [11]
35- -f FLOAT sample FLOAT fraction of sequences [1]
36- -M FILE mask regions in BED or name list FILE [null]
37- -L INT drop sequences with length shorter than INT [0]
38- -c mask complement region (effective with -M)
39- -r reverse complement
40- -A force FASTA output (discard quality)
41- -C drop comments at the header lines
42- -N drop sequences containing ambiguous bases
43- -1 output the 2n-1 reads only
44- -2 output the 2n reads only
45- -V shift quality by '(-Q) - 33'
46- $ seqtk seq -a 2.fastq > 2.fasta
47- $ cat 2.fasta
48- >EAS54_6_R1_2_1_413_324
49- CCCTTCTTGTCTTCAGCGTTTCTCC
50- >EAS54_6_R1_2_1_540_792
51- TTGGCAGGCCAAGGCCGATGGATCA
52- >EAS54_6_R1_2_1_443_348
53- GTTGCTTCTGGCGTGGGTGGGGGGG
6+ For fully worked through Seqtk wrappers - checkout Eric Rasche's
7+ `wrappers <https://github.com/galaxyproject/tools-iuc/tree/master/tools/seqtk >`__
8+ on Github.
549
5510Galaxy tool files are just simple XML files, so at this point one could just
5611open a text editor and start implementing the tool. Planemo has a command
@@ -74,7 +29,7 @@ like this.
7429.. literalinclude :: writing/seqtk_seq_v1.xml
7530 :language: xml
7631
77- This tool file has the common sections required for Galaxy tool but you will
32+ This tool file has the common sections required for a Galaxy tool but you will
7833still need to open up the editor and fill out the command template, describe
7934input parameters, tool outputs, writeup a help section, etc....
8035
@@ -100,12 +55,7 @@ definitions for the input and output as well as an actual command template.
10055 :language: xml
10156 :emphasize-lines: 8-16
10257
103- As shown above the command ``seqtk seq `` generates a help message for the
104- ``seq `` command. ``tool_init `` can take that help message and stick it right
105- in the generated tool file using the ``help_from_command `` option. Generally
106- command help messages aren't exactly appropriate for Galaxy tool wrappers
107- since they mention argument names and simillar details that are abstracted
108- away by the tool - but they can be a good place to start.
58+ .. include :: _writing_from_help_command.rst
10959
11060::
11161
@@ -120,18 +70,15 @@ away by the tool - but they can be a good place to start.
12070 --cite_url 'https://github.com/lh3/seqtk' \
12171 --help_from_command 'seqtk seq'
12272
73+ In addition to demonstrating ``--help_from_command ``, this demonstrates generating
74+ a test case from our example with ``--test_case `` and additing a citation for the
75+ underlying tool. The resulting tool XML file is:
76+
12377.. literalinclude :: writing/seqtk_seq_v3.xml
12478 :language: xml
12579 :emphasize-lines: 17-58
12680
127- At this point we have a fairly a functional tool with test and help. This was
128- a pretty simple example - usually you will need to put more work into the tool
129- XML to get to this point - ``tool_init `` is really just designed to get you
130- started.
131-
132- Now lets lint and test the tool we have developed. The planemo ``lint `` (or
133- just ``l ``) command will reviews tools for obvious mistakes and compliance
134- with best practices.
81+ .. include :: _writing_lint_intro.rst
13582
13683::
13784
@@ -164,4 +111,3 @@ command. This will print a lot of output but should ultimately reveal our one
164111test passed.
165112
166113.. _DOI : http://www.doi.org/
167- .. _Seqtk : https://github.com/lh3/seqtk
0 commit comments