changeset 0:6f967c3a3f7b default tip

Uploaded
author edward-kirton
date Thu, 14 Jul 2011 22:05:55 -0400
parents
children
files usearch/ublast.xml usearch/uc2fastax.xml usearch/uclust.xml usearch/uclust_composition.pl usearch/uclust_composition.xml usearch/usearch_sort.xml usearch/usearch_wrapper.sh
diffstat 7 files changed, 538 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usearch/ublast.xml	Thu Jul 14 22:05:55 2011 -0400
@@ -0,0 +1,132 @@
+<tool id="ublast" name="ublast" version="1.0.0">
+<description>Compare query sequences to database</description>
+<command interpreter='bash'>usearch_wrapper.sh
+usearch
+--db $lib.file
+--blast6out $outfile 
+--query $input
+--quiet
+--usersort
+$libonly
+--evalue $evalue
+$nousort
+--maxtargets $maxtargets
+--maxlen $maxlen
+--minlen $minlen
+#if $alphabet.select == 'nucleo':
+$alphabet.rev
+--match $alphabet.match
+--mismatch $alphabet.mismatch
+#end if
+$trunclabels
+$output_rejects
+--id $id
+--maxaccepts $maxaccepts
+--maxrejects $maxrejects
+--bump $bump
+--stepwords $stepwords
+$optimal
+$fastalign
+</command>
+<inputs>
+    <!-- INPUT OPTIONS -->
+    <param name='input' type='data' format='fasta' label='[--input] Input file containing query sequences' />
+    <conditional name='lib'>
+        <param name='select' type='select' label='[-lib] Reference database'>
+            <option value='db_nuc'>Precompiled Nucleotide DB</option>
+            <option value='db_prot'>Precompiled Protein DB</option>
+            <option value='user'>History file</option>
+        </param>
+        <when value='db_nuc'>
+            <param name="file" type="select" label="Precompiled Nucleotide BLAST database">
+                <!-- The BLAST loc file has three columns:
+                     column 0 is an identifier (not used here, see legacy megablast wrapper),
+                     column 1 is the caption (show this to the user),
+                     column 2 is the database path (given to BLAST+) -->
+                <options from_file="blastdb.loc">
+                  <column name="name" index="1"/>
+                  <column name="value" index="2"/>
+                </options>
+            </param>
+        </when>
+        <when value='db_prot'>
+            <param name="file" type="select" label="Precompiled Protein BLAST database">
+                <!-- The BLAST loc file has three columns:
+                     column 0 is an identifier (not used here, see legacy megablast wrapper),
+                     column 1 is the caption (show this to the user),
+                     column 2 is the database path (given to BLAST+) -->
+                <options from_file="blastdb_p.loc">
+                  <column name="name" index="1"/>
+                  <column name="value" index="2"/>
+                </options>
+            </param>
+        </when>
+        <when value='user'>
+            <param name='file' type='data' format='fasta' label='Fasta file'/>
+        </when>
+    </conditional>
+    <param name='libonly' type='select' display='radio' label="Cluster sequences which don't match Db?">
+        <option value='--libonly' selected='true'>[--libonly] Database search without clustering</option>
+        <option value=''>Search database and cluster seqs that don't match</option>
+    </param>
+    <param name='evalue' type='text' value='0.001' label='[--evalue] Expectation value threshold' />
+    <param name='nousort' type='boolean' truevalue='--nousort' falsevalue='' checked='false' label='[--nousort] Do not use U-sort heuristic (may be very slow)' help='UBLAST tests database sequences in order of decreasing number of short words in common with a given query sequence (U-sorted order).  Similar sequences tend to have more words in common, so the first hit found is often the strongest hit in the database, or one of the best.  By default, UBLAST terminates a search when the first hit is found. If checked, UBLAST tests all database sequences using an algorithm very similar to BLASTP or BLASTN. Depending on the database size and other options specified, this may be much slower than using U-sorting' />
+    <param name='maxtargets' type='integer' value='9' label='[--maxtargets] UBLAST will abandon a search if too many database sequences (targets) have been tested without finding a hit. Increasing this value improves sensitivity but reduces speed. If you have, say, millions of proteins and are looking for hits that may have less than 50% identity, then you may get better results with --maxtargets values of 100 or 1000, or even larger.' help='The --maxtargets option is ignored if U-sorting is disabled, i.e. if --nousort is specified' />
+    <param name='maxlen' type='integer' value='10000' label='[--maxlen] Ignore query sequences that are longer than this. UCLUST is currently not designed to handle very long sequences. If you increase this value significantly, then UCLUST may fail due to lack of memory or for other reasons.' help='Let the author know if you have applications that need longer sequence lengths.' />
+    <param name='minlen' type='integer' value='16' label='[--minlen] Ignore query sequences that are shorted than this.' />
+    <conditional name='alphabet'>
+        <param name='select' type='select' label='Sequence alphabet' help='Select to show relevant options'>
+            <option value='amino'>amino acid</option>
+            <option value='nucleo' selected='true'>nucleic acid</option>
+        </param>
+        <when value='amino'>
+        </when>
+        <when value='nucleo'>
+            <param name='rev' type='boolean' truevalue='--rev' falsevalue='' checked='false' label='[--rev] Also search the reverse-complemented sequence' />
+            <param name='match' type='float' value='2.0' label='[--match] Match score for nucleotides' />
+            <param name='mismatch' type='float' value='-1.0' label='[--mismatch] Mismatch score for nucleotides' />
+        </when>
+    </conditional>
+
+    <!-- OUTPUT OPTIONS -->
+    <param name='trunclabels' type='boolean' truevalue='--trunclabels' falsevalue='' checked='true' label='[--trunclabels] Truncate FASTA labels at the first whitespace character' />
+    <param name='output_rejects' type='select' display='radio' label='Write reject records to the .uc file?' help='This is mainly useful for trouble-shooting unexpected results.' >
+        <option value='--nooutput_rejects' selected='true'>[--nooutput_rejects] By default, rejects are not written</option>
+        <option value='--output_rejects'>[--output_rejects] Write rejects to file</option>
+    </param>
+
+    <!-- SEARCH OPTIONS -->
+    <param name='id' type='float' value='0.9' label='[--id] Minimum identity to accept a hit.' help='From 0.0-1.0' />
+    <param name='maxaccepts' type='integer' value='1' label='[--maxaccepts] Keep searching until n hits have been found, then report the best.' help="Default 1. Zero means infinity, i.e. don't stop however many matches have been found (but will stop if the maximum number of rejects has occurred). Use --maxaccepts 0 --maxrejects 0 to force a search of the entire database with every query, this guarantees that the best hit will be found, if one exists." />
+    <param name='maxrejects' type='integer' value='8' label='[--maxrejects] Keep searching until n rejects have occurred, then report a failure to find a hit.' help="Zero means infinity, i.e. keep searching until --maxaccepts hits have been found or all database sequences have been tested." />
+    <param name='bump' type='integer' value='50' label='[--bump] By default, an optimization called "threshold bumping" is used to reduce the search space when many target sequences are found to pass the word count threshold. This may reduce sensitivity slightly, and may increase the probability that the top hit is not found, but often improves speed significantly when the database is large.' help='Use 0 to disable bumping'/>
+    <param name='stepwords' type='integer' value='8' label='[--stepwords] By default, an optimization called "stepping" is used to speed up database searching. This is effective when the number of words in common between the query and target is expected to be large. Then it is expensive to check all words, and stepping selects a subset of words in the query. By default, approximately 8 words are expected to be found in the target sequence.' help='Use 0 to disable stepping.' />
+    <param name='optimal' type='boolean' truevalue='--optimal' falsevalue='' checked='false' label='[--optimal] Same as --maxrejects 0 --maxaccepts 0 --nowordfilter. Guarantees that the best hit will be found.' />
+    <param name='fastalign' type='boolean' truevalue='--fastalign' falsevalue='--nofastalign' checked='true' label='[--fastalign] Use BLAST-like heuristics for fast alignment' />
+</inputs>
+<outputs>
+    <data name='outfile' format='tabular' />
+</outputs>
+<help>
+**What it Does**
+
+Compare each sequence in the query set to the sequences in the library database.  USEARCH can perform nucleotide searches
+(like BLASTN), protein searches (like BLASTP), and translated searches (like BLASTX). Amino acid queries vs nucleotide
+libraries (like tBLASTN) are not supported in this version.
+
+**The libonly option**
+
+Use the libonly option to indicate when query sequences should NOT be added to the reference library (i.e. similar to Blast, etc.).
+
+Unselecting this option invokes the clustering behavior, whereby query sequences without hits are added to the library.
+
+**Author**
+
+Robert C. Edgar (bob@drive5.com)
+
+**Manual**
+
+http://www.drive5.com/usearch/usearch_docs.html
+
+</help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usearch/uc2fastax.xml	Thu Jul 14 22:05:55 2011 -0400
@@ -0,0 +1,23 @@
+<tool id="uc2fastax" name="uc2fastax" version="1.0.0">
+<description>Generate Fasta file from UC file</description>
+<command interpreter='bash'>usearch_wrapper.sh
+usearch --quiet --uc2fastax $uc_file --input $db_file --output $outfile</command>
+<inputs>
+    <param name='uc_file' type='data' format='tabular' label='Usearch UC file' />
+    <param name='db_file' type='data' format='fasta' label='Fasta Db file' />
+</inputs>
+<outputs>
+    <data name='outfile' format='fasta' />
+</outputs>
+<help>
+**What it Does**
+
+Generates a Fasta file of the records in a UC file.  The UC file may be filtered, for example to elminate low-abundance clusters.
+
+Example sequence Fasta header::
+
+	&gt;5|99.5%|XXXX
+
+Where 5 is the cluster ID and 99.5% is the identity to the seed (will be * for the seed itself) and XXXX is the original read ID.
+</help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usearch/uclust.xml	Thu Jul 14 22:05:55 2011 -0400
@@ -0,0 +1,96 @@
+<tool id="uclust" name="uclust" version="1.0.1">
+<description>Cluster sequences by similarity</description>
+<command interpreter='bash'>usearch_wrapper.sh
+usearch --quiet --uc $uc_outfile
+#if $seedsout.select == 'true':
+--seedsout $seeds_outfile
+#end if
+--cluster $input
+$usersort
+--maxlen $maxlen
+--minlen $minlen
+#if $alphabet.select == 'nucleo':
+$alphabet.rev
+--match $alphabet.match
+--mismatch $alphabet.mismatch
+#end if
+$trunclabels
+$output_rejects
+--id $id
+--maxaccepts $maxaccepts
+--maxrejects $maxrejects
+--bump $bump
+--stepwords $stepwords
+$optimal
+$fastalign
+</command>
+<inputs>
+    <!-- INPUT OPTIONS -->
+    <param name='input' type='data' format='fasta' label='[--input] Input file containing query sequences (FASTA format)' help='By default, must be sorted by decreasing sequence length (see --usersort)' />
+    <param name='usersort' type='boolean' truevalue='--usersort' falsevalue='' checked='true' label='[--usersort] By default, UCLUST requires that the input file is sorted by length and will fail if it is not. Specify this option to indicate that file is sorted by some other criteria (or is not sorted at all but you think this is OK). For de novo clustering, input should be sorted so that a suitable seed sequence will appear before other members of the cluster. If the input includes both full-length sequences and fragments, then sorting by decreasing length is usually the best approach.' />
+    <param name='maxlen' type='integer' value='10000' label='[--maxlen] Ignore query sequences that are longer than this. UCLUST is currently not designed to handle very long sequences. If you increase this value significantly, then UCLUST may fail due to lack of memory or for other reasons.' help='Let the author know if you have applications that need longer sequence lengths.' />
+    <param name='minlen' type='integer' value='16' label='[--minlen] Ignore query sequences that are shorted than this.' />
+    <conditional name='alphabet'>
+        <param name='select' type='select' label='Sequence alphabet' help="Select to show relevant options">
+            <option value='amino'>amino acid</option>
+            <option value='nucleo' selected='true'>nucleic acid</option>
+        </param>
+        <when value='amino'>
+        </when>
+        <when value='nucleo'>
+            <param name='rev' type='boolean' truevalue='--rev' falsevalue='' checked='true' label='[--rev] Also search the reverse-complemented sequence' />
+            <param name='match' type='float' value='2.0' label='[--match] Match score for nucleotides' />
+            <param name='mismatch' type='float' value='-1.0' label='[--mismatch] Mismatch score for nucleotides' />
+        </when>
+    </conditional>
+
+    <!-- OUTPUT OPTIONS -->
+    <conditional name='seedsout'>
+        <param name='select' type='select' display='radio' label='Output cluster seeds FASTA?' help='Alternatively, use uc2fasta tool (perhaps after filtering clusters).'>
+            <option value='true'>Yes</option>
+            <option value='false'>No</option>
+        </param>
+        <when value='true'>
+        </when>
+        <when value='false'>
+        </when>
+    </conditional>
+    <param name='trunclabels' type='boolean' truevalue='--trunclabels' falsevalue='' checked='true' label='[--trunclabels] Truncate FASTA labels at the first whitespace character' />
+    <param name='output_rejects' type='select' display='radio' label='Write reject records to the .uc file?' help='This is mainly useful for trouble-shooting unexpected results.' >
+        <option value='--nooutput_rejects' selected='true'>[--nooutput_rejects] By default, rejects are not written</option>
+        <option value='--output_rejects'>[--output_rejects] Write rejects to file</option>
+    </param>
+
+    <!-- SEARCH OPTIONS -->
+    <param name='id' type='float' value='0.97' label='[--id] Minimum identity to accept a hit.' help='From 0.0-1.0' />
+    <param name='maxaccepts' type='integer' value='1' label='[--maxaccepts] Keep searching until n hits have been found, then report the best.' help="Default 1. Zero means infinity, i.e. don't stop however many matches have been found (but will stop if the maximum number of rejects has occurred). Use --maxaccepts 0 --maxrejects 0 to force a search of the entire database with every query, this guarantees that the best hit will be found, if one exists." />
+    <param name='maxrejects' type='integer' value='8' label='[--maxrejects] Keep searching until n rejects have occurred, then report a failure to find a hit.' help="Zero means infinity, i.e. keep searching until --maxaccepts hits have been found or all database sequences have been tested." />
+    <param name='bump' type='integer' value='50' label='[--bump] By default, an optimization called "threshold bumping" is used to reduce the search space when many target sequences are found to pass the word count threshold. This may reduce sensitivity slightly, and may increase the probability that the top hit is not found, but often improves speed significantly when the database is large.' help='Use 0 to disable bumping'/>
+    <param name='stepwords' type='integer' value='8' label='[--stepwords] By default, an optimization called "stepping" is used to speed up database searching. This is effective when the number of words in common between the query and target is expected to be large. Then it is expensive to check all words, and stepping selects a subset of words in the query. By default, approximately 8 words are expected to be found in the target sequence.' help='Use 0 to disable stepping.' />
+    <param name='optimal' type='boolean' truevalue='--optimal' falsevalue='' checked='false' label='[--optimal] Same as --maxrejects 0 --maxaccepts 0 --nowordfilter. Guarantees that the best hit will be found.' />
+    <param name='fastalign' type='boolean' truevalue='--fastalign' falsevalue='--nofastalign' checked='true' label='[--fastalign] Use BLAST-like heuristics for fast alignment' />
+</inputs>
+<outputs>
+    <data name='uc_outfile' format='tabular' />
+    <data name='seeds_outfile' format='fasta' label='Seed sequences'>
+        <filter>seedsout['select'] == 'true'</filter>
+    </data>
+</outputs>
+<help>
+**What it Does**
+
+De novo clustering of sequences.  To do a database search and cluster sequences which don't match, use usearch tool instead.
+
+**Output**
+
+This tool generates the usearch "uc" logfile and a fasta file of dereplicated sequences, named by cluster ID.
+
+**Author**
+
+Robert C. Edgar (bob@drive5.com)
+
+**Manual**
+
+http://www.drive5.com/usearch/usearch_docs.html
+</help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usearch/uclust_composition.pl	Thu Jul 14 22:05:55 2011 -0400
@@ -0,0 +1,211 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+my $usage = <<'ENDHERE';
+NAME:
+    uclust_composition.pl
+PURPOSE:
+    To generate a table of cluster composition by barcode and optionally filter clusters.
+INPUT:
+    --uc <UC> : UCLUST results (*.uc file)
+    --barcodes <Txt|Fasta> : barcode sequences in either Tabular or Fasta format (optional)
+    --min <float> : minimum fraction of reads (per barcode) in order to be included in output (default=0.00001 for 0.001%)
+OUTPUT:
+    --obs <Tsv> : table of cluster and abundance (per barcode if provided)
+    --filtered <UC> : filter UC file
+AUTHOR/SUPPORT:
+    ESKirton@LBL.gov
+ENDHERE
+
+my ( $help, $uc_infile, $outfile, $barcodes_infile, $uc_outfile );
+my $min = 0.00001;
+GetOptions(
+	'uc=s'   => \$uc_infile,
+    'filtered=s' => \$uc_outfile,
+	'outfile=s'  => \$outfile,
+	'barcodes=s' => \$barcodes_infile,
+	'min=f'      => \$min,
+	'help'       => \$help );
+if ($help) { print $usage; exit; }
+die("Infile required\n") unless $uc_infile and -f $uc_infile;
+die("Outfile required\n") unless $outfile;
+
+# LOAD BARCODES
+my %barcode_labels   = ();                  # barcode sequence => name
+my @barcode_labels   = ('UNKNOWN');         # column order
+my %barcode_to_index = ( 'UNKNOWN' => 0 );    # barcode sequence => array index (in @barcode_labels and @obs)
+if ($barcodes_infile)
+{
+	my $barcode;
+	my $label;
+	my $is_fasta = 0;
+	open( IN, "<$barcodes_infile" )
+	  or die("Unable to open barcodes file, $barcodes_infile: $!\n");
+	while (<IN>)
+	{
+		chomp;
+		next if /^#/;
+		next unless $_;
+		if (/^>(\S+)/)
+		{
+			$label    = $1;
+			$is_fasta = 1;
+			while (<IN>)
+			{
+				chomp;
+				$barcode = $_;
+				last;
+			}
+		}
+		elsif ($is_fasta)
+		{
+			die("Barcodes Fasta file must have entire sequence on only one line.\n");
+		}
+		else
+		{
+			( $barcode, $label ) = split(/\t/);
+			$label = $barcode unless $label;
+		}
+		$label =~ s/[_ ]/./g;
+		$barcode = uc($barcode);
+		push @barcode_labels, $barcode_labels{$barcode} = $label;
+		$barcode_to_index{$barcode} = $#barcode_labels;
+	}
+	close IN;
+}
+
+# PARSE UCLUST FILE
+# NOTE: BARCODES MAY BE DISCOVERED HERE (I.E. NOT PRESPECIFIED ABOVE)
+my $tot_unknown_barcodes = 0;
+# $obs[$cluster] = [ obs for barcode 0, obs for barcode 1, ... ] with order matching @labels
+my @obs                  = (); 
+my ( $index, $cluster, $counter, $barcode_label );
+open( IN, "<$uc_infile" ) or die($!);
+while (<IN>)
+{
+	chomp;
+	my @row  = split(/\t/);
+	my $code = $row[0];
+	next unless $code eq 'C' or $code eq 'H';
+	$cluster = $row[1];
+	$obs[$cluster] = [] if !defined( $obs[$cluster] );
+	my $read_id = $row[8];
+	if ( $read_id =~ /^\S+#([ATCGN]+)\/?\d?/ )
+	{
+		my $barcode = uc($1);
+		if ( exists( $barcode_labels{$barcode} ) )
+		{
+			$barcode_label = $barcode_labels{$barcode};
+			$index         = $barcode_to_index{$barcode};
+		}
+		elsif ( ! $barcodes_infile ) 
+		{
+			push @barcode_labels, $barcode_label = $barcode_labels{$barcode} = $barcode;
+			$barcode_to_index{$barcode} = $index = $#barcode_labels;
+		}
+        else 
+        {
+            $barcode_label = 'UNKNOWN';
+            $index         = 0;
+            ++$tot_unknown_barcodes;
+        }
+    }
+	else
+	{
+		$barcode_label = 'UNKNOWN';
+		$index         = 0;
+		++$tot_unknown_barcodes;
+	}
+
+	# INCREMENT COUNTER
+	if ( !defined( $obs[$cluster]->[$index] ) )
+	{
+		$obs[$cluster]->[$index] = 1;
+	}
+	else
+	{
+		$obs[$cluster]->[$index] += 1;
+	}
+}
+close IN;
+
+# DISCARD UNKNOWN CATEGORY IF N/A
+unless ($tot_unknown_barcodes)
+{
+	shift @barcode_labels;
+	for ( my $cluster = 0; $cluster <= $#obs; ++$cluster )
+	{
+		my $a_cluster_obs = $obs[$cluster];
+		shift @$a_cluster_obs;
+	}
+}
+
+# SUM
+my @totals = split( //, '0' x scalar(@barcode_labels) );    # total reads per barcode
+for ( my $cluster = 0; $cluster <= $#obs; ++$cluster )
+{
+	for ( my $i = 0; $i <= $#barcode_labels; $i++ )
+	{
+		$totals[$i] += $obs[$cluster]->[$i] if defined($obs[$cluster]->[$i]);
+	}
+}
+
+# FILTER BY PERCENT
+my @filtered_clusters = ();
+my @filtered_obs = ();
+for ( my $cluster = 0; $cluster <= $#obs; ++$cluster )
+{
+	my $okay = 0;
+	for ( my $i = 0; $i <= $#barcode_labels; $i++ )
+	{
+		my $tot = $totals[$i];
+		my $ob  = $obs[$cluster]->[$i];
+		if ( $ob and $ob / $tot > $min )
+		{
+			$okay = 1;
+			last;
+		}
+	}
+    if ($okay) {
+        push @filtered_clusters, $cluster;
+        my $cluster_obsAR=$obs[$cluster];
+        for ( my $i = 0; $i <= $#barcode_labels; $i++ )
+        {
+            $cluster_obsAR->[$i] = 0 if !defined( $cluster_obsAR->[$i] );
+        }
+        push @filtered_obs, $cluster_obsAR;
+    }
+}
+
+## GENERATE OBSERVED COUNTS TABLE FILE
+open( OUT, ">$outfile" ) or die("Unable to write outfile, $outfile: $!\n");
+print OUT join( "\t", "#CLUSTER", @barcode_labels ), "\n";
+for (my $i=0; $i<=$#filtered_clusters; $i++) {
+	print OUT join( "\t", $filtered_clusters[$i], @{$filtered_obs[$i]} ), "\n";
+}
+close OUT;
+
+## GENERATE UC OUTFILE
+my $next_cluster=shift @filtered_clusters;
+exit unless defined($next_cluster);
+open( IN, "<$uc_infile" ) or die($!);
+open(OUT, ">$uc_outfile") or die($!);
+while (<IN>)
+{
+	my @row  = split(/\t/);
+	my $code = $row[0];
+	next unless $code eq 'C';
+	my $cluster = $row[1];
+    next unless $cluster eq $next_cluster;
+    print OUT $_;
+    last unless @filtered_clusters;
+    $next_cluster=shift @filtered_clusters;
+    last unless defined($next_cluster);
+}
+close IN;
+close OUT;
+
+exit;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usearch/uclust_composition.xml	Thu Jul 14 22:05:55 2011 -0400
@@ -0,0 +1,37 @@
+<tool id="uclust_composition" name="uclust_composition" version="1.0.0">
+<description>Create a table of cluster composition by barcode</description>
+<command interpreter='perl'>uclust_composition.pl --uc $uc_infile --outfile $outfile --min $min --filtered $uc_outfile
+#if $barcodes.select == 'true':
+-barcodes $barcodes.file
+#end if
+</command>
+<inputs>
+    <param name="uc_infile" type="data" format="txt" label="UCLUST results file"/>
+    <param name="min" type="float" value="0.0001" label="Minimum fraction of reads to be included in output" help="Cluster is included if any barcode/sample is above threshold." />
+     <conditional name='barcodes'>
+        <param name='select' type='select' label='Define barcode labels?' help='Otherwise they will be discovered automatically, if present' >
+            <option value='false'>No</option>
+            <option value='true'>Yes</option>
+        </param>
+        <when value='true'>
+            <param name='file' type='data' format='tabular,fasta' label="File with barcode sequences" help="Either tabular or fasta format" />
+        </when>
+        <when value='false'>
+        </when>
+    </conditional>
+</inputs>
+<outputs>
+    <data name="outfile" format='tabular' />
+    <data name="uc_outfile" format="tabular" label="Filtered UC file" />
+</outputs>
+
+<help>
+**What it does**
+
+This tool parses UCLUST output and creates a table of cluster ID and number of members per barcode, plus a UC file with only the seeds of the remaining clusters (use uc2fastax to generate a Fasta file of seeds).
+
+Barcodes are expected to be encoded in the read ID as per Illumina naming convention.
+
+You may predefine the barcodes in order to specify human-readable labels, otherwise the actual sequences will be used.
+</help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usearch/usearch_sort.xml	Thu Jul 14 22:05:55 2011 -0400
@@ -0,0 +1,31 @@
+<tool id="usearch_sort" name="usearch sort" version="1.0.0">
+<description>Sort sequences by decreasing length</description>
+<command interpreter='bash'>usearch_wrapper.sh
+usearch --quiet $trunclabels --mergesort $input --output $output</command>
+<inputs>
+    <param name='input' type='data' format='fasta' label='[--input] Input file containing query sequences (FASTA format)' help='By default, must be sorted by decreasing sequence length (see --usersort)' />
+    <param name='trunclabels' type='boolean' truevalue='--trunclabels' falsevalue='' checked='true' label='[--trunclabels] Truncate FASTA labels at the first whitespace character' />
+</inputs>
+<outputs>
+    <data name='output' format='fasta' />
+</outputs>
+<help>
+**What it Does**
+
+Sorts sequences by decreasing length. 
+
+You should sort sequences before clustering because as the sequences are analyzed, unique sequences seed new clusters and
+it's best to use the longest sequence as the cluster representative.  However for amplicons (i.e. rRNA OTU analysis), 
+this is not the case.  Instead, it is recommend that you sort by cluster abundance instead, as sequences with more copies
+will be least likely to contain sequencing errors.  For this, use the 'usearch sort by abundance' tool.
+
+**Author**
+
+Robert C. Edgar (bob@drive5.com)
+
+**Manual**
+
+http://www.drive5.com/usearch/usearch_docs.html
+
+</help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usearch/usearch_wrapper.sh	Thu Jul 14 22:05:55 2011 -0400
@@ -0,0 +1,8 @@
+#!/bin/bash
+OUTPUT=`$* 2>&1`
+if [ $? -ne 0 ]
+then
+    echo "ERROR: $OUTPUT" 1>&2
+    exit
+fi
+echo $OUTPUT