From 1985adc474962f590c5e7331e570fde3dfa3dc5b Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 13 Aug 2009 11:03:59 +0200 Subject: gemspec and rdoc documentation added --- rdoc/classes/OpenTox/Dataset.html | 331 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 331 insertions(+) create mode 100644 rdoc/classes/OpenTox/Dataset.html (limited to 'rdoc/classes/OpenTox/Dataset.html') diff --git a/rdoc/classes/OpenTox/Dataset.html b/rdoc/classes/OpenTox/Dataset.html new file mode 100644 index 0000000..f6966f7 --- /dev/null +++ b/rdoc/classes/OpenTox/Dataset.html @@ -0,0 +1,331 @@ + + + + + + Class: OpenTox::Dataset + + + + + + + + + + +
+ + + + + + + + + + + + + + +
ClassOpenTox::Dataset
In: + + lib/opentox-ruby-api-wrapper.rb + +
+
Parent: + + OpenTox + +
+
+ + +
+ + + +
+ + + +
+ +
+

Methods

+ +
+ add   + all_compounds_and_features   + all_features   + compounds   + features   + name   + new   +
+
+ +
+ + + + +
+ + + + + + + + + +
+

Public Class methods

+ +
+ + + + +
+

+Initialize with :uri => uri or :name => name (creates a new dataset) +

+

[Source]

+
+
+# File lib/opentox-ruby-api-wrapper.rb, line 78
+                def initialize(params)
+                        if params[:uri]
+                                @uri = params[:uri].to_s
+                        elsif params[:name] 
+                                @uri = RestClient.post ENV['OPENTOX_DATASETS'], :name => params[:name]
+                                RestClient.delete @uri + '/associations'
+                        end
+                end
+
+
+
+
+ +

Public Instance methods

+ +
+ + + + +
+

+Add a compound and a feature to a dataset +

+

[Source]

+
+
+# File lib/opentox-ruby-api-wrapper.rb, line 118
+                def add(compound,feature)
+                        RestClient.put @uri, :compound_uri => compound.uri, :feature_uri => feature.uri
+                end
+
+
+
+
+ +
+ + + + +
+

+Get all compounds and features from a dataset, returns a hash +with compound_uris as keys and arrays of features as values +

+

[Source]

+
+
+# File lib/opentox-ruby-api-wrapper.rb, line 98
+                def all_compounds_and_features
+                        compounds = {}
+                        Crack::XML.parse(RestClient.get @uri + '/compounds/features')['dataset']['compound'].each do |c|
+                                features = c['feature_uri'].collect{ |f| Feature.new :uri => f }
+                                compounds[c['uri']] = features
+                        end
+                        compounds
+                end
+
+
+
+
+ +
+ + + + +
+

+Get all features from a dataset +

+

[Source]

+
+
+# File lib/opentox-ruby-api-wrapper.rb, line 108
+                def all_features
+                        RestClient.get(@uri + '/features').split("\n").collect{|f| Feature.new(:uri => f)}
+                end
+
+
+
+
+ +
+ + + + +
+

+Get all compounds from a dataset +

+

[Source]

+
+
+# File lib/opentox-ruby-api-wrapper.rb, line 93
+                def compounds
+                        RestClient.get(@uri + '/compounds').split("\n").collect{ |c| Compound.new(:uri => c) }
+                end
+
+
+
+
+ +
+ + + + +
+

+Get all features for a compound +

+

[Source]

+
+
+# File lib/opentox-ruby-api-wrapper.rb, line 113
+                def features(compound)
+                        RestClient.get(@uri + '/compound/' + uri_escape(compound.uri) + '/features').split("\n").collect{|f| Feature.new(:uri => f) }
+                end
+
+
+
+
+ +
+ + + + +
+

+Get the dataset name +

+

[Source]

+
+
+# File lib/opentox-ruby-api-wrapper.rb, line 88
+                def name
+                        RestClient.get @uri + '/name'
+                end
+
+
+
+
+ + +
+ + +
+ + +
+

[Validate]

+
+ + + \ No newline at end of file -- cgit v1.2.3