Class: OpenTox::Model::Lazar

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

Constant Summary

Constants inherited from Generic

Generic::MODEL_ATTRIBS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Generic

find, to_rdf

Constructor Details

#initializeLazar

Returns a new instance of Lazar.



85
86
87
88
89
90
91
92
93
94
# File 'lib/model.rb', line 85

def initialize
  @source = "http://github.com/helma/opentox-model"
  @algorithm = File.join(@@config[:services]["opentox-algorithm"],"lazar")
  #@independent_variables = File.join(@@config[:services]["opentox-algorithm"],"fminer#BBRC_representative")
  @features = []
  @effects = {}
  @activities = {}
  @p_values = {}
  @fingerprints = {}
end

Instance Attribute Details

#activitiesObject

Returns the value of attribute activities.



83
84
85
# File 'lib/model.rb', line 83

def activities
  @activities
end

#effectsObject

Returns the value of attribute effects.



83
84
85
# File 'lib/model.rb', line 83

def effects
  @effects
end

#feature_dataset_uriObject

Returns the value of attribute feature_dataset_uri.



83
84
85
# File 'lib/model.rb', line 83

def feature_dataset_uri
  @feature_dataset_uri
end

#featuresObject

Returns the value of attribute features.



83
84
85
# File 'lib/model.rb', line 83

def features
  @features
end

#fingerprintsObject

Returns the value of attribute fingerprints.



83
84
85
# File 'lib/model.rb', line 83

def fingerprints
  @fingerprints
end

#p_valuesObject

Returns the value of attribute p_values.



83
84
85
# File 'lib/model.rb', line 83

def p_values
  @p_values
end

Class Method Details

.find_allObject



102
103
104
# File 'lib/model.rb', line 102

def self.find_all
  RestClientWrapper.get(@@config[:services]["opentox-model"]).chomp.split("\n")
end

.predict(compound_uri, model_uri) ⇒ Object



106
107
108
109
# File 'lib/model.rb', line 106

def self.predict(compound_uri,model_uri)
  #RestClientWrapper.post(model_uri,{:compound_uri => compound_uri, :accept => 'application/x-yaml'})
  `curl -X POST -d 'compound_uri=#{compound_uri}' -H 'Accept:application/x-yaml' #{model_uri}`
end

Instance Method Details

#saveObject



96
97
98
99
100
# File 'lib/model.rb', line 96

def save
  @features.uniq!
  resource = RestClient::Resource.new(@@config[:services]["opentox-model"], :user => @@users[:users].keys[0], :password => @@users[:users].values[0])
  resource.post(self.to_yaml, :content_type => "application/x-yaml").chomp.to_s
end