Skip to content

Commit

Permalink
add #genotype
Browse files Browse the repository at this point in the history
  • Loading branch information
misshie committed Sep 11, 2011
1 parent 8cacfa5 commit b693bc0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 140 deletions.
10 changes: 10 additions & 0 deletions lib/bio/NCBI/dbsnp/bitfield.rb
Expand Up @@ -105,6 +105,16 @@ def allele_frequency
res
end

# field F5
def genotype
fld = field(5)
res = Array.new
res << :high_density if bit? fld, 0b0100
res << :haplotype_tagging_set if bit? fld, 0b0010
res << :available if bit? fld, 0b0001
res
end

# field F8
def variation_class
case (field(8) & 0b0000_1111)
Expand Down
1 change: 0 additions & 1 deletion lib/bio/dbsnp.rb

This file was deleted.

129 changes: 0 additions & 129 deletions lib/bio/dbsnp/bitfield.rb

This file was deleted.

18 changes: 8 additions & 10 deletions spec/bio-dbsnp_spec.rb
Expand Up @@ -115,16 +115,14 @@
end
end

# describe "#genotype [F5]" do
# context "given a string '05_0300_0003_01_04_04_00_00_01_00' of rs55874132 for .parse" do
# it "returns an array containing :reference, :synonymous" do
# obj = Bio::NCBI::Dbsnp::Bitfield.parse('05_0300_0003_01_04_04_00_00_01_00')
# obj.genotype.should include(:high_density)
# end
# end
# end


describe "#genotype [F5]" do
context "given a string '05_0300_0003_01_04_04_00_00_01_00' of rs55874132 for .parse" do
it "returns an array containing :reference, :synonymous" do
obj = Bio::NCBI::Dbsnp::Bitfield.parse('05_0300_0003_01_04_04_00_00_01_00')
obj.genotype.should include(:high_density)
end
end
end

end
end

0 comments on commit b693bc0

Please sign in to comment.