summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vorgrimmler <vorgrimmlerdavid@gmx.de>2012-06-20 14:36:44 +0200
committerDavid Vorgrimmler <vorgrimmlerdavid@gmx.de>2012-06-20 14:36:44 +0200
commit16747873e9226920c8bbc9dced9799bbcb725196 (patch)
treef10534971eabcb7cdf7138085cc0c2e09a854e30
parente072dd5b0561d53b11fc64eb06c7613e26174367 (diff)
Added subjectids.
-rw-r--r--lib/compound.rb6
-rw-r--r--lib/utils.rb10
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/compound.rb b/lib/compound.rb
index b4df335..3727c8c 100644
--- a/lib/compound.rb
+++ b/lib/compound.rb
@@ -259,12 +259,12 @@ module OpenTox
}
LOGGER.debug "#{entry.size} entries in feature ds for query." unless entry.nil?
if entry.nil?
- temp_ds = OpenTox::Dataset.create; temp_ds.add_compound(self.uri); temp_uri = temp_ds.save
- uri = RestClientWrapper.post(File.join(CONFIG[:services]["opentox-algorithm"], "/pc/AllDescriptors"), {:dataset_uri => temp_uri, :pc_type => pc_type, :lib => lib})
+ temp_ds = OpenTox::Dataset.create(CONFIG[:services]["opentox-dataset"],subjectid); temp_ds.add_compound(self.uri); temp_uri = temp_ds.save(subjectid)
+ uri = RestClientWrapper.post(File.join(CONFIG[:services]["opentox-algorithm"], "/pc/AllDescriptors"), {:dataset_uri => temp_uri, :pc_type => pc_type, :lib => lib, :subjectid => subjectid})
ds = OpenTox::Dataset.find(uri)
entry = ds.data_entries[self.uri]
ds.delete(subjectid)
- temp_ds.delete
+ temp_ds.delete(subjectid)
end
features = entry.keys
features.each { |feature|
diff --git a/lib/utils.rb b/lib/utils.rb
index e04199d..149208b 100644
--- a/lib/utils.rb
+++ b/lib/utils.rb
@@ -14,11 +14,11 @@ module OpenTox
include OpenTox
# Calculate physico-chemical descriptors.
- # @param[Hash] required: :dataset_uri, :pc_type, :rjb, :task, :add_uri, optional: :descriptor, :lib
+ # @param[Hash] required: :dataset_uri, :pc_type, :rjb, :task, :add_uri, optional: :descriptor, :lib, :subjectid
# @return[String] dataset uri
def self.pc_descriptors(params)
- ds = OpenTox::Dataset.find(params[:dataset_uri])
+ ds = OpenTox::Dataset.find(params[:dataset_uri],params[:subjectid])
compounds = ds.compounds.collect
task_weights = {"joelib"=> 20, "openbabel"=> 1, "cdk"=> 50 }
task_weights.keys.each { |step| task_weights.delete(step) if (params[:lib] && (!params[:lib].split(",").include?(step)))}
@@ -88,8 +88,8 @@ module OpenTox
ds = OpenTox::Dataset.find(
OpenTox::RestClientWrapper.post(
- File.join(CONFIG[:services]["opentox-dataset"]), master.collect { |row| row.join(",") }.join("\n"), {:content_type => "text/csv"}
- )
+ File.join(CONFIG[:services]["opentox-dataset"]), master.collect { |row| row.join(",") }.join("\n"), {:content_type => "text/csv", :subjectid => params[:subjectid]}
+ ),params[:subjectid]
)
# # # add feature metadata
@@ -117,7 +117,7 @@ module OpenTox
ds.add_feature_metadata(File.join(ds.uri, "feature", id.to_s),{OT.hasSource => params[:dataset_uri]})
}
- ds.save
+ ds.save(params[:subjectid])
else
raise OpenTox::BadRequestError.new "No descriptors matching your criteria found."
end