Module: BioChEMBL::REST::ChEMBL_URI

Defined in:
lib/bio-chembl/rest_client.rb

Overview

BioChEMBL::REST::ChEMBL_URI module

Class Method Summary collapse

Class Method Details

.address(path) ⇒ Object



25
26
27
# File 'lib/bio-chembl/rest_client.rb', line 25

def self.address(path)
  "#{BASE_URI}/#{path}"
end

.assays(chemblId, arg = nil) ⇒ Object

BioChEMBL::REST::ChEMBL_URI.assays()



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/bio-chembl/rest_client.rb', line 103

def self.assays(chemblId, arg = nil)
  if chemblId and arg == nil
    # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/assays/CHEMBL1217643
    address("assays/#{chemblId}")
  elsif chemblId and arg == 'bioactivities' 
    # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/assays/CHEMBL1217643/bioactivities
    address("assays/#{chemblId}/bioactivities")
  else
    raise Exception, "Undefined. ChEMBL ID: #{chemblId}, arg: #{arg}"
  end
end

.compounds(chemblId = nil, arg = nil, params = nil) ⇒ Object

BioChEMBL::REST::ChEMBL_URI.compounds()

compounds(“CHEMBL1”)



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/bio-chembl/rest_client.rb', line 38

def self.compounds(chemblId = nil, arg = nil, params = nil)
  if chemblId and arg == nil and params == nil 
  # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/compounds/CHEMBL1
    address("compounds/#{chemblId}")
  elsif chemblId and arg == 'image' and params == nil
  # Example URL: http://www.ebi.ac.uk/chemblws/compounds/CHEMBL192/image
    address("compounds/#{chemblId}/#{arg}")
  elsif chemblId and arg == 'image' and params 
  # Example URL with dimensions parameter: http://www.ebi.ac.uk/chemblws/compounds/CHEMBL192/image?dimensions=200
    address("compounds/#{chemblId}/#{arg}?" + params.map {|k,v| "#{k}=#{v}"}.join("&"))
  elsif chemblId and arg == 'bioactivities' and params == nil
  # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/compounds/CHEMBL2/bioactivities
    address("compounds/#{chemblId}/#{arg}")
  else 
    raise Exception, "Undefined address. ID: #{chemblId}, arg: #{arg}, params: #{params.inspect}"
  end
end

.compounds_similarity(smiles) ⇒ Object

BioChEMBL::REST::ChEMBL_URI.compounds_similarity()



71
72
73
74
# File 'lib/bio-chembl/rest_client.rb', line 71

def self.compounds_similarity(smiles)
  # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/compounds/similarity/COc1ccc2[C@@H]3[C@H](COc2c1)C(C)(C)OC4=C3C(=O)C(=O)C5=C4OC(C)(C)[C@@H]6COc7cc(OC)ccc7[C@H]56/70
  address("compounds/similarity/#{smiles}")
end

.compounds_smiles(smiles) ⇒ Object

BioChEMBL::REST::ChEMBL_URI.compounds_smiles()



61
62
63
64
# File 'lib/bio-chembl/rest_client.rb', line 61

def self.compounds_smiles(smiles)
  # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/compounds/smiles/COc1ccc2[C@@H]3[C@H](COc2c1)C(C)(C)OC4=C3C(=O)C(=O)C5=C4OC(C)(C)[C@@H]6COc7cc(OC)ccc7[C@H]56
  address("compounds/smiles/#{smiles}")
end

.compounds_stdinchikey(stdinchikey) ⇒ Object

BioChEMBL::REST::ChEMBL_URI.compounds_stdinchikey()



56
57
58
59
# File 'lib/bio-chembl/rest_client.rb', line 56

def self.compounds_stdinchikey(stdinchikey)
  # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/compounds/stdinchikey/QFFGVLORLPOAEC-SNVBAGLBSA-N
  address("compounds/stdinchikey/#{stdinchikey}")
end

.compounds_substructure(smiles) ⇒ Object

BioChEMBL::REST::ChEMBL_URI.compounds_substructure()



66
67
68
69
# File 'lib/bio-chembl/rest_client.rb', line 66

def self.compounds_substructure(smiles)
  # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/compounds/substructure/COc1ccc2[C@@H]3[C@H](COc2c1)C(C)(C)OC4=C3C(=O)C(=O)C5=C4OC(C)(C)[C@@H]6COc7cc(OC)ccc7[C@H]56
  address("compounds/substructure/#{smiles}")
end

.statusObject

BioChEMBL::REST::ChEMBL_URI.status



31
32
33
34
# File 'lib/bio-chembl/rest_client.rb', line 31

def self.status
  # Example URL: http://www.ebi.ac.uk/chemblws/status/
  address("status/")
end

.targets(chemblId = nil, arg = nil) ⇒ Object

BioChEMBL::REST::ChEMBL_URI.targets()



77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/bio-chembl/rest_client.rb', line 77

def self.targets(chemblId = nil, arg = nil)
  if chemblId and arg == nil
    # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/targets/CHEMBL2477
    address("targets/#{chemblId}")
  elsif chemblId and arg == 'bioactivities' 
    # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/targets/CHEMBL240/bioactivities
    address("targets/#{chemblId}/bioactivities")
  elsif chemblId == nil and arg == nil 
    # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/targets
    address("targets")
  else
    raise Exception, "Undefined."
  end
end

.targets_refseq(refseq_id) ⇒ Object

BioChEMBL::REST::ChEMBL_URI.targets_refseq()



97
98
99
100
# File 'lib/bio-chembl/rest_client.rb', line 97

def self.targets_refseq(refseq_id)
  # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/targets/refseq/NP_001128722
  address("targets/refseq/#{refseq_id}")
end

.targets_uniprot(uniprot_id) ⇒ Object

BioChEMBL::REST::ChEMBL_URI.targets_uniprot()



92
93
94
95
# File 'lib/bio-chembl/rest_client.rb', line 92

def self.targets_uniprot(uniprot_id)
  # Example URL (XML Output): http://www.ebi.ac.uk/chemblws/targets/uniprot/Q13936
  address("targets/uniprot/#{uniprot_id}")
end