spec/cli_spec.rb in lederhosen-2.0.0 vs spec/cli_spec.rb in lederhosen-2.0.1

- old
+ new

@@ -31,39 +31,39 @@ end it 'can separate unclassified reads from usearch output' do `./bin/lederhosen separate_unclassified --uc-file=spec/data/test.uc --reads=spec/data/trimmed/ILT_L_9_B_001.fasta --output=#{$test_dir}/unclassified.fasta` $?.success?.should be_true - unclassified_results = File.readlines("spec/data/test.uc") - .select { |x| x =~ /^N/ } + unclassified_results = File.readlines("spec/data/test.uc")\ + .select { |x| x =~ /^N/ }\ .size - unclassified_reads = File.readlines("#{$test_dir}/unclassified.fasta") - .select { |x| x =~ /^>/ } + unclassified_reads = File.readlines("#{$test_dir}/unclassified.fasta")\ + .select { |x| x =~ /^>/ }\ .size unclassified_results.should == unclassified_reads end it 'can separate unclassified reads from usearch output using strict pairing' do `./bin/lederhosen separate_unclassified --strict=genus --uc-file=spec/data/test.uc --reads=spec/data/trimmed/ILT_L_9_B_001.fasta --output=#{$test_dir}/unclassified.strict_genus.fasta` $?.success?.should be_true - File.readlines("#{$test_dir}/unclassified.strict_genus.fasta") - .select { |x| x =~ /^>/ } + File.readlines("#{$test_dir}/unclassified.strict_genus.fasta")\ + .select { |x| x =~ /^>/ }\ .size.should be_even end it 'can create taxonomy count tables' do `./bin/lederhosen count_taxonomies --input=spec/data/test.uc --output=#{$test_dir}/taxonomy_count.txt` $?.success?.should be_true File.exists?(File.join($test_dir, 'taxonomy_count.txt')).should be_true end it 'generates taxonomy tables w/ comma-free taxonomic descriptions' do - File.readlines(File.join($test_dir, 'taxonomy_count.txt')) - .map(&:strip) - .map { |x| x.count(',') } - .uniq + File.readlines(File.join($test_dir, 'taxonomy_count.txt'))\ + .map(&:strip)\ + .map { |x| x.count(',') }\ + .uniq\ .should == [1] end %w{domain phylum class order family genus species}.each do |level| it "generates taxonomy tables only counting pairs that agree at level: #{level}" do @@ -72,14 +72,14 @@ lines = File.readlines(File.join($test_dir, "taxonomy_count.strict.#{level}.txt")) # make sure total number of reads is even # requires that there should be an odd number if classification is not strict - lines.select { |x| !(x =~ /^#/) } - .map(&:strip) - .map { |x| x.split(',') } - .map(&:last) - .map(&:to_i) + lines.select { |x| !(x =~ /^#/) }\ + .map(&:strip)\ + .map { |x| x.split(',') }\ + .map(&:last)\ + .map(&:to_i)\ .inject(:+).should be_even end end %w{domain phylum class order family genus species}.each do |level|