Class: Bio::Go::SubsumeTester

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(go_object, subsumer_go_id, check_for_synonym = true) ⇒ SubsumeTester

Returns a new instance of SubsumeTester.



144
145
146
147
148
149
150
151
152
153
154
# File 'lib/go.rb', line 144

def initialize(go_object, subsumer_go_id, check_for_synonym=true)
  @go = go_object

  if check_for_synonym
    @master_go_id = @go.primary_go_id(subsumer_go_id)
  else
    @master_go_id = subsumer_go_id
  end
  @subsumer_offspring = @go.go_offspring(@master_go_id)
  @subsumer_offspring_hash = [@subsumer_offspring].flatten.to_hash
end

Instance Attribute Details

#master_go_idObject (readonly)

Returns the value of attribute master_go_id.



142
143
144
# File 'lib/go.rb', line 142

def master_go_id
  @master_go_id
end

#subsumer_offspringObject (readonly)

Returns the value of attribute subsumer_offspring.



142
143
144
# File 'lib/go.rb', line 142

def subsumer_offspring
  @subsumer_offspring
end

Instance Method Details

#subsume?(subsumer_go_id, check_for_synonym = true) ⇒ Boolean

Returns:

  • (Boolean)


156
157
158
159
160
161
162
# File 'lib/go.rb', line 156

def subsume?(subsumer_go_id, check_for_synonym=true)
  primaree = check_for_synonym ?
    @go.primary_go_id(subsumer_go_id) :
    subsumer_go_id
  return true if @master_go_id == primaree
  @subsumer_offspring_hash.has_key?(primaree)
end