Repository 'assembly'
hg clone https://toolshed.g2.bx.psu.edu/repos/cole_easson/assembly

Changeset 0:f544abf45f8f (2018-02-03)
Next changeset 1:5adf9db15edc (2018-02-03)
Commit message:
Uploaded
added:
velvet-08256557922f/macros.xml
velvet-08256557922f/tool_dependencies.xml
velvet-08256557922f/velvetg.xml
velvet-08256557922f/velvetg_wrapper.py
velvet-08256557922f/velveth.xml
velvet-08256557922f/velveth_wrapper.py
b
diff -r 000000000000 -r f544abf45f8f velvet-08256557922f/macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/velvet-08256557922f/macros.xml Sat Feb 03 13:55:20 2018 -0500
b
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<macros>
+  <xml name="requirements">
+      <requirements>
+          <requirement type="package" version="1.2.10">velvet</requirement>
+      </requirements>
+  </xml>
+  <token name="@WRAPPER_VERSION@">1.2.10</token>
+  <xml name="stdio">
+    <stdio>
+      <!-- Anything other than zero is an error -->
+      <exit_code range="1:"/>
+      <exit_code range=":-1"/>
+      <!-- In case the return code has not been set propery check stderr too -->
+      <regex match="Error:"/>
+      <regex match="Exception:"/>
+    </stdio>
+  </xml>
+  <xml name="citation">
+      <citations>
+          <citation type="doi">
+              10.1101/gr.074492.107
+          </citation>
+      </citations>
+  </xml>
+</macros>
+
b
diff -r 000000000000 -r f544abf45f8f velvet-08256557922f/tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/velvet-08256557922f/tool_dependencies.xml Sat Feb 03 13:55:20 2018 -0500
b
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="velvet" version="1.2.10">
+      <repository changeset_revision="93d32326537b" name="package_velvet_1_2_10" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>
b
diff -r 000000000000 -r f544abf45f8f velvet-08256557922f/velvetg.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/velvet-08256557922f/velvetg.xml Sat Feb 03 13:55:20 2018 -0500
[
b'@@ -0,0 +1,307 @@\n+<tool id="velvetg" name="velvetg" version="@WRAPPER_VERSION@.0">\n+  <description>Velvet sequence assembler for very short reads</description>\n+  <version_command>velvetg 2&gt;&amp;1 | grep "Version" | sed -e \'s/Version //\'</version_command>\n+  <macros>\n+    <import>macros.xml</import>\n+  </macros>\n+  <expand macro="requirements"/>\n+  <expand macro="stdio"/>\n+  <command interpreter="python">\n+    velvetg_wrapper.py\n+           \'$input.extra_files_path\'\n+           #if $generate_amos.afg  == "yes":\n+               -amos_file $generate_amos.afg\n+           #end if\n+           #if $unused_reads.generate_unused  == "yes":\n+               -unused_reads $unused_reads.generate_unused\n+           #end if\n+           $read_trkg\n+           #if $coverage.cutoff == "auto":\n+               -cov_cutoff auto\n+           #elif $coverage.cutoff == "value":\n+               -cov_cutoff $coverage.cov_cutoff\n+           #end if\n+           #if $expected.coverage == "auto":\n+               -exp_cov auto\n+           #elif $expected.coverage == "value":\n+               -exp_cov $expected.exp_cov\n+           #end if\n+           #if $contig_lgth.use_contig_lgth == "yes":\n+               -min_contig_lgth $contig_lgth.min_contig_lgth\n+           #end if\n+           #if $reads.paired == "yes":\n+               #if int($reads.ins_length) > 0:\n+                   -ins_length $reads.ins_length\n+               #end if\n+               #if $reads.options.advanced == "yes":\n+                   #if int($reads.options.ins_length_sd) > 0:\n+                       -ins_length_sd $reads.options.ins_length_sd\n+                   #end if\n+                   #if int($reads.options.ins_length2) > 0:\n+                       -ins_length2 $reads.options.ins_length2\n+                   #end if\n+                   #if int($reads.options.ins_length2_sd) > 0:\n+                       -ins_length2_sd $reads.options.ins_length2_sd\n+                   #end if\n+                   #if int($reads.options.ins_length_long) > 0:\n+                       -ins_length_long $reads.options.ins_length_long\n+                   #end if\n+                   #if int($reads.options.ins_length_long_sd) > 0:\n+                       -ins_length_long_sd $reads.options.ins_length_long_sd\n+                   #end if\n+                   #if int($reads.options.max_branch_length) > 0:\n+                       -max_branch_length $reads.options.max_branch_length\n+                   #end if\n+                   #if int($reads.options.max_divergence) > 0:\n+                       -max_divergence $reads.options.max_divergence\n+                   #end if\n+                   #if int($reads.options.max_gap_count) > 0:\n+                       -max_gap_count $reads.options.max_gap_count\n+                   #end if\n+                   #if int($reads.options.min_pair_count) > 0:\n+                       -min_pair_count $reads.options.min_pair_count\n+                   #end if\n+                   #if int($reads.options.max_coverage) > 0:\n+                       -max_coverage $reads.options.max_coverage\n+                   #end if\n+                   #if int($reads.options.long_mult_cutoff) > 0:\n+                       -long_mult_cutoff $reads.options.long_mult_cutoff\n+                   #end if\n+                   $reads.options.scaffolding\n+               #end if\n+           #end if\n+  </command>\n+  <inputs>\n+    <param name="input" type="data" format="velvet" label="Velvet Dataset" help="Prepared by velveth."/>\n+    <conditional name="generate_amos">\n+      <param name="afg" type="select" label="Generate a AMOS.afg file">\n+        <option value="no">No</option>\n+        <option value="yes">Yes</option>\n+      </param>\n+      <when value="no"/>\n+      <when value="yes"/>\n+    </conditional>\n+\n+    <conditional name="unused_reads">\n+      <param name="generate_unused" type="select" label="Generate a UnusedReads fasta file">\n+        <option value="no">No</option>\n+        <option value="yes">Yes</option>\n+  '..b' given in k-mers. To obtain the length in nucleotides of each node you simply need to add k - 1, where k is the word-length used in velveth.\n+The in and out columns correspond to the number of arcs on the 5\' and 3\' ends of the contig respectively.\n+The coverages in columns short1 cov, short1 Ocov, short2 cov, and short2 Ocov are provided in k-mer coverage (5.1).\n+Also, the difference between # cov and # Ocov is the way these values are computed. In the first count, slightly divergent sequences are added to the coverage tally. However, in the second, stricter count, only the sequences which map perfectly onto the consensus sequence are taken into account.\n+\n+**LastGraph**\n+\n+The *LastGraph* file.\n+This file describes in its entirety the graph produced by Velvet.\n+\n+**AMOS.afg**\n+\n+The *velvet_asm.afg* file.\n+This file is mainly designed to be read by the open-source AMOS genome assembly package. Nonetheless, a number of programs are available to transform this kind of file into other assembly file formats (namely ACE, TIGR, Arachne and Celera). See http://amos.sourceforge.net/ for more information.\n+The file describes all the contigs contained in the contigs.fa file (cf 4.2.1).\n+\n+------\n+\n+**Velvet parameter list**\n+\n+This is a list of implemented Velvetg options::\n+\n+  Standard options:\n+        -cov_cutoff  floating-point|auto : removal of low coverage nodes AFTER tour bus or allow the system to infer it\n+                (default: no removal)\n+        -ins_length  integer             : expected distance between two paired end reads (default: no read pairing)\n+        -read_trkg  yes|no               : tracking of short read positions in assembly (default: no tracking)\n+        -min_contig_lgth  integer        : minimum contig length exported to contigs.fa file (default: hash length * 2)\n+        -amos_file  yes|no               : export assembly to AMOS file (default: no export)\n+        -exp_cov  floating point|auto    : expected coverage of unique regions or allow the system to infer it\n+                (default: no long or paired-end read resolution)\n+\n+  Advanced options:\n+        -ins_length2  integer            : expected distance between two paired-end reads in the second short-read dataset (default: no read pairing)\n+        -ins_length_long  integer        : expected distance between two long paired-end reads (default: no read pairing)\n+        -ins_length*_sd  integer         : est. standard deviation of respective dataset (default: 10% of corresponding length)\n+                [replace \'*\' by nothing, \'2\' or \'_long\' as necessary]\n+        -scaffolding  yes|no             : scaffolding of contigs used paired end information (default: on)\n+        -max_branch_length  integer      : maximum length in base pair of bubble (default: 100)\n+        -max_divergence  floating-point  : maximum divergence rate between two branches in a bubble (default: 0.2)\n+        -max_gap_count  integer          : maximum number of gaps allowed in the alignment of the two branches of a bubble (default: 3)\n+        -min_pair_count  integer         : minimum number of paired end connections to justify the scaffolding of two long contigs (default: 10)\n+        -max_coverage  floating point    : removal of high coverage nodes AFTER tour bus (default: no removal)\n+        -long_mult_cutoff  int           : minimum number of long reads required to merge contigs (default: 2)\n+        -unused_reads  yes|no            : export unused reads in UnusedReads.fa file (default: no)\n+\n+  Output:\n+        directory/contigs.fa             : fasta file of contigs longer than twice hash length\n+        directory/stats.txt              : stats file (tab-spaced) useful for determining appropriate coverage cutoff\n+        directory/LastGraph              : special formatted file with all the information on the final graph\n+        directory/velvet_asm.afg         : (if requested) AMOS compatible assembly file\n+\n+  </help>\n+  <expand macro="citation"/>\n+</tool>\n'
b
diff -r 000000000000 -r f544abf45f8f velvet-08256557922f/velvetg_wrapper.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/velvet-08256557922f/velvetg_wrapper.py Sat Feb 03 13:55:20 2018 -0500
[
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+"""
+Classes encapsulating decypher tool.
+James E Johnson - University of Minnesota
+"""
+import os
+import sys
+import subprocess
+
+assert sys.version_info[:2] >= ( 2, 4 )
+
+def stop_err( msg ):
+    sys.stderr.write( "%s\n" % msg )
+    sys.exit()
+
+
+def __main__():
+    #Parse Command Line
+    working_dir = sys.argv[1]
+    inputs = ' '.join(sys.argv[2:])
+    for _ in ('Roadmaps', 'Sequences'):
+        os.symlink(os.path.join(working_dir, _), _)
+    cmdline = 'velvetg . %s' % (inputs)
+    print "Command to be executed: %s" % cmdline
+    try:
+        proc = subprocess.Popen( args=cmdline, shell=True, stderr=subprocess.PIPE )
+        returncode = proc.wait()
+        # get stderr, allowing for case where it's very large
+        stderr = ''
+        buffsize = 1048576
+        try:
+            while True:
+                stderr += proc.stderr.read( buffsize )
+                if not stderr or len( stderr ) % buffsize != 0:
+                    break
+        except OverflowError:
+            pass
+        if returncode != 0:
+            raise Exception, stderr
+    except Exception, e:
+        stop_err( 'Error running velvetg ' + str( e ) )
+
+
+if __name__ == "__main__":
+    __main__()
b
diff -r 000000000000 -r f544abf45f8f velvet-08256557922f/velveth.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/velvet-08256557922f/velveth.xml Sat Feb 03 13:55:20 2018 -0500
b
@@ -0,0 +1,136 @@
+<tool id="velveth" name="velveth" version="@WRAPPER_VERSION@.0">
+  <description>Prepare a dataset for the Velvet velvetg Assembler</description>
+  <version_command>velveth 2&gt;&amp;1 | grep "Version" | sed -e 's/Version //'</version_command>
+  <macros>
+    <import>macros.xml</import>
+  </macros>
+  <expand macro="requirements"/>
+  <expand macro="stdio"/>
+  <command interpreter="python">
+    velveth_wrapper.py
+           '$out_file1' '$out_file1.extra_files_path'
+           $hash_length
+           $strand_specific
+           #for $i in $inputs
+                ${i.file_format}
+                ${i.read_type}
+                ${i.input}
+           #end for
+  </command>
+  <inputs>
+    <param label="Hash Length" name="hash_length" type="select" help="k-mer length in base pairs of the words being hashed.">
+      <option value="11">11</option>
+      <option value="13">13</option>
+      <option value="15">15</option>
+      <option value="17">17</option>
+      <option value="19">19</option>
+      <option value="21" selected="yes">21</option>
+      <option value="23">23</option>
+      <option value="25">25</option>
+      <option value="27">27</option>
+      <option value="29">29</option>
+    </param>
+    <param name="strand_specific" type="boolean" checked="false" truevalue="-strand_specific" falsevalue="" label="Use strand specific transcriptome sequencing" help="If you are using a strand specific transcriptome sequencing protocol, you may wish to use this option for better results."/>
+    <repeat name="inputs" title="Input Files">
+      <param label="file format" name="file_format" type="select">
+        <option value="-fasta" selected="yes">fasta</option>
+        <option value="-fastq">fastq</option>
+        <option value="-eland">eland</option>
+        <option value="-gerald">gerald</option>
+      </param>
+      <param label="read type" name="read_type" type="select">
+        <option value="-short" selected="yes">short reads</option>
+        <option value="-shortPaired">shortPaired reads</option>
+        <option value="-short2">short2 reads</option>
+        <option value="-shortPaired2">shortPaired2 reads</option>
+        <option value="-long">long reads</option>
+        <option value="-longPaired">longPaired reads</option>
+      </param>
+
+      <param name="input" type="data" format="fasta,fastq,eland,gerald" label="Dataset"/>
+    </repeat>
+  </inputs>
+  <outputs>
+    <data format="velvet" name="out_file1" />
+  </outputs>
+  <requirements>
+    <requirement type="package">velvet</requirement>
+  </requirements>
+  <tests>
+    <test>
+      <param name="hash_length" value="21" />
+      <param name="read_type" value="-shortPaired" />
+      <!-- <repeat name="inputs"> -->
+      <param name="file_format" value="fasta" />
+      <param name="read_type" value="shortPaired reads" />
+      <param name="input" value="velvet_test_reads.fa" ftype="fasta" />
+      <!-- </repeat> -->
+      <param name="strand_specific" value="" />
+      <output name="out_file1" file="velveth_test1/output.html" lines_diff="4">
+        <extra_files type="file" name='Sequences' value="velveth_test1/Sequences" compare="diff" />
+        <extra_files type="file" name='Roadmaps' value="velveth_test1/Roadmaps" compare="diff" />
+      </output>
+    </test>
+  </tests>
+  <help>
+
+**What it does**
+
+Velvet_ is a de novo genomic assembler specially designed for short read sequencing technologies, such as Solexa or 454, developed by Daniel Zerbino and Ewan Birney at the European Bioinformatics Institute (EMBL-EBI), near Cambridge, in the United Kingdom.
+
+Velvet currently takes in short read sequences, removes errors then produces high quality unique contigs. It then uses paired-end read and long read information, when available, to retrieve the repeated areas between contigs.
+
+Read the Velvet `documentation`__ for details on using the Velvet Assembler.
+
+.. _Velvet: http://www.ebi.ac.uk/~zerbino/velvet/
+
+.. __: http://www.ebi.ac.uk/~zerbino/velvet/Manual.pdf
+
+------
+
+**Velveth**
+
+Velveth takes in a number of sequence files, produces a hashtable, then outputs two files in an output directory (creating it if necessary), Sequences and Roadmaps, which are necessary to velvetg.
+
+------
+
+**Hash Length**
+
+The hash length, also known as k-mer length, corresponds to the length, in base pairs, of the words being hashed.
+
+The hash length is the length of the k-mers being entered in the hash table. Firstly, you must observe three technical constraints::
+
+# it must be an odd number, to avoid palindromes. If you put in an even number, Velvet will just decrement it and proceed.
+# it must be below or equal to MAXKMERHASH length (cf. 2.3.3, by default 31bp), because it is stored on 64 bits
+# it must be strictly inferior to read length, otherwise you simply will not observe any overlaps between reads, for obvious reasons.
+
+Now you still have quite a lot of possibilities. As is often the case, it's a trade- off between specificity and sensitivity. Longer kmers bring you more specificity (i.e. less spurious overlaps) but lowers coverage (cf. below). . . so there's a sweet spot to be found with time and experience.
+We like to think in terms of "k-mer coverage", i.e. how many times has a k-mer been seen among the reads. The relation between k-mer coverage Ck and standard (nucleotide-wise) coverage C is Ck = C # (L - k + 1)/L where k is your hash length, and L you read length.
+Experience shows that this kmer coverage should be above 10 to start getting decent results. If Ck is above 20, you might be "wasting" coverage. Experience also shows that empirical tests with different values for k are not that costly to run!
+
+**Input Files**
+
+Velvet works mainly with fasta and fastq formats. For paired-end reads, the assumption is that each read is next to its mate
+read. In other words, if the reads are indexed from 0, then reads 0 and 1 are paired, 2 and 3, 4 and 5, etc.
+
+Supported file formats are::
+
+  fasta
+  fastq
+  fasta.gz
+  fastq.gz
+  eland
+  gerald
+
+Read categories are::
+
+  short (default)
+  shortPaired
+  short2 (same as short, but for a separate insert-size library)
+  shortPaired2 (see above)
+  long (for Sanger, 454 or even reference sequences)
+  longPaired
+
+  </help>
+  <expand macro="citation"/>
+</tool>
b
diff -r 000000000000 -r f544abf45f8f velvet-08256557922f/velveth_wrapper.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/velvet-08256557922f/velveth_wrapper.py Sat Feb 03 13:55:20 2018 -0500
[
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+"""
+Classes encapsulating decypher tool.
+James E Johnson - University of Minnesota
+"""
+import pkg_resources
+import logging, os, string, sys, tempfile, glob, shutil, types, urllib
+import shlex, subprocess
+from optparse import OptionParser, OptionGroup
+from stat import *
+
+
+log = logging.getLogger( __name__ )
+
+assert sys.version_info[:2] >= ( 2, 4 )
+
+def stop_err( msg ):
+    sys.stderr.write( "%s\n" % msg )
+    sys.exit()
+
+def __main__():
+    #Parse Command Line
+    s = 'velveth_wrapper.py:  argv = %s\n' % (sys.argv)
+    argcnt = len(sys.argv)
+    html_file = sys.argv[1]
+    working_dir = sys.argv[2]
+    try: # for test - needs this done
+        os.makedirs(working_dir)
+    except Exception, e:
+        stop_err( 'Error running velveth ' + str( e ) )
+    hash_length = sys.argv[3]
+    inputs = string.join(sys.argv[4:],' ')
+    cmdline = 'velveth %s %s %s > /dev/null' % (working_dir, hash_length, inputs)
+    try:
+        proc = subprocess.Popen( args=cmdline, shell=True, stderr=subprocess.PIPE )
+        returncode = proc.wait()
+        # get stderr, allowing for case where it's very large
+        stderr = ''
+        buffsize = 1048576
+        try:
+            while True:
+                stderr += proc.stderr.read( buffsize )
+                if not stderr or len( stderr ) % buffsize != 0:
+                    break
+        except OverflowError:
+            pass
+        if returncode != 0:
+            raise Exception, stderr
+    except Exception, e:
+        stop_err( 'Error running velveth ' + str( e ) )
+    sequences_path = os.path.join(working_dir,'Sequences')
+    roadmaps_path = os.path.join(working_dir,'Roadmaps')
+    rval = ['<html><head><title>Velvet Galaxy Composite Dataset </title></head><p/>']
+    rval.append('<div>%s<p/></div>' % (cmdline) )
+    rval.append('<div>This composite dataset is composed of the following files:<p/><ul>')
+    rval.append( '<li><a href="%s" type="text/plain">%s </a>%s</li>' % (sequences_path,'Sequences','Sequences' ) )
+    rval.append( '<li><a href="%s" type="text/plain">%s </a>%s</li>' % (roadmaps_path,'Roadmaps','Roadmaps' ) )
+    rval.append( '</ul></div></html>' )
+    f = file(html_file,'w')
+    f.write("\n".join( rval ))
+    f.write('\n')
+    f.close()
+
+if __name__ == "__main__": __main__()