Class: OpenTox::Model::PropertyLazar

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

#initializePropertyLazar

Returns a new instance of PropertyLazar.



116
117
118
119
120
121
122
123
124
125
# File 'lib/model.rb', line 116

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

Instance Attribute Details

#activitiesObject

, :effects, :p_values



114
115
116
# File 'lib/model.rb', line 114

def activities
  @activities
end

#feature_dataset_uriObject

, :effects, :p_values



114
115
116
# File 'lib/model.rb', line 114

def feature_dataset_uri
  @feature_dataset_uri
end

#featuresObject

, :effects, :p_values



114
115
116
# File 'lib/model.rb', line 114

def features
  @features
end

#propertiesObject

, :effects, :p_values



114
115
116
# File 'lib/model.rb', line 114

def properties
  @properties
end

Class Method Details

.find_allObject



133
134
135
# File 'lib/model.rb', line 133

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

.predict(compound_uri, model_uri) ⇒ Object



137
138
139
140
# File 'lib/model.rb', line 137

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



127
128
129
130
131
# File 'lib/model.rb', line 127

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