ruby-ensembl-api 1.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,8 @@
6
6
  #
7
7
  # License:: The Ruby License
8
8
  #
9
+ # @author Jan Aerts
10
+ # @author Francesco Strozzi
9
11
 
10
12
  module Ensembl
11
13
  ENSEMBL_RELEASE = 60
@@ -1070,7 +1070,8 @@ module Ensembl
1070
1070
  xrefs.each do |xref|
1071
1071
  answer.push(Ensembl::Core::Gene.find_by_display_xref_id(xref.xref_id))
1072
1072
  end
1073
-
1073
+
1074
+ answer.reject!{|a| a.nil?}
1074
1075
  return answer
1075
1076
  end
1076
1077
 
@@ -593,12 +593,12 @@ SQL
593
593
 
594
594
  # Method to retrieve Variation features from Ensembl::Core::Slice objects
595
595
  # @example
596
- # slice = Slice.fetch_by_region('chromosome',1,50000,51000)
597
- # variations = slice.get_variation_features
598
- # variations.each do |vf|
599
- # puts vf.variation_name, vf.allele_string
600
- # puts vf.variation.ancestral_allele
601
- # end
596
+ # slice = Slice.fetch_by_region('chromosome',1,50000,51000)
597
+ # variations = slice.get_variation_features
598
+ # variations.each do |vf|
599
+ # puts vf.variation_name, vf.allele_string
600
+ # puts vf.variation.ancestral_allele
601
+ # end
602
602
  def get_variation_features
603
603
  variation_connection()
604
604
  Ensembl::Variation::VariationFeature.find(:all,:conditions => ["seq_region_id = ? AND seq_region_start >= ? AND seq_region_end <= ?",self.seq_region.seq_region_id,self.start,self.stop])
@@ -20,9 +20,7 @@ module Ensembl
20
20
  EG_PORT = 4157
21
21
 
22
22
 
23
- # = DESCRIPTION
24
23
  # Generic class to perform dynamic connections to the Ensembl database and retrieve database names
25
- #
26
24
  class DummyDBConnection < ActiveRecord::Base
27
25
  self.abstract_class = true
28
26
  def self.connect(args)
@@ -38,11 +36,9 @@ module Ensembl
38
36
  end
39
37
 
40
38
  module DBRegistry
41
- # = DESCRIPTION
42
39
  # The Ensembl::Registry::Base is a super class providing general methods
43
40
  # to get database and connection info.
44
41
  class Base < ActiveRecord::Base
45
-
46
42
  self.abstract_class = true
47
43
  self.pluralize_table_names = false
48
44
  def self.get_info
@@ -55,7 +51,7 @@ module Ensembl
55
51
  return host,user,password,db_name,port,species,release.to_i
56
52
  end
57
53
  end
58
- # = DESCRIPTION
54
+
59
55
  # Method to retrieve the name of a database, using species, release and connection parameters
60
56
  # passed by the user.
61
57
  def self.get_name_from_db(db_type,species,release,args)
@@ -121,30 +117,25 @@ module Ensembl
121
117
 
122
118
 
123
119
  module Core
124
- # = DESCRIPTION
125
120
  # The Ensembl::Core::DBConnection is the actual connection established
126
121
  # with the Ensembl server.
127
122
  class DBConnection < Ensembl::DBRegistry::Base
128
123
  self.abstract_class = true
129
124
  self.pluralize_table_names = false
130
- # = DESCRIPTION
131
125
  # The Ensembl::Core::DBConnection#connect method makes the connection
132
126
  # to the Ensembl core database for a given species. By default, it connects
133
127
  # to release 50 for that species. You _could_ use a lower number, but
134
128
  # some parts of the API might not work, or worse: give the wrong results.
135
129
  #
136
- # = USAGE
130
+ # @example
137
131
  # # Connect to release 50 of human
138
132
  # Ensembl::Core::DBConnection.connect('homo_sapiens')
139
133
  #
140
134
  # # Connect to release 42 of chicken
141
135
  # Ensembl::Core::DBConnection.connect('gallus_gallus')
142
136
  #
143
- # ---
144
- # *Arguments*:
145
- # * species:: species to connect to. Arguments should be in snake_case
146
- # * ensembl_release:: the release of the database to connect to
147
- # (default = 50)
137
+ # @param [String] species Species to connect to. Must be in snake_case
138
+ # @param [Integer] ensembl_release. Release to connect to (default = 60)
148
139
  def self.connect(species, release = Ensembl::ENSEMBL_RELEASE, args = {})
149
140
  self.generic_connect('core',species, release,args)
150
141
  end
@@ -160,30 +151,25 @@ module Ensembl
160
151
  end # Core
161
152
 
162
153
  module Variation
163
- # = DESCRIPTION
164
154
  # The Ensembl::Variation::DBConnection is the actual connection established
165
155
  # with the Ensembl server.
166
156
  class DBConnection < Ensembl::DBRegistry::Base
167
157
  self.abstract_class = true
168
158
  self.pluralize_table_names = false
169
- # = DESCRIPTION
170
159
  # The Ensembl::Variation::DBConnection#connect method makes the connection
171
160
  # to the Ensembl variation database for a given species. By default, it connects
172
161
  # to release 50 for that species. You _could_ use a lower number, but
173
162
  # some parts of the API might not work, or worse: give the wrong results.
174
163
  #
175
- # = USAGE
164
+ # @example
176
165
  # # Connect to release 50 of human
177
166
  # Ensembl::Variation::DBConnection.connect('homo_sapiens')
178
167
  #
179
168
  # # Connect to release 42 of chicken
180
169
  # Ensembl::Variation::DBConnection.connect('gallus_gallus')
181
170
  #
182
- # ---
183
- # *Arguments*:
184
- # * species:: species to connect to. Arguments should be in snake_case
185
- # * ensembl_release:: the release of the database to connect to
186
- # (default = 50)
171
+ # @param [String] species Species to connect to. Must be in snake_case
172
+ # @param [Integer] ensembl_release. Release to connect to (default = 60)
187
173
  def self.connect(species, release = Ensembl::ENSEMBL_RELEASE, args = {})
188
174
  self.generic_connect('variation',species, release, args)
189
175
  end
@@ -19,7 +19,7 @@ module Ensembl
19
19
  # See the general documentation of the Ensembl module for
20
20
  # more information on what this means and what methods are available.
21
21
  #
22
- # = USAGE
22
+ # @example
23
23
  # allele = Allele.find(1)
24
24
  # puts allele.to_yaml
25
25
  class Allele < DBConnection
@@ -30,7 +30,6 @@ module Ensembl
30
30
  belongs_to :subsnp_handle
31
31
  end
32
32
 
33
- # = DESCRIPTION
34
33
  # The AlleleGroup class represents a grouping of alleles that have tight
35
34
  # linkage and are usually present together. This is commonly known as a
36
35
  # Haplotype or Haplotype Block.
@@ -39,7 +38,7 @@ module Ensembl
39
38
  # See the general documentation of the Ensembl module for
40
39
  # more information on what this means and what methods are available.
41
40
  #
42
- # = USAGE
41
+ # @example
43
42
  # allele_group = AlleleGroup.find(1)
44
43
  # puts allele_group.to_yaml
45
44
  class AlleleGroup < DBConnection
@@ -50,7 +49,6 @@ module Ensembl
50
49
  belongs_to :allele_group_allele
51
50
  end
52
51
 
53
- # = DESCRIPTION
54
52
  # The AlleleGroupAllele class represents a connection class between Allele and AlleleGroup.
55
53
  # Should not be used directly.
56
54
  #
@@ -62,7 +60,6 @@ module Ensembl
62
60
  belongs_to :allele_group
63
61
  end
64
62
 
65
- # = DESCRIPTION
66
63
  # Store information on attributes types
67
64
  #
68
65
  # This class uses ActiveRecord to access data in the Ensembl database.
@@ -72,9 +69,6 @@ module Ensembl
72
69
  set_primary_key "attrib_type_id"
73
70
  end
74
71
 
75
-
76
- # = DESCRIPTION
77
- #
78
72
  # This class uses ActiveRecord to access data in the Ensembl database.
79
73
  # See the general documentation of the Ensembl module for
80
74
  # more information on what this means and what methods are available.
@@ -82,8 +76,6 @@ module Ensembl
82
76
 
83
77
  end
84
78
 
85
- # = DESCRIPTION
86
- #
87
79
  # This class uses ActiveRecord to access data in the Ensembl database.
88
80
  # See the general documentation of the Ensembl module for
89
81
  # more information on what this means and what methods are available.
@@ -92,8 +84,6 @@ module Ensembl
92
84
  has_many :failed_variations
93
85
  end
94
86
 
95
- # = DESCRIPTION
96
- #
97
87
  # This class uses ActiveRecord to access data in the Ensembl database.
98
88
  # See the general documentation of the Ensembl module for
99
89
  # more information on what this means and what methods are available.
@@ -103,8 +93,6 @@ module Ensembl
103
93
  belongs_to :variation
104
94
  end
105
95
 
106
- # = DESCRIPTION
107
- #
108
96
  # This class uses ActiveRecord to access data in the Ensembl database.
109
97
  # See the general documentation of the Ensembl module for
110
98
  # more information on what this means and what methods are available.
@@ -125,9 +113,6 @@ module Ensembl
125
113
  has_many :variation_annotations
126
114
  end
127
115
 
128
-
129
-
130
- # = DESCRIPTION
131
116
  # The Sample class gives information about the biological samples stored in the database.
132
117
  #
133
118
  # This class uses ActiveRecord to access data in the Ensembl database.
@@ -155,7 +140,6 @@ module Ensembl
155
140
  belongs_to :population, :foreign_key => "population_sample_id"
156
141
  end
157
142
 
158
- # = DESCRIPTION
159
143
  # The Individual class gives information on the single individuals used
160
144
  # to retrieve one or more biological samples.
161
145
  #
@@ -207,7 +191,6 @@ module Ensembl
207
191
 
208
192
  end
209
193
 
210
- # = DESCRIPTION
211
194
  # The PopulationGenotype class gives information about alleles and allele
212
195
  # frequencies for a SNP observed within a population or a group of samples.
213
196
  #
@@ -222,7 +205,6 @@ module Ensembl
222
205
  has_many :compressed_genotype_single_bps, :foreign_key => "sample_id"
223
206
  end
224
207
 
225
- # = DESCRIPTION
226
208
  # The SampleSynonym class represents information about alternative names
227
209
  # for sample entries.
228
210
  #
@@ -236,7 +218,6 @@ module Ensembl
236
218
  belongs_to :population
237
219
  end
238
220
 
239
- # = DESCRIPTION
240
221
  # The Source class gives information on the different databases and SNP
241
222
  # panels used to retrieve the data
242
223
  #
@@ -288,7 +269,6 @@ module Ensembl
288
269
  has_many :variation_synonyms,:foreign_key => "subsnp_id"
289
270
  end
290
271
 
291
- # = DESCRIPTION
292
272
  # The VariationSynonym class gives information on alterative names used
293
273
  # for Variation entries.
294
274
  #
@@ -302,7 +282,6 @@ module Ensembl
302
282
  belongs_to :subsnp_handle
303
283
  end
304
284
 
305
- # = DESCRIPTION
306
285
  # The VariationGroup class represents a group of variations (SNPs) that are
307
286
  # linked and present toghether.
308
287
  #
@@ -318,7 +297,6 @@ module Ensembl
318
297
  has_one :allele_group
319
298
  end
320
299
 
321
- # = DESCRIPTION
322
300
  # The VariationGroupVariation class is a connection class.
323
301
  # Should not be used directly.
324
302
  #
@@ -330,7 +308,6 @@ module Ensembl
330
308
  belongs_to :variation_group
331
309
  end
332
310
 
333
- # = DESCRIPTION
334
311
  # The VariationGroupFeature class gives information on the genomic position
335
312
  # of each VariationGroup.
336
313
  #
@@ -350,7 +327,6 @@ module Ensembl
350
327
  end
351
328
 
352
329
 
353
- # = DESCRIPTION
354
330
  # The FlankingSequence class gives information about the genomic coordinates
355
331
  # of the flanking sequences, for a single VariationFeature.
356
332
  #
@@ -361,7 +337,6 @@ module Ensembl
361
337
  belongs_to :variation
362
338
  end
363
339
 
364
- # = DESCRIPTION
365
340
  # The TaggedVariationFeature class is a connection class.
366
341
  # Should not be used directly.
367
342
  #
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-ensembl-api
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.0"
4
+ hash: 21
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 1
10
+ version: 1.0.1
5
11
  platform: ruby
6
12
  authors:
7
13
  - Jan Aerts
@@ -10,29 +16,37 @@ autorequire:
10
16
  bindir: bin
11
17
  cert_chain: []
12
18
 
13
- date: 2010-12-15 00:00:00 +01:00
19
+ date: 2010-12-16 00:00:00 +01:00
14
20
  default_executable: ensembl
15
21
  dependencies:
16
22
  - !ruby/object:Gem::Dependency
17
23
  name: bio
18
- type: :runtime
19
- version_requirement:
20
- version_requirements: !ruby/object:Gem::Requirement
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
21
27
  requirements:
22
28
  - - ">="
23
29
  - !ruby/object:Gem::Version
30
+ hash: 1
31
+ segments:
32
+ - 1
24
33
  version: "1"
25
- version:
34
+ type: :runtime
35
+ version_requirements: *id001
26
36
  - !ruby/object:Gem::Dependency
27
37
  name: activerecord
28
- type: :runtime
29
- version_requirement:
30
- version_requirements: !ruby/object:Gem::Requirement
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
31
41
  requirements:
32
42
  - - ">="
33
43
  - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
34
47
  version: "0"
35
- version:
48
+ type: :runtime
49
+ version_requirements: *id002
36
50
  description: ruby-ensembl-api provides a ruby API to the Ensembl databases (http://www.ensembl.org)
37
51
  email:
38
52
  - jan.aerts@gmail.com
@@ -71,7 +85,7 @@ files:
71
85
  - test/unit/test_connection.rb
72
86
  - test/unit/test_releases.rb
73
87
  - TUTORIAL.rdoc
74
- has_rdoc: true
88
+ has_rdoc: yard
75
89
  homepage: http://github.com/jandot/ruby-ensembl-api
76
90
  licenses: []
77
91
 
@@ -81,21 +95,27 @@ rdoc_options: []
81
95
  require_paths:
82
96
  - lib
83
97
  required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
84
99
  requirements:
85
100
  - - ">="
86
101
  - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
87
105
  version: "0"
88
- version:
89
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
90
108
  requirements:
91
109
  - - ">="
92
110
  - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
93
114
  version: "0"
94
- version:
95
115
  requirements: []
96
116
 
97
117
  rubyforge_project:
98
- rubygems_version: 1.3.5
118
+ rubygems_version: 1.3.7
99
119
  signing_key:
100
120
  specification_version: 3
101
121
  summary: API to Ensembl databases