Class: ODDB::State::Interactions::Basket::Check

Inherits:
Object
  • Object
show all
Defined in:
src/state/interactions/basket.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Check) initialize(substance)

, cyp450s)



29
30
31
32
33
34
35
36
37
38
39
# File 'src/state/interactions/basket.rb', line 29

def initialize(substance)#, cyp450s)
  @substance = substance
  @cyp450s = substance.substrate_connections
  while(substance.has_effective_form? && !substance.is_effective_form?)
    substance = substance.effective_form
    @cyp450s = substance.substrate_connections.merge @cyp450s
  end
  @inducers = {}
  @inhibitors = {}
  @observed = {}
end

Instance Attribute Details

- (Object) cyp450s (readonly)

Returns the value of attribute cyp450s



28
29
30
# File 'src/state/interactions/basket.rb', line 28

def cyp450s
  @cyp450s
end

- (Object) inducers (readonly)

Returns the value of attribute inducers



28
29
30
# File 'src/state/interactions/basket.rb', line 28

def inducers
  @inducers
end

- (Object) inhibitors (readonly)

Returns the value of attribute inhibitors



28
29
30
# File 'src/state/interactions/basket.rb', line 28

def inhibitors
  @inhibitors
end

- (Object) observed (readonly)

Returns the value of attribute observed



28
29
30
# File 'src/state/interactions/basket.rb', line 28

def observed
  @observed
end

- (Object) substance (readonly)

Returns the value of attribute substance



28
29
30
# File 'src/state/interactions/basket.rb', line 28

def substance
  @substance
end

Instance Method Details

- (Object) add_interaction(interaction)



40
41
42
43
44
45
46
47
48
49
50
# File 'src/state/interactions/basket.rb', line 40

def add_interaction(interaction)
  # interaction may be a ODBA::Stub 
  case interaction.odba_instance
  when ODDB::CyP450InhibitorConnection
    store_interaction(@inhibitors, interaction)
  when ODDB::CyP450InducerConnection
    store_interaction(@inducers, interaction)
  when ObservedInteraction
    store_interaction(@observed, interaction)
  end
end

- (Object) store_interaction(storage, interaction)



51
52
53
# File 'src/state/interactions/basket.rb', line 51

def store_interaction(storage, interaction)
  (storage[interaction.substance] ||= []).push(interaction)
end