Skip to content

Commit

Permalink
Fixes #46
Browse files Browse the repository at this point in the history
  • Loading branch information
homonecloco committed Feb 26, 2015
1 parent 7a95df6 commit 1b077fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/bio/db/sam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def view(opts={},&block)
end
command = String.new
command = form_opt_string(@samtools, 'view', opts, [:b, :h, :H, :S, :u, '1', :x, :X, :c, :B])
commad = command + " '#{region}'" if region.size > 0
command = command + " '#{region}'" if region.size > 0
@last_command = command
type = (opts[:u] or opts[:b]) ? :binary : :text
klass = (type == :binary) ? String : Bio::DB::Alignment
Expand Down
12 changes: 11 additions & 1 deletion test/test_sam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,18 @@ def test_fetch

def test_fetch_with_function
#pass the assert to method
block = Proc.new {|a| assert_equal(a.class, Bio::DB::Alignment)}
count = 0
block = Proc.new do |a|
assert_equal(a.class, Bio::DB::Alignment)
count += 1
end

@sam.fetch_with_function("chr_1", 10, 1000, &block)
assert_equal(count, 9)

count = 0
@sam.fetch_with_function("chr_1", 82, 140, &block)
assert_equal(count, 4)
end

def test_chromosome_coverage
Expand Down

0 comments on commit 1b077fa

Please sign in to comment.