Class: Qu::Pcr::VirtualGel

Inherits:
Object
  • Object
show all
Defined in:
lib/qu/pcr.rb

Constant Summary collapse

PARA =
{
  0.5 => {
  'a' => 2.7094,
  'b' => 0.2691,
  'k' => 464.4412
},
  1.0 => {
  'a' => 2.3977,
  'b' => 0.2700,
  'k' => 73.9788
},
  1.5 => {
  'a' => 2.3221,
  'b' => 0.2634,
  'k' => 48.0873
},
  2.0 => {
  'a' => 2.1333,
  'b' => 0.2561,
  'k' => 18.5417
}}

Class Method Summary collapse

Class Method Details

.cal_mobility(size, gel_conc = 1.0, ref_mobility = 50) ⇒ Object



80
81
82
83
# File 'lib/qu/pcr.rb', line 80

def self.cal_mobility(size, gel_conc=1.0, ref_mobility=50)
  a, b, k = get_para(gel_conc)
  return ((a - b * Math.log(size + k)) * ref_mobility.to_f).round(2)
end

.cal_size(mobility, gel_conc = 1.0, ref_mobility = 50) ⇒ Object



85
86
87
88
# File 'lib/qu/pcr.rb', line 85

def self.cal_size(mobility, gel_conc=1.0, ref_mobility=50)
  a, b, k = get_para(gel_conc)
  return (Math.exp((a - mobility / ref_mobility.to_f) / b) - k).round
end

.cal_size_range(size, offset = 2, gel_conc = 1.0, ref_mobility = 50) ⇒ Object



90
91
92
93
94
95
# File 'lib/qu/pcr.rb', line 90

def self.cal_size_range(size, offset=2, gel_conc=1.0, ref_mobility=50)
  y = cal_mobility(size, gel_conc, ref_mobility)
  x_min = cal_size(y + offset, gel_conc, ref_mobility)
  x_max = cal_size(y - offset, gel_conc, ref_mobility)
  return x_min, x_max
end

.get_para(gel_conc) ⇒ Object



73
74
75
76
77
78
# File 'lib/qu/pcr.rb', line 73

def self.get_para(gel_conc)
  a = PARA[gel_conc]['a']
  b = PARA[gel_conc]['b']
  k = PARA[gel_conc]['k']
  return a, b, k
end