Class: OpenTox::LazarPrediction

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

Overview

Class with special methods for lazar prediction datasets

Instance Attribute Summary

Attributes inherited from Dataset

#compounds, #data_entries, #features, #metadata

Attributes included from OpenTox

#metadata, #uri

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dataset

#add, #add_compound, #add_feature, #add_feature_metadata, #add_metadata, all, create, create_from_csv_file, #delete, exist?, #feature_name, #feature_type, #initialize, #load_all, #load_compounds, #load_csv, #load_features, #load_metadata, #load_rdfxml, #load_rdfxml_file, #load_spreadsheet, #load_yaml, #save, #split, #title, #to_csv, #to_ntriples, #to_rdfxml, #to_spreadsheet, #to_xls

Methods included from OpenTox

#add_metadata, all, #delete, #initialize, #load_metadata, login, text_to_html, #to_rdfxml

Constructor Details

This class inherits a constructor from OpenTox::Dataset

Class Method Details

.find(uri, subjectid = nil) ⇒ OpenTox::Dataset

Find a prediction dataset and load all data.

Parameters:

  • uri (String)

    Prediction dataset URI

Returns:



351
352
353
354
355
# File 'lib/dataset.rb', line 351

def self.find(uri, subjectid=nil)
  prediction = LazarPrediction.new(uri, subjectid)
  prediction.load_all(subjectid)
  prediction
end

Instance Method Details

#confidence(compound) ⇒ Object



361
362
363
364
# File 'lib/dataset.rb', line 361

def confidence(compound)
  feature_uri = @data_entries[compound.uri].collect{|f,v| f if f.match(/prediction/)}.compact.first
  @features[feature_uri][OT.confidence]
end

#descriptors(compound) ⇒ Object



366
367
368
# File 'lib/dataset.rb', line 366

def descriptors(compound)
  @data_entries[compound.uri].collect{|f,v| @features[f] if f.match(/descriptor/)}.compact if @data_entries[compound.uri]
end

#measured_activities(compound) ⇒ Object



370
371
372
373
# File 'lib/dataset.rb', line 370

def measured_activities(compound)
  source = [OT.hasSource]
  @data_entries[compound.uri].collect{|f,v| v if f.match(/#{source}/)}.compact.flatten
end

#neighbors(compound) ⇒ Object



375
376
377
# File 'lib/dataset.rb', line 375

def neighbors(compound)
  @data_entries[compound.uri].collect{|f,v| @features[f] if f.match(/neighbor/)}.compact
end

#value(compound) ⇒ Object



357
358
359
# File 'lib/dataset.rb', line 357

def value(compound)
  @data_entries[compound.uri].collect{|f,v| v.first if f.match(/prediction/)}.compact.first
end