diff options
author | Andreas Maunz <andreas@maunz.de> | 2012-02-23 16:09:14 +0100 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2012-02-23 16:09:14 +0100 |
commit | 508736f5d981a619269aae38689e60d6af5c7bb0 (patch) | |
tree | 9a0327cbe3ace98e842ee74c3d8e087ad03b97b2 | |
parent | 8c95e3421122b9c97b02100ac87d18e39018a74c (diff) |
Adjusted lookup in compound, fixed parser
-rw-r--r-- | lib/compound.rb | 7 | ||||
-rw-r--r-- | lib/parser.rb | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/compound.rb b/lib/compound.rb index a2b7e48..c7c82c3 100644 --- a/lib/compound.rb +++ b/lib/compound.rb @@ -197,6 +197,7 @@ module OpenTox # Lookup numerical values, returns hash with feature name as key and value as value # @param [Array] Array of feature names # @param [String] Feature dataset uri + # @param [String] Comma separated pc types # @return [Hash] Hash with feature name as key and value as value def lookup(feature_array,feature_dataset_uri,pc_type) ds = OpenTox::Dataset.find(feature_dataset_uri) @@ -213,11 +214,12 @@ module OpenTox LOGGER.debug "#{entry.size} entries in feature ds for query." unless entry.nil? if entry.nil? - uri, smiles_to_inchi = OpenTox::Algorithm.get_pc_descriptors({:compounds => [self.uri], :pc_type => pc_type}) - uri = OpenTox::Algorithm.load_ds_csv(uri, smiles_to_inchi) + temp_ds = OpenTox::Dataset.create; temp_ds.add_compound(self.uri) + uri = RestClientWrapper.post(temp_ds.save + "/pcdesc", {:pc_type => pc_type}) ds = OpenTox::Dataset.find(uri) entry = ds.data_entries[self.uri] ds.delete + temp_ds.delete end features = entry.keys @@ -227,7 +229,6 @@ module OpenTox entry.delete(feature) unless feature == new_feature # e.g. when loading from ambit } #res = feature_array.collect {|v| entry[v]} - #LOGGER.debug "----- am #{entry.to_yaml}" entry end diff --git a/lib/parser.rb b/lib/parser.rb index 73eb756..a7caf9d 100644 --- a/lib/parser.rb +++ b/lib/parser.rb @@ -485,7 +485,7 @@ module OpenTox feature_idx += 1 - if val != nil && !val.infinite? && !val.nan? + if val != nil @dataset.add(compound.uri, feature, val) if type != OT.NumericFeature @dataset.features[feature][OT.acceptValue] = [] unless @dataset.features[feature][OT.acceptValue] |