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

#accept_values, #add, #add_compound, #add_feature, #add_feature_metadata, #add_metadata, all, #complete_data_entries, #copy_hash, create, create_from_csv_file, #delete, exist?, #feature_name, #feature_type, from_json, #initialize, #load_all, #load_compounds, #load_csv, #load_features, #load_json, #load_metadata, #load_rdfxml, #load_rdfxml_file, #load_sdf, #load_spreadsheet, #load_yaml, merge, #save, #split, #title, #to_csv, #to_json, #to_ntriples, #to_rdfxml, #to_sdf, #to_spreadsheet, #to_urilist, #to_xls

Methods included from OpenTox

#add_metadata, all, #delete, #initialize, #load_metadata, sign_in, 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:



478
479
480
481
482
# File 'lib/dataset.rb', line 478

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

Instance Method Details

#confidence(compound) ⇒ Object



491
492
493
# File 'lib/dataset.rb', line 491

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

#descriptors(compound) ⇒ Object



495
496
497
# File 'lib/dataset.rb', line 495

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



499
500
501
# File 'lib/dataset.rb', line 499

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

#neighbors(compound) ⇒ Object



503
504
505
# File 'lib/dataset.rb', line 503

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

#value(compound) ⇒ Object



484
485
486
487
488
489
# File 'lib/dataset.rb', line 484

def value(compound)
  v = nil
  v = @data_entries[compound.uri].collect{|f,v| v.first if f.match(/value/)}.compact.first if @data_entries[compound.uri]
  v = nil if v.is_a? Array and v.empty?
  v
end