require 'maasha/usearch'
casts = []
-casts << {:long=>'identity', :short=>'i', :type=>'float', :mandatory=>true, :default=>0.97, :allowed=>nil, :disallowed=>nil}
-casts << {:long=>'cluster_min', :short=>'c', :type=>'uint', :mandatory=>true, :default=>2, :allowed=>nil, :disallowed=>"0"}
-casts << {:long=>'frequency_min', :short=>'f', :type=>'uint', :mandatory=>true, :default=>2, :allowed=>nil, :disallowed=>"0"}
-casts << {:long=>'quality_min', :short=>'q', :type=>'uint', :mandatory=>true, :default=>20, :allowed=>nil, :disallowed=>nil}
-casts << {:long=>'consensus_min', :short=>'C', :type=>'float', :mandatory=>true, :default=>0.2, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'cluster_ident', :short=>'i', :type=>'float', :mandatory=>true, :default=>0.97, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'cluster_min', :short=>'c', :type=>'uint', :mandatory=>true, :default=>1, :allowed=>nil, :disallowed=>"0"}
+casts << {:long=>'sequence_min', :short=>'s', :type=>'uint', :mandatory=>true, :default=>1, :allowed=>nil, :disallowed=>"0"}
+casts << {:long=>'residue_min', :short=>'r', :type=>'float', :mandatory=>true, :default=>0.3, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'gap_max', :short=>'g', :type=>'float', :mandatory=>true, :default=>0.4, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'quality_min', :short=>'q', :type=>'uint', :mandatory=>true, :default=>10, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'quality_mean', :short=>'Q', :type=>'uint', :mandatory=>true, :default=>15, :allowed=>nil, :disallowed=>nil}
options = Biopieces.options_parse(ARGV, casts)
tmpdir = Biopieces.mktmpdir
fasta_file = File.join(tmpdir, "test.fna")
fasta_file_align = File.join(tmpdir, "test.aln.fna")
+options[:identity] = options[:cluster_ident]
+
def alignment_to_fastq(entries, index)
entries.each do |entry|
cluster, ident, name = entry.seq_name.split('|')
Fasta.open(fasta_file, "w") do |fasta_io|
Fastq.open(fastq_file, "w") do |fastq_io|
input.each_record do |record|
- if record.has_key? :SEQ and record.has_key? :SCORES
+ if record[:SEQ] and record[:SCORES]
entry = Seq.new_bp(record)
entry.seq_name = seq_count.to_s