summaryrefslogtreecommitdiff
path: root/lib/compound.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2013-07-10 14:36:39 +0200
committerChristoph Helma <helma@in-silico.ch>2013-07-10 14:36:39 +0200
commitddb83b4302e8628b333402d24e3e05fc90b3faef (patch)
tree39c8645d09f6e1ecee1d97ae4faa21e399e17ad4 /lib/compound.rb
parent3262e3cf2ed1ce896dcd11d9c1bde5222ea720ce (diff)
subjectids partially removed
Diffstat (limited to 'lib/compound.rb')
-rw-r--r--lib/compound.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/compound.rb b/lib/compound.rb
index 82f0d73..9d99ae9 100644
--- a/lib/compound.rb
+++ b/lib/compound.rb
@@ -1,4 +1,3 @@
-#require "openbabel"
CACTUS_URI="http://cactus.nci.nih.gov/chemical/structure/"
module OpenTox
@@ -15,22 +14,22 @@ module OpenTox
# compound = OpenTox::Compound.from_smiles("c1ccccc1")
# @param [String] smiles Smiles string
# @return [OpenTox::Compound] Compound
- def self.from_smiles smiles, subjectid=nil
- Compound.new RestClientWrapper.post(service_uri, smiles, {:content_type => 'chemical/x-daylight-smiles', :subjectid => subjectid})
+ def self.from_smiles smiles
+ Compound.new RestClientWrapper.post(service_uri, smiles, {:content_type => 'chemical/x-daylight-smiles'})
end
# Create a compound from inchi string
# @param inchi [String] smiles InChI string
# @return [OpenTox::Compound] Compound
- def self.from_inchi inchi, subjectid=nil
- Compound.new RestClientWrapper.post(service_uri, inchi, {:content_type => 'chemical/x-inchi', :subjectid => subjectid})
+ def self.from_inchi inchi
+ Compound.new RestClientWrapper.post(service_uri, inchi, {:content_type => 'chemical/x-inchi'})
end
# Create a compound from sdf string
# @param sdf [String] smiles SDF string
# @return [OpenTox::Compound] Compound
- def self.from_sdf sdf, subjectid=nil
- Compound.new RestClientWrapper.post(service_uri, sdf, {:content_type => 'chemical/x-mdl-sdfile', :subjectid => subjectid})
+ def self.from_sdf sdf
+ Compound.new RestClientWrapper.post(service_uri, sdf, {:content_type => 'chemical/x-mdl-sdfile'})
end
# Create a compound from name. Relies on an external service for name lookups.
@@ -38,9 +37,9 @@ module OpenTox
# compound = OpenTox::Compound.from_name("Benzene")
# @param name [String] can be also an InChI/InChiKey, CAS number, etc
# @return [OpenTox::Compound] Compound
- def self.from_name name, subjectid=nil
+ def self.from_name name
@inchi = RestClientWrapper.get File.join(CACTUS_URI,URI.escape(name),"stdinchi")
- Compound.new RestClientWrapper.post(service_uri, @inchi, {:content_type => 'chemical/x-inchi', :subjectid => subjectid})
+ Compound.new RestClientWrapper.post(service_uri, @inchi, {:content_type => 'chemical/x-inchi'})
end
# Get InChI