Poodle

A Ruby interface to ABO blood group system.

Circle CI

Installation

Add this line to your application's Gemfile:

gem 'poodle'

And then execute:

$ bundle

Or install it yourself as:

$ gem install poodle

Usage

It gives you a combination of a pair of blood types given by using symbols. The symbols :a,:b,:o and :ab are available for blood types. If the genotype option is true (false by default), it returns an array of values in genotype format (phenotype by default).

require 'poodle'

# By default, it returns an array of values described by the term "phenotype".
poodle = Poodle.new(:a, :b)
poodle.inherit
#=> ["AB", "A", "B", "O"]

# If the 'genotype' option is true, 
# it returns an array of values described by the term "genotype".
poodle = Poodle.new(:a, :b, genotype: true)
poodle.inherit
#=> ["AB", "AO", "BO", "OO"]

# The 'inherit_with_rate' method returns a hash, 
# a key/value pair of blood type and its probability.  
poodle = Poodle.new(:a, :b)
poodle.inherit_with_rate
#=> {"AB"=>0.5625, "A"=>0.1875, "B"=>0.1875, "O"=>0.0625}

# It returns a collection of blood types in genetype. 
poodle = Poodle.new(:a, :b, genotype: true)
poodle.inherit_with_rate
#=> {"AB"=>0.5625, "AO"=>0.1875, "BO"=>0.1875, "OO"=>0.0625}

Contributing

  1. Fork it ( https://github.com/[my-github-username]/poodle/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request