bio-chembl 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+
2
+ cd /Users/mitsuteru/Applications/biogems/bioruby-chembl/
3
+ /opt/local/bin/ruby1.9 -I lib -I test test/test_bio-chembl-compound.rb
@@ -0,0 +1,188 @@
1
+ require 'helper'
2
+ require 'bio-chembl/chembl.rb'
3
+
4
+ class TestBioChemblURI < Test::Unit::TestCase
5
+ def setup
6
+ @obj = BioChEMBL::REST::ChEMBL_URI
7
+ end
8
+
9
+ def test_status
10
+ assert_equal(@obj.status,
11
+ "https://www.ebi.ac.uk/chemblws/status/")
12
+ end
13
+
14
+ def test_compounds
15
+ assert_equal(@obj.compounds('CHEMBL1'),
16
+ 'https://www.ebi.ac.uk/chemblws/compounds/CHEMBL1')
17
+ end
18
+
19
+ def test_compounds_image
20
+ assert_equal(@obj.compounds('CHEMBL192', 'image'),
21
+ 'https://www.ebi.ac.uk/chemblws/compounds/CHEMBL192/image')
22
+ end
23
+
24
+ def test_compounds_image_params
25
+ assert_equal(@obj.compounds('CHEMBL192', 'image', {:dimensions => 200}),
26
+ 'https://www.ebi.ac.uk/chemblws/compounds/CHEMBL192/image?dimensions=200')
27
+ end
28
+
29
+ def test_compounds_bioactivities
30
+ assert_equal(@obj.compounds('CHEMBL1', 'bioactivities'),
31
+ 'https://www.ebi.ac.uk/chemblws/compounds/CHEMBL1/bioactivities')
32
+ end
33
+
34
+ def test_compounds_stdinchikey
35
+ assert_equal(@obj.compounds_stdinchikey("QFFGVLORLPOAEC-SNVBAGLBSA-N"),
36
+ 'https://www.ebi.ac.uk/chemblws/compounds/stdinchikey/QFFGVLORLPOAEC-SNVBAGLBSA-N')
37
+ end
38
+
39
+ def test_compounds_smiles
40
+ assert_equal(@obj.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"),
41
+ 'https://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')
42
+ end
43
+
44
+ def test_compounds_substructure
45
+ assert_equal(@obj.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"),
46
+ 'https://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')
47
+ end
48
+
49
+ def test_compounds_similarity
50
+ assert_equal(@obj.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"),
51
+ 'https://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')
52
+ end
53
+
54
+ def test_targets_id
55
+ assert_equal(@obj.targets("CHEMBL2477"),
56
+ 'https://www.ebi.ac.uk/chemblws/targets/CHEMBL2477')
57
+ end
58
+ def test_targets_bioactivities
59
+ assert_equal(@obj.targets("CHEMBL2477", 'bioactivities'),
60
+ 'https://www.ebi.ac.uk/chemblws/targets/CHEMBL2477/bioactivities')
61
+ end
62
+ def test_targets
63
+ # targets
64
+ assert_equal(@obj.targets,
65
+ 'https://www.ebi.ac.uk/chemblws/targets')
66
+ end
67
+
68
+ def test_targets_uniprot
69
+ assert_equal(@obj.targets_uniprot("Q13936"),
70
+ 'https://www.ebi.ac.uk/chemblws/targets/uniprot/Q13936')
71
+ end
72
+
73
+ def test_targets_refseq
74
+ assert_equal(@obj.targets_refseq("NP_001128722"),
75
+ 'https://www.ebi.ac.uk/chemblws/targets/refseq/NP_001128722')
76
+ end
77
+
78
+ def test_assays
79
+ assert_equal(@obj.assays("CHEMBL1217643"),
80
+ 'https://www.ebi.ac.uk/chemblws/assays/CHEMBL1217643')
81
+ end
82
+ def test_assays_bioactivities
83
+ assert_equal(@obj.assays("CHEMBL1217643", 'bioactivities'),
84
+ 'https://www.ebi.ac.uk/chemblws/assays/CHEMBL1217643/bioactivities')
85
+ end
86
+
87
+ end
88
+
89
+
90
+ class TestBioChembl < Test::Unit::TestCase
91
+ def setup
92
+ @obj = BioChEMBL::REST.new
93
+ end
94
+
95
+ def test_new
96
+ assert(@obj)
97
+ end
98
+
99
+ def test_uri_status
100
+ assert_equal(@obj.uri.status,
101
+ 'https://www.ebi.ac.uk/chemblws/status/')
102
+ end
103
+
104
+ def test_status
105
+ assert_equal(@obj.status, 'UP')
106
+ end
107
+
108
+ def test_compounds
109
+ doc = @obj.compounds('CHEMBL1')
110
+ assert_equal(doc,
111
+ '<compound><chemblId>CHEMBL1</chemblId><knownDrug>No</knownDrug><medChemFriendly>Yes</medChemFriendly><passesRuleOfThree>No</passesRuleOfThree><molecularFormula>C32H32O8</molecularFormula><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</smiles><stdInChiKey>GHBOEFUAGSHXPO-XZOTUCIWSA-N</stdInChiKey><numRo5Violations>1</numRo5Violations><rotatableBonds>2</rotatableBonds><molecularWeight>544.59167</molecularWeight><alogp>3.627</alogp><acdLogp>7.669</acdLogp><acdLogd>7.669</acdLogd></compound>')
112
+ end
113
+
114
+ def test_compounds_image
115
+ # assert_equal(@obj.compounds('CHEMBL192', 'image'),
116
+ # '') # \x89PNG
117
+ end
118
+
119
+ def test_compounds_image_params
120
+ # assert_equal(@obj.compounds('CHEMBL192', 'image', {:dimensions => 200}),
121
+ # '')
122
+ end
123
+
124
+ def test_compounds_bioactivities
125
+ doc = @obj.compounds('CHEMBL1', 'bioactivities')
126
+ assert(doc =~ /<list><bioactivity><parent__cmpd__chemblid>CHEMBL1/)
127
+ end
128
+
129
+ def test_compounds_stdinchikey
130
+ doc = @obj.compounds_stdinchikey("QFFGVLORLPOAEC-SNVBAGLBSA-N")
131
+ assert(doc =~ /<compound><chemblId>CHEMBL1201760/)
132
+ end
133
+
134
+ def test_compounds_smiles
135
+ doc = @obj.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")
136
+ assert(doc =~ /<list><compound><chemblId>CHEMBL1/)
137
+ end
138
+
139
+ def test_compounds_substructure
140
+ doc = @obj.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")
141
+ assert(doc, '<list/>')
142
+ end
143
+
144
+ def test_compounds_similarity
145
+ doc = @obj.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")
146
+ assert(doc =~ /<list><compound><chemblId>CHEMBL/)
147
+ end
148
+
149
+ def test_targets_id
150
+ doc = @obj.targets("CHEMBL2477")
151
+ assert(doc =~ /<target><chemblId>CHEMBL2477/)
152
+ end
153
+
154
+ def test_targets_bioactivities
155
+ doc = @obj.targets("CHEMBL2477", 'bioactivities')
156
+ assert(doc =~ /<list><bioactivity><parent__cmpd__chemblid>CHEMBL/)
157
+ end
158
+
159
+
160
+ def test_targets
161
+ doc = @obj.targets
162
+ assert(doc =~ /<list><target><chemblId>CHEMBL/)
163
+ end
164
+
165
+ def test_targets_uniprot
166
+ doc = @obj.targets_uniprot("Q13936")
167
+ assert_equal(doc, '<target><chemblId>CHEMBL1940</chemblId><targetType>PROTEIN</targetType><preferredName>Voltage-gated L-type calcium channel alpha-1C subunit</preferredName><proteinAccession>Q13936</proteinAccession><synonyms>Voltage-dependent L-type calcium channel subunit alpha-1C; Calcium channel, L type, alpha-1 polypeptide, isoform 1, cardiac muscle; Voltage-gated calcium channel subunit alpha Cav1.2</synonyms><organism>Homo sapiens</organism><description>Voltage-dependent L-type calcium channel subunit alpha-1C</description><geneNames>CACNA1C; CACH2; CACN2; CACNL1A1; CCHL1A1</geneNames></target>')
168
+ end
169
+
170
+ def test_targets_refseq_not_fount
171
+ assert_raise(Exception) {
172
+ @obj.targets_refseq("NP_001128722")
173
+ }
174
+ end
175
+
176
+ def test_assays
177
+ doc = @obj.assays("CHEMBL1217643")
178
+ assert(doc =~ /<assay><chemblId>CHEMBL1217643/)
179
+ end
180
+
181
+ def test_assays_bioactivities
182
+ doc = @obj.assays("CHEMBL1217643", 'bioactivities')
183
+ assert(doc =~ /<list><bioactivity><parent__cmpd__chemblid>CHEMBL/)
184
+ end
185
+
186
+ end
187
+
188
+
@@ -0,0 +1,3 @@
1
+
2
+ cd /Users/mitsuteru/Applications/biogems/bioruby-chembl/
3
+ /opt/local/bin/ruby1.9 -I lib -I test test/test_bio-chembl-rest-client.rb
@@ -0,0 +1,114 @@
1
+ require 'helper'
2
+ require 'bio-chembl/chembl.rb'
3
+
4
+
5
+
6
+ class TestBioChemblTarget < Test::Unit::TestCase
7
+ def setup
8
+ @xml = "<target><chemblId>CHEMBL1785</chemblId><targetType>PROTEIN</targetType><preferredName>Endothelin receptor ET-B</preferredName><proteinAccession>P24530</proteinAccession><synonyms>Endothelin B receptor; Endothelin receptor non-selective type; ET-B; ET-BR</synonyms><organism>Homo sapiens</organism><description>Endothelin B receptor</description><geneNames>EDNRB; ETRB</geneNames></target>"
9
+ @chemblId = "CHEMBL1785"
10
+ end
11
+
12
+ def test_target_parser_xml
13
+ doc = BioChEMBL::Target.parse_xml(@xml)
14
+ assert_equal(doc.chemblId, "CHEMBL1785")
15
+ end
16
+
17
+ def test_target_attributes
18
+ doc = BioChEMBL::Target.parse_xml(@xml)
19
+ assert_equal(doc.class, BioChEMBL::Target)
20
+ end
21
+
22
+ def test_target_attributes
23
+ doc = BioChEMBL::Target.parse_xml(@xml)
24
+ assert_equal("CHEMBL1785", doc.chemblId)
25
+ assert_equal("PROTEIN", doc.targetType)
26
+ assert_equal("Endothelin receptor ET-B", doc.preferredName)
27
+ assert_equal("P24530", doc.proteinAccession)
28
+ assert_equal("Endothelin B receptor; Endothelin receptor non-selective type; ET-B; ET-BR", doc.synonyms)
29
+ assert_equal("Homo sapiens", doc.organism)
30
+ assert_equal("Endothelin B receptor", doc.description)
31
+ assert_equal("EDNRB; ETRB", doc.geneNames)
32
+ end
33
+
34
+ def test_target_synonyms_to_array
35
+ doc = BioChEMBL::Target.parse_xml(@xml)
36
+ assert_equal("Endothelin B receptor; Endothelin receptor non-selective type; ET-B; ET-BR", doc.synonyms)
37
+ synonyms = BioChEMBL.to_array(doc.synonyms)
38
+ assert_equal(4, synonyms.size)
39
+ assert_equal("Endothelin B receptor", synonyms[0])
40
+ end
41
+
42
+ def test_target_geneNames_to_array
43
+ doc = BioChEMBL::Target.parse_xml(@xml)
44
+ assert_equal("EDNRB; ETRB", doc.geneNames)
45
+ geneNames = BioChEMBL.to_array(doc.geneNames)
46
+ assert_equal(2, geneNames.size)
47
+ assert_equal("EDNRB", geneNames[0])
48
+ end
49
+
50
+ def test_target_parse_json
51
+ assert_raise(NotImplementedError) {
52
+ BioChEMBL::Target.parse_json("")
53
+ }
54
+ end
55
+
56
+
57
+ def test_target_parse_rdf
58
+ assert_raise(NotImplementedError) {
59
+ BioChEMBL::Target.parse_rdf("")
60
+ }
61
+ end
62
+
63
+
64
+ def test_target_parse
65
+ doc = BioChEMBL::Target.parse(@xml)
66
+ assert_equal("CHEMBL1785", doc.chemblId)
67
+ end
68
+
69
+
70
+ def test_target_resolve
71
+ doc = BioChEMBL::Target.new
72
+ doc.chemblId = @chemblId
73
+ assert_equal(doc.targetType, nil)
74
+ doc.resolve
75
+ assert_equal(doc.targetType, "PROTEIN")
76
+ end
77
+
78
+ end
79
+
80
+ class TestBioChemblTargetClassMethods < Test::Unit::TestCase
81
+ def setup
82
+ @chemblId = "CHEMBL2477"
83
+ @target = BioChEMBL::Target.find(@chemblId)
84
+ @uniprot_id = "Q13936"
85
+ @refseq_id = "NP_001128722"
86
+ end
87
+
88
+ def test_find
89
+ assert_equal(@target.chemblId, "CHEMBL2477")
90
+ assert_equal(@target.targetType, "PROTEIN")
91
+ end
92
+
93
+ def test_find_by_uniprot
94
+ @target = BioChEMBL::Target.find_by_uniprot(@uniprot_id)
95
+ assert_equal(@target.chemblId, "CHEMBL1940")
96
+ assert_equal(@target.targetType, "PROTEIN")
97
+ end
98
+
99
+ def test_find_by_refseq
100
+ # @target = BioChEMBL::Target.find_by_refseq(@refseq_id)
101
+ # p @target
102
+ # assert_equal(@target.chemblId, "CHEMBL2477")
103
+ # assert_equal(@target.targetType, "PROTEIN")
104
+ end
105
+
106
+ def test_bioactivities
107
+ docs = @target.bioactivities
108
+ assert_equal(Array, docs.class)
109
+ assert_equal(BioChEMBL::Bioactivity, docs.first.class)
110
+ assert_equal("Homo sapiens", docs.first.organism)
111
+ assert_equal("Bioorg. Med. Chem. Lett., (1998) 8:13:1703", docs.first.reference)
112
+ end
113
+
114
+ end
@@ -0,0 +1,3 @@
1
+
2
+ cd /Users/mitsuteru/Applications/biogems/bioruby-chembl/
3
+ /opt/local/bin/ruby1.9 -I lib -I test test/test_bio-chembl-target.rb
@@ -0,0 +1,9 @@
1
+ require 'helper'
2
+ require 'bio-chembl/chembl.rb'
3
+
4
+ class TestBioChEMBL < Test::Unit::TestCase
5
+ def test_website
6
+ assert_equal("https://www.ebi.ac.uk/chembl/", BioChEMBL.website)
7
+ end
8
+ end
9
+
@@ -0,0 +1,3 @@
1
+
2
+ cd /Users/mitsuteru/Applications/biogems/bioruby-chembl/
3
+ /opt/local/bin/ruby1.9 -I lib -I test test/test_bio-chembl.rb
metadata ADDED
@@ -0,0 +1,210 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bio-chembl
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
10
+ platform: ruby
11
+ authors:
12
+ - Mitsuteru Nakao
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-07-22 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rdoc
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 3
43
+ - 12
44
+ version: "3.12"
45
+ type: :development
46
+ version_requirements: *id002
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 1
57
+ - 0
58
+ - 0
59
+ version: 1.0.0
60
+ type: :development
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 1
72
+ - 8
73
+ - 3
74
+ version: 1.8.3
75
+ type: :development
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: bio
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 1
87
+ - 4
88
+ - 2
89
+ version: 1.4.2
90
+ type: :development
91
+ version_requirements: *id005
92
+ - !ruby/object:Gem::Dependency
93
+ name: rdoc
94
+ prerelease: false
95
+ requirement: &id006 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ~>
99
+ - !ruby/object:Gem::Version
100
+ segments:
101
+ - 3
102
+ - 12
103
+ version: "3.12"
104
+ type: :development
105
+ version_requirements: *id006
106
+ - !ruby/object:Gem::Dependency
107
+ name: curb
108
+ prerelease: false
109
+ requirement: &id007 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ type: :development
118
+ version_requirements: *id007
119
+ - !ruby/object:Gem::Dependency
120
+ name: nokogiri
121
+ prerelease: false
122
+ requirement: &id008 !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ~>
126
+ - !ruby/object:Gem::Version
127
+ segments:
128
+ - 1
129
+ - 5
130
+ - 5
131
+ version: 1.5.5
132
+ type: :development
133
+ version_requirements: *id008
134
+ description: BioRuby plugin for ChEMBL REST API Client, Parser and Container classes
135
+ email: mitsuteru.nakao@gmail.com
136
+ executables: []
137
+
138
+ extensions: []
139
+
140
+ extra_rdoc_files:
141
+ - LICENSE.txt
142
+ - README.md
143
+ files:
144
+ - .document
145
+ - .project
146
+ - .travis.yml
147
+ - Gemfile
148
+ - Gemfile.lock
149
+ - LICENSE.txt
150
+ - README.md
151
+ - Rakefile
152
+ - VERSION
153
+ - bio-chembl.gemspec
154
+ - lib/bio-chembl.rb
155
+ - lib/bio-chembl/assay.rb
156
+ - lib/bio-chembl/bioactivity.rb
157
+ - lib/bio-chembl/chembl.rb
158
+ - lib/bio-chembl/chemblid.rb
159
+ - lib/bio-chembl/compound.rb
160
+ - lib/bio-chembl/datamodel.rb
161
+ - lib/bio-chembl/rest_api_server.rb
162
+ - lib/bio-chembl/rest_client.rb
163
+ - lib/bio-chembl/target.rb
164
+ - test/helper.rb
165
+ - test/test_bio-chembl-assay.rb
166
+ - test/test_bio-chembl-assay.sh
167
+ - test/test_bio-chembl-chemblid.rb
168
+ - test/test_bio-chembl-chemblid.sh
169
+ - test/test_bio-chembl-compound.rb
170
+ - test/test_bio-chembl-compound.sh
171
+ - test/test_bio-chembl-rest-client.rb
172
+ - test/test_bio-chembl-rest-client.sh
173
+ - test/test_bio-chembl-target.rb
174
+ - test/test_bio-chembl-target.sh
175
+ - test/test_bio-chembl.rb
176
+ - test/test_bio-chembl.sh
177
+ has_rdoc: true
178
+ homepage: http://github.com/nakao/bio-chembl
179
+ licenses:
180
+ - MIT
181
+ post_install_message:
182
+ rdoc_options: []
183
+
184
+ require_paths:
185
+ - lib
186
+ required_ruby_version: !ruby/object:Gem::Requirement
187
+ none: false
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ segments:
192
+ - 0
193
+ version: "0"
194
+ required_rubygems_version: !ruby/object:Gem::Requirement
195
+ none: false
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ segments:
200
+ - 0
201
+ version: "0"
202
+ requirements: []
203
+
204
+ rubyforge_project:
205
+ rubygems_version: 1.3.7
206
+ signing_key:
207
+ specification_version: 3
208
+ summary: ChEMBL REST API Client, Parser and Container
209
+ test_files: []
210
+