-my ( $TYPE_HASH, $options, $in, $out, $tmp_dir, $tmp_in, $tmp_out, $q_type, $record, $entry, $fh_in, $fh_out );
-
-$TYPE_HASH = {
- 'L' => 'LibSeed',
- 'S' => 'NewSeed',
- 'H' => 'Hit',
- 'R' => 'Reject',
- 'D' => 'LibCluster',
- 'C' => 'NewCluster',
- 'N' => 'NoHit'
-};
-
-$options = Maasha::Biopieces::parse_options(
- [
- { long => 'database', short => 'd', type => 'file', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
- { long => 'genome', short => 'g', type => 'genome', mandatory => 'no', default => undef, allowed => undef, disallowed => undef },
- { long => 'id', short => 'i', type => 'float', mandatory => 'no', default => '0.90', allowed => undef, disallowed => undef },
- ]
-);
-
-Maasha::Common::error( qq(both --database and --genome specified) ) if $options->{ "genome" } and $options->{ "database" };
-Maasha::Common::error( qq(no --database or --genome specified) ) if not $options->{ "genome" } and not $options->{ "database" };
-
-$in = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
-$out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
-
-$options->{ "database" } = "$ENV{ 'BP_DATA' }/genomes/$options->{ 'genome' }/fasta/$options->{ 'genome' }.fna" if $options->{ 'genome' };
-
-$tmp_dir = Maasha::Biopieces::get_tmpdir();
-$tmp_in = "$tmp_dir/usearch_query.seq";
-$tmp_out = "$tmp_dir/usearch.uc";
-
-$fh_out = Maasha::Filesys::file_write_open( $tmp_in );
-
-while ( $record = Maasha::Biopieces::get_record( $in ) )
-{
- if ( $entry = Maasha::Fasta::biopiece2fasta( $record ) )
- {
- $q_type = Maasha::Seq::seq_guess_type( $record->{ 'SEQ' } ) if not $q_type;
-
- Maasha::Fasta::put_entry( $entry, $fh_out );
- }
-
- Maasha::Biopieces::put_record( $record, $out );
-}
-
-close $fh_out;
-
-
-if ( $options->{ 'verbose' } )
-{
- Maasha::Common::run(
- "uclust",
- join( " ",
- "--input $tmp_in",
- "--lib $options->{ 'database' }",
- "--libonly",
- "--uc $tmp_out",
- "--id $options->{ 'id' }",
- "--rev",
- ),
- 1
- );
-}
-else
-{
- Maasha::Common::run(
- "uclust",
- join( " ",
- "--input $tmp_in",
- "--lib $options->{ 'database' }",
- "--libonly",
- "--uc $tmp_out",
- "--id $options->{ 'id' }",
- "--rev",
- "> /dev/null 2>&1"
- ),
- 1
- );
-}
-
-unlink $tmp_in;
-
-$fh_in = Maasha::Filesys::file_read_open( $tmp_out );
-
-while ( $entry = get_tab_entry( $fh_in ) )
-{
- $record = uclust_tab2biopiece( $entry );
-
- Maasha::Biopieces::put_record( $record, $out ) if $record->{ 'TYPE' } eq 'Hit';
-}
-
-close $fh_out;
+casts = []
+casts << {:long=>'database', :short=>'d', :type=>'file!', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'identity', :short=>'i', :type=>'float', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'e_val', :short=>'e', :type=>'float', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}