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, #feature_types, 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, #value_map

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:



512
513
514
515
516
# File 'lib/dataset.rb', line 512

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

Instance Method Details

#confidence(compound) ⇒ Object



525
526
527
# File 'lib/dataset.rb', line 525

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



529
530
531
# File 'lib/dataset.rb', line 529

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



533
534
535
# File 'lib/dataset.rb', line 533

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



537
538
539
# File 'lib/dataset.rb', line 537

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



518
519
520
521
522
523
# File 'lib/dataset.rb', line 518

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