ruby-ensembl-api 0.9.6 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/TUTORIAL.rdoc +1 -1
  2. data/bin/variation_effect_predictor +106 -0
  3. data/lib/ensembl.rb +2 -2
  4. data/lib/ensembl/core/activerecord.rb +119 -225
  5. data/lib/ensembl/core/collection.rb +14 -10
  6. data/lib/ensembl/core/project.rb +6 -8
  7. data/lib/ensembl/core/slice.rb +87 -123
  8. data/lib/ensembl/core/transcript.rb +49 -65
  9. data/lib/ensembl/core/transform.rb +6 -8
  10. data/lib/ensembl/db_connection.rb +56 -72
  11. data/lib/ensembl/variation/activerecord.rb +138 -8
  12. data/lib/ensembl/variation/variation.rb +284 -46
  13. data/samples/ensembl_genomes_example.rb +60 -0
  14. data/samples/examples_perl_tutorial.rb +125 -0
  15. data/samples/small_example_ruby_api.rb +34 -0
  16. data/samples/variation_example.rb +67 -0
  17. data/test/unit/{release_56 → release_60}/core/test_gene.rb +6 -6
  18. data/test/unit/release_60/core/test_project_human.rb +38 -0
  19. data/test/unit/{release_56 → release_60}/core/test_slice.rb +1 -8
  20. data/test/unit/release_60/core/test_transcript.rb +126 -0
  21. data/test/unit/{release_53 → release_60}/core/test_transform.rb +21 -21
  22. data/test/unit/release_60/variation/test_activerecord.rb +213 -0
  23. data/test/unit/release_60/variation/test_consequence.rb +158 -0
  24. data/test/unit/{release_56 → release_60}/variation/test_variation.rb +18 -17
  25. data/test/unit/test_connection.rb +2 -2
  26. data/test/unit/test_releases.rb +8 -8
  27. metadata +27 -43
  28. data/test/unit/data/seq_c6qbl.fa +0 -10
  29. data/test/unit/data/seq_cso19_coding.fa +0 -16
  30. data/test/unit/data/seq_cso19_transcript.fa +0 -28
  31. data/test/unit/data/seq_drd3_gene.fa +0 -838
  32. data/test/unit/data/seq_drd3_transcript.fa +0 -22
  33. data/test/unit/data/seq_drd4_transcript.fa +0 -24
  34. data/test/unit/data/seq_forward_composite.fa +0 -1669
  35. data/test/unit/data/seq_par_boundary.fa +0 -169
  36. data/test/unit/data/seq_rnd3_transcript.fa +0 -47
  37. data/test/unit/data/seq_ub2r1_coding.fa +0 -13
  38. data/test/unit/data/seq_ub2r1_gene.fa +0 -174
  39. data/test/unit/data/seq_ub2r1_transcript.fa +0 -26
  40. data/test/unit/data/seq_y.fa +0 -2
  41. data/test/unit/ensembl_genomes/test_collection.rb +0 -51
  42. data/test/unit/ensembl_genomes/test_gene.rb +0 -52
  43. data/test/unit/ensembl_genomes/test_slice.rb +0 -71
  44. data/test/unit/ensembl_genomes/test_variation.rb +0 -17
  45. data/test/unit/release_50/core/test_project.rb +0 -215
  46. data/test/unit/release_50/core/test_project_human.rb +0 -58
  47. data/test/unit/release_50/core/test_relationships.rb +0 -66
  48. data/test/unit/release_50/core/test_sequence.rb +0 -175
  49. data/test/unit/release_50/core/test_slice.rb +0 -121
  50. data/test/unit/release_50/core/test_transcript.rb +0 -108
  51. data/test/unit/release_50/core/test_transform.rb +0 -223
  52. data/test/unit/release_50/variation/test_activerecord.rb +0 -143
  53. data/test/unit/release_50/variation/test_variation.rb +0 -84
  54. data/test/unit/release_53/core/test_gene.rb +0 -66
  55. data/test/unit/release_53/core/test_project.rb +0 -96
  56. data/test/unit/release_53/core/test_project_human.rb +0 -65
  57. data/test/unit/release_53/core/test_slice.rb +0 -47
  58. data/test/unit/release_53/variation/test_activerecord.rb +0 -145
  59. data/test/unit/release_53/variation/test_variation.rb +0 -71
  60. data/test/unit/release_56/core/test_project.rb +0 -96
  61. data/test/unit/release_56/core/test_transform.rb +0 -63
  62. data/test/unit/release_56/variation/test_activerecord.rb +0 -142
data/TUTORIAL.rdoc CHANGED
@@ -2,7 +2,7 @@
2
2
  By Jan Aerts. Copy-paste-modified from the excellent perl API tutorial at
3
3
  http://www.ensembl.org/info/software/core/core_tutorial.html (with permission of the core Ensembl team).
4
4
 
5
- Based on release 50.
5
+ Based on release 60.
6
6
 
7
7
  == Introduction
8
8
  This tutorial describes how to use the Ensembl Core Ruby API. It is intended to be an introduction and demonstration of the general API concepts. This tutorial is not comprehensive, but it will hopefully enable to reader to become quickly productive, and facilitate a rapid understanding of the core system. This tutorial assumes at least some familiarity with Ruby.
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ def run_calculations(args)
4
+
5
+ ### GETTING COMMAND LINE PARAMETERS ###
6
+ args.each_index {|x| args.insert(x+1,1) if args[x] == '-h' or args[x] == '-g' } # to have always an even number of parameters
7
+ params = Hash[*args]
8
+
9
+ ### PRINT HELP ###
10
+ if params.key?("-h") then
11
+ show_help()
12
+ exit
13
+ end
14
+
15
+ ### CHECKING INPUT FILE ###
16
+ if params["-i"].nil? or params == {} then
17
+ show_help()
18
+ puts "\nERROR: You must provide an input file!\n\n"
19
+ exit
20
+ end
21
+
22
+ ### SETTING DEFAULT MySQL USER IF NOT SPECIFIED ###
23
+ params["-u"] = "anonymous" if params["-u"].nil?
24
+ params["-P"] = params["-P"].to_i if params["-P"] != nil
25
+
26
+ ### OPENING CONNECTION TO ENSEMBL DATABASE ###
27
+ require 'rubygems'
28
+ require 'ensembl'
29
+ include Ensembl::Variation
30
+
31
+ if params.key?("-g") then
32
+ params["-d"] = "mysql.ebi.ac.uk" if params["-d"].nil?
33
+ if params["-s"].nil? or params["-r"].nil? then
34
+ puts "\nERROR: For Ensembl Genomes you must provide a valid species and release number!\n\n"
35
+ exit
36
+ end
37
+ DBConnection.ensemblgenomes_connect(params["-s"],params["-r"].to_i,:host => params["-d"], :username => params["-u"],:password => params["-p"],:port => params["-P"])
38
+ else
39
+ params["-s"] = "homo_sapiens" if params["-s"].nil?
40
+ params["-r"] = 60 if params["-r"].nil?
41
+ params["-d"] = "ensembldb.ensembl.org" if params["-d"].nil?
42
+ DBConnection.connect(params["-s"],params["-r"].to_i,:host => params["-d"], :username => params["-u"],:password => params["-p"],:port => params["-P"])
43
+ end
44
+
45
+ ### STARTING VARIATIONS PREDICTIONS ###
46
+ File.open(params["-i"]) do |f|
47
+ f.each_line do |l|
48
+ next if l =~ /^#/
49
+ l.chomp!
50
+ data = l.split("\t")
51
+ get_consequence(data[0],data[1],data[2],data[3],data[4],data[5]).each do |tv|
52
+ puts l+"\t Effect: "+tv.consequence_type+" -- "+tv.transcript_stable_id.to_s
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+
59
+ def show_help()
60
+ puts "\nRuby Ensembl API -- Variation Effects Predictor"
61
+ puts "\n\tUSAGE: variation_effect_predictor -i variations.txt [OPTIONS]\n\n"
62
+ puts "\tOPTIONS:\n"
63
+ puts "\t\t-i\t Input file (Tab separated) REQUIRED"
64
+ puts "\t\t-s\t Species in snake case (default is 'homo_sapiens')"
65
+ puts "\t\t-r\t Ensembl Database release (default is 60)"
66
+ puts "\t\t-d\t Ensembl Database Server (default is 'ensembldb.ensembl.org')"
67
+ puts "\t\t-u\t Ensembl Database username (default is 'anonymous')"
68
+ puts "\t\t-p\t Ensembl Database password (only required for local Ensembl database)"
69
+ puts "\t\t-P\t Ensembl Database MySQL port connection (only required for local Ensembl database)"
70
+ puts "\t\t-g\t Connects to Ensembl Genomes Server (default is 'mysql.ebi.ac.uk')"
71
+ puts "\t\t-h\t Show this help"
72
+ puts "\n\n"
73
+ end
74
+
75
+
76
+ def get_consequence(chr,start,stop,alleles,strand,name)
77
+ variation = VariationFeature.new(:seq_region_id => SeqRegion.find_by_name(chr).seq_region_id,
78
+ :seq_region_start => start,
79
+ :seq_region_end => stop,
80
+ :allele_string => alleles,
81
+ :seq_region_strand => strand,
82
+ :variation_name => name
83
+ )
84
+ return variation.transcript_variations
85
+ end
86
+
87
+
88
+ if __FILE__ == $PROGRAM_NAME
89
+ run_calculations(ARGV)
90
+ end
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
data/lib/ensembl.rb CHANGED
@@ -8,8 +8,8 @@
8
8
  #
9
9
 
10
10
  module Ensembl
11
- ENSEMBL_RELEASE = 56
12
-
11
+ ENSEMBL_RELEASE = 60
12
+
13
13
  class Session
14
14
  attr_accessor :coord_systems
15
15
  attr_accessor :seqlevel_id, :seqlevel_coord_system
@@ -5,8 +5,9 @@
5
5
  # Francesco Strozzi <francesco.strozzi@gmail.com>
6
6
  # License:: The Ruby License
7
7
  #
8
+ # @author Jan Aerts
9
+ # @author Francesco Strozzi
8
10
 
9
- # = DESCRIPTION
10
11
  # == What is it?
11
12
  # The Ensembl module provides an API to the Ensembl databases
12
13
  # stored at ensembldb.ensembl.org. This is the same information that is
@@ -69,23 +70,19 @@
69
70
  # puts SeqRegion.reflect_on_all_associations(:has_one).collect{|a| a.name.to_s}.join("\n")
70
71
  # puts SeqRegion.reflect_on_all_associations(:belongs_to).collect{|a| a.name.to_s}.join("\n")
71
72
  module Ensembl
72
- # = DESCRIPTION
73
73
  # The Ensembl::Core module covers the core databases from
74
74
  # ensembldb.ensembl.org and covers mainly sequences and their annotations.
75
75
  # For a full description of the database (and therefore the classes that
76
76
  # are available), see http://www.ensembl.org/info/software/core/schema/index.html
77
77
  # and http://www.ensembl.org/info/software/core/schema/schema_description.html
78
78
  module Core
79
- # = DESCRIPTION
80
79
  # The Sliceable mixin holds the get_slice method and can be included
81
80
  # in any class that lends itself to having a position on a SeqRegion.
82
81
  module Sliceable
83
- # = DESCRIPTION
84
82
  # The Sliceable#slice method takes the coordinates on a reference
85
83
  # and creates a Ensembl::Core::Slice object.
86
- # ---
87
- # *Arguments*:: none
88
- # *Returns*:: Ensembl::Core::Slice object
84
+ #
85
+ # @return [Ensembl::Core::Slice] Ensembl::Core::Slice object
89
86
  def slice
90
87
  start, stop, strand = nil, nil, nil
91
88
 
@@ -104,58 +101,47 @@ module Ensembl
104
101
  return Ensembl::Core::Slice.new(self.seq_region, start, stop, strand)
105
102
  end
106
103
 
107
- # = DESCRIPTION
108
104
  # The Sliceable#seq method takes the coordinates on a reference, transforms
109
105
  # onto the seqlevel coordinate system if necessary, and retrieves the
110
106
  # sequence.
111
- # ---
112
- # *Arguments*:: none
113
- # *Returns*:: sequence
107
+ #
108
+ # @return [String] sequence
114
109
  def seq
115
110
  return self.slice.seq
116
111
  end
117
112
 
118
- # = DESCRIPTION
119
113
  # The Sliceable#start method is a convenience method and returns
120
114
  # self.seq_region_start.
121
- # ---
122
- # *Arguments*:: none
123
- # *Returns*:: sequence
115
+ #
116
+ # @return [Integer] seq_region_start
124
117
  def start
125
118
  return self.seq_region_start
126
119
  end
127
120
 
128
- # = DESCRIPTION
129
121
  # The Sliceable#stop method is a convenience method and returns
130
122
  # self.seq_region_end.
131
- # ---
132
- # *Arguments*:: none
133
- # *Returns*:: sequence
123
+ #
124
+ # @return [Integer] seq_region_end
134
125
  def stop
135
126
  return self.seq_region_end
136
127
  end
137
128
 
138
- # = DESCRIPTION
139
129
  # The Sliceable#strand method is a convenience method and returns
140
130
  # self.seq_region_strand.
141
- # ---
142
- # *Arguments*:: none
143
- # *Returns*:: sequence
131
+ #
132
+ # @return [Numeric] seq_region_strand
144
133
  def strand
145
134
  return self.seq_region_strand
146
135
  end
147
136
 
148
- # = DESCRIPTION
149
137
  # The Sliceable#length method returns the length of the feature (based on
150
138
  # seq_region_start and seq_region_end.
151
- # ---
152
- # *Arguments*:: none
153
- # *Returns*:: sequence
139
+ #
140
+ # @return [Integer] Length of the slice
154
141
  def length
155
142
  return self.stop - self.start + 1
156
143
  end
157
144
 
158
- # = DESCRIPTION
159
145
  # The Sliceable#project method is used to transfer coordinates from one
160
146
  # coordinate system to another. Suppose you have a feature on a
161
147
  # contig in human (let's say on contig AC000031.6.1.38703) and you
@@ -170,19 +156,15 @@ module Ensembl
170
156
  # At the moment, projections can only be done if the two coordinate
171
157
  # systems are linked directly in the 'assembly' table.
172
158
  #
173
- # = USAGE
174
- #
159
+ # @example
175
160
  # # Get a contig slice in cow and project to scaffold level
176
161
  # # (i.e. going from a high rank coord system to a lower rank coord
177
162
  # # system)
178
163
  # original_feature = Gene.find(85743)
179
164
  # target_slices = original_feature.project('scaffold')
180
165
  #
181
- # ---
182
- # *Arguments*:
183
- # * coord_system_name:: name of coordinate system to project
184
- # coordinates to
185
- # *Returns*:: an array consisting of Slices and, if necessary, Gaps
166
+ # @param [String] coord_system_name Name of coordinate system to project coordinates to
167
+ # @return [Array<Slice,Gap>] an array consisting of Slices and, if necessary, Gaps
186
168
  def project(coord_system_name)
187
169
  return self.slice.project(coord_system_name)
188
170
  end
@@ -190,7 +172,6 @@ module Ensembl
190
172
  end
191
173
 
192
174
 
193
- # = DESCRIPTION
194
175
  # The CoordSystem class describes the coordinate system to which
195
176
  # a given SeqRegion belongs. It is an interface to the coord_system
196
177
  # table of the Ensembl mysql database.
@@ -205,7 +186,7 @@ module Ensembl
205
186
  # See the general documentation of the Ensembl module for
206
187
  # more information on what this means and what methods are available.
207
188
  #
208
- # = USAGE
189
+ # @example
209
190
  # coord_system = Ensembl::Core::CoordSystem.find_by_name('chromosome')
210
191
  # if coord_system == CoordSystem.toplevel
211
192
  # puts coord_system.name + " is the toplevel coordinate system."
@@ -215,12 +196,10 @@ module Ensembl
215
196
 
216
197
  has_many :seq_regions
217
198
 
218
- # = DESCRIPTION
219
199
  # The CoordSystem#toplevel? method checks if this coordinate system is the
220
200
  # toplevel coordinate system or not.
221
- # ---
222
- # *Arguments*:: none
223
- # *Returns*:: TRUE or FALSE
201
+ #
202
+ # @return [Boolean] True if coord_system is toplevel, else false.
224
203
  def toplevel?
225
204
  if Collection.check # When usign multi-species databases
226
205
  return true if self == CoordSystem.find_by_rank_and_species_id(1,self.species_id)
@@ -230,12 +209,10 @@ module Ensembl
230
209
  return false
231
210
  end
232
211
 
233
- # = DESCRIPTION
234
212
  # The CoordSystem#seqlevel? method checks if this coordinate system is the
235
213
  # seqlevel coordinate system or not.
236
- # ---
237
- # *Arguments*:: none
238
- # *Returns*:: TRUE or FALSE
214
+ #
215
+ # @return [Boolean] True if coord_system is seqlevel, else false.
239
216
  def seqlevel?
240
217
  if Collection.check # When usign multi-species databases
241
218
  return true if self == CoordSystem.find_by_sql("SELECT * FROM coord_system WHERE attrib LIKE '%sequence_level%' AND species_id = #{self.species_id}")[0]
@@ -245,12 +222,10 @@ module Ensembl
245
222
  return false
246
223
  end
247
224
 
248
- # = DESCRIPTION
249
225
  # The CoordSystem#find_toplevel class method returns the toplevel coordinate
250
226
  # system.
251
- # ---
252
- # *Arguments*:: none
253
- # *Returns*:: CoordSystem object
227
+ #
228
+ # @return [Ensembl::Core::CoordSystem] Toplevel coord_system object.
254
229
  def find_toplevel
255
230
  not_cached = false
256
231
  if Ensembl::SESSION.toplevel_coord_system.nil?
@@ -271,12 +246,10 @@ module Ensembl
271
246
  return Ensembl::SESSION.toplevel_coord_system
272
247
  end
273
248
 
274
- # = DESCRIPTION
275
249
  # The CoordSystem#find_seqlevel class method returns the seqlevel coordinate
276
250
  # system.
277
- # ---
278
- # *Arguments*:: none
279
- # *Returns*:: CoordSystem object
251
+ #
252
+ # @return [Ensembl::Core::CoordSystem] Seqlevel coord_system object.
280
253
  def find_seqlevel
281
254
  not_cached = false
282
255
  if Ensembl::SESSION.seqlevel_coord_system.nil?
@@ -297,12 +270,11 @@ module Ensembl
297
270
  return Ensembl::SESSION.seqlevel_coord_system
298
271
  end
299
272
 
300
- # = DESCRIPTION
301
273
  # The CoordSystem#find_level class method returns the seqlevel coordinate
302
274
  # system corresponding to the name passed.
303
- # ---
304
- # *Arguments*:: Coordinate system name
305
- # *Returns*:: CoordSystem object
275
+ #
276
+ # @param [String] coord_system_name Name of coordinate system
277
+ # @return [Ensembl::Core::CoordSystem] Coordinate system object
306
278
  def find_level(coord_system_name)
307
279
  if Collection.check # When usign multi-species databases
308
280
  return CoordSystem.find_by_sql("SELECT * FROM coord_system WHERE name = '#{coord_system_name}' AND species_id = #{self.species_id}")[0]
@@ -311,7 +283,6 @@ module Ensembl
311
283
  end
312
284
  end
313
285
 
314
- # = DESCRIPTION
315
286
  # The CoordSystem#find_default_by_name class method returns the
316
287
  # coordinate system by that name with the lowest rank. Normally, a lower
317
288
  # rank means a 'bigger' coordinate system. The 'chromosome' typically has
@@ -320,9 +291,8 @@ module Ensembl
320
291
  # for the NCBI36 and one for the NCBI35 version). The older version of these
321
292
  # is typically given a high number and the one with the new version is the
322
293
  # 'default' system.
323
- # ---
324
- # *Arguments*:: none
325
- # *Returns*:: CoordSystem object
294
+ #
295
+ # @return [Ensembl::Core::CoordSystem] Coordinate system object
326
296
  def self.find_default_by_name(name)
327
297
  all_coord_systems_with_name = Ensembl::Core::CoordSystem.find_all_by_name(name)
328
298
  if all_coord_systems_with_name.length == 1
@@ -332,13 +302,11 @@ module Ensembl
332
302
  end
333
303
  end
334
304
 
335
- # = DESCRIPTION
336
305
  # The CoordSystem#name_with_version returns a string containing the name
337
306
  # and version of the coordinate system. If no version is available, then
338
307
  # just the name is returned
339
- # ---
340
- # *Arguments*:: none
341
- # *Returns*:: String object
308
+ #
309
+ # @return [String] Name of the coordinate system if possible including version
342
310
  def name_with_version
343
311
  if self.version.nil?
344
312
  return name
@@ -368,7 +336,6 @@ module Ensembl
368
336
  #end
369
337
  end
370
338
 
371
- # = DESCRIPTION
372
339
  # The SeqRegion class describes a part of a coordinate systems. It is an
373
340
  # interface to the seq_region table of the Ensembl mysql database.
374
341
  #
@@ -376,7 +343,7 @@ module Ensembl
376
343
  # See the general documentation of the Ensembl module for
377
344
  # more information on what this means and what methods are available.
378
345
  #
379
- # = USAGE
346
+ # @example
380
347
  # chr4 = SeqRegion.find_by_name('4')
381
348
  # puts chr4.coord_system.name #--> 'chromosome'
382
349
  # chr4.genes.each do |gene|
@@ -414,25 +381,22 @@ module Ensembl
414
381
 
415
382
  alias attribs seq_region_attribs
416
383
 
417
- # = DESCRIPTION
418
384
  # The SeqRegion#slice method returns a slice object that covers the whole
419
385
  # of the seq_region.
420
- # ---
421
- # *Arguments*:: none
422
- # *Returns*:: Ensembl::Core::Slice object
386
+ #
387
+ # @return [Ensembl::Core::Slice] Slice object
423
388
  def slice
424
389
  return Ensembl::Core::Slice.new(self)
425
390
  end
426
391
 
427
- # = DESCRIPTION
428
392
  # The SeqRegion#assembled_seq_regions returns the sequence regions on which
429
393
  # the current region is assembled. For example, calling this method on a
430
394
  # contig sequence region, it might return the chromosome that that contig
431
395
  # is part of. Optionally, this method takes a coordinate system name so
432
396
  # that only regions of that coordinate system are returned.
433
- # ---
434
- # *Arguments*:: coord_system_name (optional)
435
- # *Returns*:: array of SeqRegion objects
397
+ #
398
+ # @param [String] coord_system_name Name of coordinate system
399
+ # @return [Array<SeqRegion>] Array of SeqRegion objects
436
400
  def assembled_seq_regions(coord_system_name = nil)
437
401
  if coord_system_name.nil?
438
402
  return self.asm_seq_regions
@@ -448,16 +412,15 @@ module Ensembl
448
412
  end
449
413
  end
450
414
 
451
- # = DESCRIPTION
452
415
  # The SeqRegion#component_seq_regions returns the sequence regions
453
416
  # contained within the current region (in other words: the bits used to
454
417
  # assemble the current region). For example, calling this method on a
455
418
  # chromosome sequence region, it might return the contigs that were assembled
456
419
  # into this chromosome. Optionally, this method takes a coordinate system
457
420
  # name so that only regions of that coordinate system are returned.
458
- # ---
459
- # *Arguments*:: coord_system_name (optional)
460
- # *Returns*:: array of SeqRegion objects
421
+ #
422
+ # @param [String] coord_system_name Name of coordinate system
423
+ # @return [Array<SeqRegion>] Array of SeqRegion objects
461
424
  def component_seq_regions(coord_system_name = nil)
462
425
  if coord_system_name.nil?
463
426
  return self.cmp_seq_regions
@@ -473,21 +436,17 @@ module Ensembl
473
436
  end
474
437
  end
475
438
 
476
- # = DESCRIPTION
477
439
  # This method queries the assembly table to find those rows (i.e.
478
440
  # AssemblyLink objects) for which this seq_region is the assembly.
479
441
  #
480
- # = USAGE
481
- #
442
+ # @example
482
443
  # my_seq_region = SeqRegion.find('4')
483
444
  # first_link = my_seq_region.assembly_links_as_assembly[0]
484
445
  # puts first_link.asm_start.to_s + "\t" + first_link.asm_end.to_s
485
446
  #
486
- # ---
487
- # *Arguments*:
488
- # * coord_system_name: name of coordinate system that the components
489
- # should belong to (default = nil)
490
- # *Returns*:: array of AssemblyLink objects
447
+ # @param [CoordSystem] coord_system Coordinate system object
448
+ # that the components should belong to
449
+ # @return [Array<AssemblyLink>] Array of AssemblyLink objects
491
450
  def assembly_links_as_assembly(coord_system = nil)
492
451
  if Ensembl::SESSION.coord_system_ids.has_key?(coord_system.name)
493
452
  coord_system_id = Ensembl::SESSION.coord_system_ids[coord_system.name]
@@ -499,21 +458,18 @@ module Ensembl
499
458
  return AssemblyLink.find_by_sql("SELECT * FROM assembly a WHERE a.asm_seq_region_id = #{self.id} AND a.cmp_seq_region_id IN (SELECT sr.seq_region_id FROM seq_region sr WHERE coord_system_id = #{coord_system.id} )")
500
459
  end
501
460
 
502
- # = DESCRIPTION
503
461
  # This method queries the assembly table to find those rows (i.e.
504
462
  # AssemblyLink objects) for which this seq_region is the component.
505
463
  #
506
- # = USAGE
464
+ # @example
507
465
  #
508
466
  # my_seq_region = SeqRegion.find('Chr4.003.1')
509
467
  # first_link = my_seq_region.assembly_links_as_component[0]
510
468
  # puts first_link.asm_start.to_s + "\t" + first_link.asm_end.to_s
511
469
  #
512
- # ---
513
- # *Arguments*:
514
- # * coord_system_name: name of coordinate system that the assembly
515
- # should belong to (default = nil)
516
- # *Returns*:: array of AssemblyLink objects
470
+ # @param [CoordSystem] coord_system Coordinate system object that the assembly
471
+ # should belong to
472
+ # @return [Array<AssemblyLink>] Array of AssemblyLink objects
517
473
  def assembly_links_as_component(coord_system = nil)
518
474
  if coord_system.nil?
519
475
  return self.asm_links_as_cmp
@@ -522,25 +478,23 @@ module Ensembl
522
478
  end
523
479
  end
524
480
 
525
- # = DESCRIPTION
526
481
  # The SeqRegion#sequence method returns the sequence of this seq_region. At
527
482
  # the moment, it will only return the sequence if the region belongs to the
528
483
  # seqlevel coordinate system.
529
- # ---
530
- # *Arguments*:: none
531
- # *Returns*:: DNA sequence as String
484
+ #
485
+ # @return [String] DNA sequence
532
486
  def sequence
533
487
  return self.dna.sequence
534
488
  end
535
489
  alias seq sequence
536
490
 
537
- # = DESCRIPTION
538
491
  # The SeqRegion#subsequence method returns a subsequence of this seq_region. At
539
492
  # the moment, it will only return the sequence if the region belongs to the
540
493
  # seqlevel coordinate system.
541
- # ---
542
- # *Arguments*:: start and stop position
543
- # *Returns*:: DNA sequence as String
494
+ #
495
+ # @param [Integer] start Start position
496
+ # @param [Integer] stop Stop position
497
+ # @return [String] DNA sequence
544
498
  def subsequence(start, stop)
545
499
  return self.seq.slice(start - 1, (stop - start) + 1)
546
500
  end
@@ -548,7 +502,6 @@ module Ensembl
548
502
 
549
503
  end
550
504
 
551
- # = DESCRIPTION
552
505
  # The AssemblyLink class describes the relationships between different
553
506
  # seq_regions. For example, a chromosome might consist of a number of
554
507
  # scaffolds, each of which in turn consists of a number of contigs. The
@@ -560,11 +513,11 @@ module Ensembl
560
513
  # See the general documentation of the Ensembl module for
561
514
  # more information on what this means and what methods are available.
562
515
  #
563
- # = USAGE
516
+ # @example
564
517
  # chr4 = SeqRegion.find_by_name('4')
565
518
  # puts chr4.coord_system.name #--> 'chromosome'
566
519
  # chr4.genes.each do |gene|
567
- # puts gene.biotype
520
+ # puts gene.biotype
568
521
  # end
569
522
  class AssemblyLink < DBConnection
570
523
  set_table_name 'assembly'
@@ -575,7 +528,6 @@ module Ensembl
575
528
  belongs_to :cmp_seq_region, :foreign_key => 'cmp_seq_region_id', :class_name => 'SeqRegion'
576
529
  end
577
530
 
578
- # = DESCRIPTION
579
531
  # The AssemblyException class describes the exceptions in to AssemblyLink. Most
580
532
  # notably, this concerns the allosomes. In human, for example, only the
581
533
  # part of the Y chromosome that is different from X is covered in the
@@ -597,7 +549,6 @@ module Ensembl
597
549
  belongs_to :seq_region
598
550
  end
599
551
 
600
- # = DESCRIPTION
601
552
  # The MetaCoord class describes what coordinate systems are used to annotate
602
553
  # features. It will for example tell you that marker_features are annotated
603
554
  # either on the chromosome, supercontig and clone level.
@@ -611,7 +562,6 @@ module Ensembl
611
562
  set_primary_key nil
612
563
  end
613
564
 
614
- # = DESCRIPTION
615
565
  # The Meta class describes meta data of the database. These include information
616
566
  # on what coordinate system is mapping on another one and which patches
617
567
  # are applied.
@@ -625,14 +575,13 @@ module Ensembl
625
575
  set_primary_key nil
626
576
  end
627
577
 
628
- # = DESCRIPTION
629
578
  # The Analysis class describes an analysis.
630
579
  #
631
580
  # This class uses ActiveRecord to access data in the Ensembl database.
632
581
  # See the general documentation of the Ensembl module for
633
582
  # more information on what this means and what methods are available.
634
583
  #
635
- # = USAGE
584
+ # @example
636
585
  # repeat_masker_analysis = Analysis.find_by_logic_name('RepeatMask')
637
586
  # puts repeat_masker_analysis.to_yaml
638
587
  class Analysis < DBConnection
@@ -650,14 +599,13 @@ module Ensembl
650
599
  has_many :prediction_transcripts
651
600
  end
652
601
 
653
- # = DESCRIPTION
654
602
  # The AnalysisDescription class belongs to an analysis.
655
603
  #
656
604
  # This class uses ActiveRecord to access data in the Ensembl database.
657
605
  # See the general documentation of the Ensembl module for
658
606
  # more information on what this means and what methods are available.
659
607
  #
660
- # = USAGE
608
+ # @example
661
609
  # descr = AnalysisDescription.find(3)
662
610
  # puts descr.to_yaml
663
611
  class AnalysisDescription < DBConnection
@@ -666,7 +614,6 @@ module Ensembl
666
614
  belongs_to :analysis
667
615
  end
668
616
 
669
- # = DESCRIPTION
670
617
  # The Dna class contains the actual DNA sequence for the sequence regions
671
618
  # that belong to the seq_level coordinate system.
672
619
  #
@@ -674,7 +621,7 @@ module Ensembl
674
621
  # See the general documentation of the Ensembl module for
675
622
  # more information on what this means and what methods are available.
676
623
  #
677
- # = USAGE
624
+ # @example
678
625
  # seq_region = SeqRegion.find(1)
679
626
  # puts seq_region.dna.sequence
680
627
  class Dna < DBConnection
@@ -683,7 +630,6 @@ module Ensembl
683
630
  belongs_to :seq_region
684
631
  end
685
632
 
686
- # = DESCRIPTION
687
633
  # The Exon class describes an exon.
688
634
  #
689
635
  # This class uses ActiveRecord to access data in the Ensembl database.
@@ -694,7 +640,7 @@ module Ensembl
694
640
  # to a SeqRegion object and a Slice can be created for objects of this
695
641
  # class. See Sliceable and Slice for more information.
696
642
  #
697
- # = USAGE
643
+ # @example
698
644
  # seq_region = SeqRegion.find(1)
699
645
  # puts seq_region.exons.length
700
646
  class Exon < DBConnection
@@ -719,7 +665,6 @@ module Ensembl
719
665
  return self.exon_stable_id.stable_id
720
666
  end
721
667
 
722
- # = DESCRIPTION
723
668
  # The Exon#seq method returns the sequence of the exon.
724
669
  def seq
725
670
  seq_region = nil
@@ -732,9 +677,19 @@ module Ensembl
732
677
  slice = Ensembl::Core::Slice.new(seq_region, seq_region_start, seq_region_end, seq_region_strand)
733
678
  return slice.seq
734
679
  end
680
+
681
+
682
+ def self.find_by_stable_id(stable_id)
683
+ exon_stable_id = ExonStableId.find_by_stable_id(stable_id)
684
+ if exon_stable_id.nil?
685
+ return nil
686
+ else
687
+ return exon_stable_id.exon
688
+ end
689
+ end
690
+
735
691
  end
736
692
 
737
- # = DESCRIPTION
738
693
  # The ExonStableId class provides an interface to the exon_stable_id
739
694
  # table. This table contains Ensembl stable IDs for exons.
740
695
  #
@@ -742,7 +697,7 @@ module Ensembl
742
697
  # See the general documentation of the Ensembl module for
743
698
  # more information on what this means and what methods are available.
744
699
  #
745
- # = USAGE
700
+ # @example
746
701
  # my_exon = ExonStableId.find_by_stable_id('ENSE00001494622').exon
747
702
  class ExonStableId < DBConnection
748
703
  set_primary_key 'stable_id'
@@ -750,14 +705,13 @@ module Ensembl
750
705
  belongs_to :exon
751
706
  end
752
707
 
753
- # = DESCRIPTION
754
708
  # The ExonTranscript class provides the link between exons and transcripts.
755
709
  #
756
710
  # This class uses ActiveRecord to access data in the Ensembl database.
757
711
  # See the general documentation of the Ensembl module for
758
712
  # more information on what this means and what methods are available.
759
713
  #
760
- # = USAGE
714
+ # @example
761
715
  # link = ExonTranscript.find(1)
762
716
  # puts link.exon.to_yaml
763
717
  # puts link.transcript.to_yaml
@@ -785,7 +739,6 @@ module Ensembl
785
739
  belongs_to :protein_align_feature, :class_name => "ProteinAlignFeature", :foreign_key => 'feature_id'
786
740
  end
787
741
 
788
- # = DESCRIPTION
789
742
  # The SimpleFeature class describes simple features that have positions
790
743
  # on a SeqRegion.
791
744
  #
@@ -797,7 +750,7 @@ module Ensembl
797
750
  # to a SeqRegion object and a Slice can be created for objects of this
798
751
  # class. See Sliceable and Slice for more information.
799
752
  #
800
- # = USAGE
753
+ # @example
801
754
  # simple_feature = SimpleFeature.find(123)
802
755
  # puts simple_feature.analysis.logic_name
803
756
  class SimpleFeature < DBConnection
@@ -809,7 +762,6 @@ module Ensembl
809
762
  belongs_to :analysis
810
763
  end
811
764
 
812
- # = DESCRIPTION
813
765
  # The DensityFeature class provides an interface to the density_feature
814
766
  # table.
815
767
  #
@@ -821,7 +773,7 @@ module Ensembl
821
773
  # to a SeqRegion object and a Slice can be created for objects of this
822
774
  # class. See Sliceable and Slice for more information.
823
775
  #
824
- # = USAGE
776
+ # @example
825
777
  # density_feature = DensityFeature.find(2716384)
826
778
  # puts density_feature.to_yaml
827
779
  class DensityFeature < DBConnection
@@ -831,7 +783,6 @@ module Ensembl
831
783
  belongs_to :seq_region
832
784
  end
833
785
 
834
- # = DESCRIPTION
835
786
  # The DensityType class provides an interface to the density_type
836
787
  # table.
837
788
  #
@@ -850,7 +801,6 @@ module Ensembl
850
801
  belongs_to :analysis
851
802
  end
852
803
 
853
- # = DESCRIPTION
854
804
  # The Marker class provides an interface to the marker
855
805
  # table. This table contains primer sequences and PCR product lengths.
856
806
  #
@@ -858,7 +808,7 @@ module Ensembl
858
808
  # See the general documentation of the Ensembl module for
859
809
  # more information on what this means and what methods are available.
860
810
  #
861
- # = USAGE
811
+ # @example
862
812
  # marker = Marker.find(52194)
863
813
  # puts marker.left_primer
864
814
  # puts marker.right_primer
@@ -874,23 +824,19 @@ module Ensembl
874
824
  nil
875
825
  end
876
826
 
877
- # = DESCRIPTION
878
827
  # The Marker#name method returns a comma-separated list of synonyms of
879
828
  # this marker
880
829
  #
881
- # = USAGE
830
+ # @example
882
831
  # marker = Marker.find(1)
883
832
  # puts marker.name --> 58017,D29149
884
833
  def name
885
834
  self.marker_synonyms.collect{|ms| ms.name}.join(',')
886
835
  end
887
836
 
888
- # = DESCRIPTION
889
837
  # The Marker#find_by_name class method returns one marker with this name.
890
838
  #
891
- # ---
892
- # *Arguments*:: name
893
- # *Returns*:: Marker object or nil
839
+ # @return [Marker, nil] Marker object or nil
894
840
  def self.find_by_name(name)
895
841
  all_names = self.find_all_by_name(name)
896
842
  if all_names.length == 0
@@ -900,12 +846,10 @@ module Ensembl
900
846
  end
901
847
  end
902
848
 
903
- # = DESCRIPTION
904
849
  # The Marker#find_all_by_name class method returns all markers with this
905
850
  # name. If no marker is found, it returns an empty array.
906
- # ---
907
- # *Arguments*:: name
908
- # *Returns*:: empty array or array of Marker objects
851
+ #
852
+ # @return [Array] Empty array or array of Marker objects
909
853
  def self.find_all_by_name(name)
910
854
  marker_synonyms = Ensembl::Core::MarkerSynonym.find_all_by_name(name)
911
855
  answers = Array.new
@@ -927,7 +871,6 @@ module Ensembl
927
871
 
928
872
  end
929
873
 
930
- # = DESCRIPTION
931
874
  # The MarkerSynonym class provides an interface to the marker_synonym
932
875
  # table. This table contains names for markers (that are themselves
933
876
  # stored in the marker table (so Marker class)).
@@ -936,7 +879,7 @@ module Ensembl
936
879
  # See the general documentation of the Ensembl module for
937
880
  # more information on what this means and what methods are available.
938
881
  #
939
- # = USAGE
882
+ # @example
940
883
  # marker = Marker.find(52194)
941
884
  # puts marker.marker_synonym.source
942
885
  # puts marker.marker_synonym.name
@@ -946,7 +889,6 @@ module Ensembl
946
889
  belongs_to :marker
947
890
  end
948
891
 
949
- # = DESCRIPTION
950
892
  # The MarkerFeature class provides an interface to the marker_feature
951
893
  # table. This table contains mappings of markers to a SeqRegion.
952
894
  #
@@ -958,7 +900,7 @@ module Ensembl
958
900
  # to a SeqRegion object and a Slice can be created for objects of this
959
901
  # class. See Sliceable and Slice for more information.
960
902
  #
961
- # = USAGE
903
+ # @example
962
904
  # marker = Marker.find(52194)
963
905
  # puts marker.marker_feature.seq_region_start.to_s
964
906
  # puts marker.marker_feature.seq_region_end.to_s
@@ -971,7 +913,6 @@ module Ensembl
971
913
  belongs_to :seq_region
972
914
  end
973
915
 
974
- # = DESCRIPTION
975
916
  # The MiscFeature class provides an interface to the misc_feature
976
917
  # table. The actual type of feature is stored in the MiscSet class.
977
918
  #
@@ -983,7 +924,7 @@ module Ensembl
983
924
  # to a SeqRegion object and a Slice can be created for objects of this
984
925
  # class. See Sliceable and Slice for more information.
985
926
  #
986
- # = USAGE
927
+ # @example
987
928
  # #TODO
988
929
  class MiscFeature < DBConnection
989
930
  include Sliceable
@@ -1015,7 +956,6 @@ module Ensembl
1015
956
  end
1016
957
 
1017
958
 
1018
- # = DESCRIPTION
1019
959
  # The MiscAttrib class provides an interface to the misc_attrib
1020
960
  # table. It is the link between MiscFeature and AttribType.
1021
961
  #
@@ -1023,7 +963,7 @@ module Ensembl
1023
963
  # See the general documentation of the Ensembl module for
1024
964
  # more information on what this means and what methods are available.
1025
965
  #
1026
- # = USAGE
966
+ # @example
1027
967
  # marker = Marker.find(52194)
1028
968
  # puts marker.marker_feature.seq_region_start.to_s
1029
969
  # puts marker.marker_feature.seq_region_end.to_s
@@ -1038,7 +978,6 @@ module Ensembl
1038
978
  end
1039
979
  end
1040
980
 
1041
- # = DESCRIPTION
1042
981
  # The MiscSet class provides an interface to the misc_set
1043
982
  # table. This table contains the sets to which MiscFeature objects
1044
983
  # belong.
@@ -1047,7 +986,7 @@ module Ensembl
1047
986
  # See the general documentation of the Ensembl module for
1048
987
  # more information on what this means and what methods are available.
1049
988
  #
1050
- # = USAGE
989
+ # @example
1051
990
  # feature_set = MiscFeature.find(1)
1052
991
  # puts feature_set.features.length.to_s
1053
992
  class MiscSet < DBConnection
@@ -1057,7 +996,6 @@ module Ensembl
1057
996
  has_many :misc_features, :through => :misc_feature_misc_set
1058
997
  end
1059
998
 
1060
- # = DESCRIPTION
1061
999
  # The MiscFeatureMiscSet class provides an interface to the
1062
1000
  # misc_feature_misc_set table. This table links MiscFeature objects to
1063
1001
  # their MiscSet.
@@ -1066,7 +1004,7 @@ module Ensembl
1066
1004
  # See the general documentation of the Ensembl module for
1067
1005
  # more information on what this means and what methods are available.
1068
1006
  #
1069
- # = USAGE
1007
+ # @example
1070
1008
  # # TODO
1071
1009
  class MiscFeatureMiscSet < DBConnection
1072
1010
  set_primary_key nil
@@ -1075,7 +1013,6 @@ module Ensembl
1075
1013
  belongs_to :misc_set
1076
1014
  end
1077
1015
 
1078
- # = DESCRIPTION
1079
1016
  # The Gene class provides an interface to the gene
1080
1017
  # table. This table contains mappings of genes to a SeqRegion.
1081
1018
  #
@@ -1087,7 +1024,7 @@ module Ensembl
1087
1024
  # to a SeqRegion object and a Slice can be created for objects of this
1088
1025
  # class. See Sliceable and Slice for more information.
1089
1026
  #
1090
- # = USAGE
1027
+ # @example
1091
1028
  # puts Gene.find_by_biotype('protein_coding').length
1092
1029
  class Gene < DBConnection
1093
1030
  include Sliceable
@@ -1109,7 +1046,6 @@ module Ensembl
1109
1046
 
1110
1047
  alias attribs gene_attribs
1111
1048
 
1112
- # = DESCRIPTION
1113
1049
  # The Gene#stable_id method returns the stable_id of the gene (i.e. the
1114
1050
  # ENSG id).
1115
1051
  def stable_id
@@ -1117,7 +1053,6 @@ module Ensembl
1117
1053
 
1118
1054
  end
1119
1055
 
1120
- # = DESCRIPTION
1121
1056
  # The Gene#display_label method returns the default name of the gene.
1122
1057
  def display_label
1123
1058
  return Xref.find(self.display_xref_id).display_label
@@ -1126,7 +1061,6 @@ module Ensembl
1126
1061
  alias :label :display_label
1127
1062
  alias :name :display_label
1128
1063
 
1129
- # = DESCRIPTION
1130
1064
  # The Gene#find_all_by_name class method searches the Xrefs for that name
1131
1065
  # and returns an array of the corresponding Gene objects. If the name is
1132
1066
  # not found, it returns an empty array.
@@ -1140,7 +1074,6 @@ module Ensembl
1140
1074
  return answer
1141
1075
  end
1142
1076
 
1143
- # = DESCRIPTION
1144
1077
  # The Gene#find_by_name class method searches the Xrefs for that name
1145
1078
  # and returns one Gene objects (even if there should be more). If the name is
1146
1079
  # not found, it returns nil.
@@ -1153,7 +1086,6 @@ module Ensembl
1153
1086
  end
1154
1087
  end
1155
1088
 
1156
- # = DESCRIPTION
1157
1089
  # The Gene#find_by_stable_id class method fetches a Gene object based on
1158
1090
  # its stable ID (i.e. the "ENSG" accession number). If the name is
1159
1091
  # not found, it returns nil.
@@ -1166,7 +1098,6 @@ module Ensembl
1166
1098
  end
1167
1099
  end
1168
1100
 
1169
- # = DESCRIPTION
1170
1101
  # The Gene#all_xrefs method is a convenience method in that it combines
1171
1102
  # three methods into one. It collects all xrefs for the gene itself, plus
1172
1103
  # all xrefs for all transcripts for the gene, and all xrefs for all
@@ -1184,14 +1115,12 @@ module Ensembl
1184
1115
  return answer
1185
1116
  end
1186
1117
 
1187
- # = DESCRIPTION
1188
1118
  # The Gene#go_terms method returns all GO terms associated with a gene.
1189
1119
  def go_terms
1190
1120
  go_db_id = ExternalDb.find_by_db_name('GO').id
1191
1121
  return self.all_xrefs.select{|x| x.external_db_id == go_db_id}.collect{|x| x.dbprimary_acc}.uniq
1192
1122
  end
1193
1123
 
1194
- # = DESCRIPTION
1195
1124
  # The Gene#hgnc returns the HGNC symbol for the gene.
1196
1125
  def hgnc
1197
1126
  hgnc_db_id = ExternalDb.find_by_db_name('HGNC_curated_gene').id
@@ -1202,7 +1131,6 @@ module Ensembl
1202
1131
 
1203
1132
  end
1204
1133
 
1205
- # = DESCRIPTION
1206
1134
  # The Gene#canonical_transcript returns the longest transcript for that gene.
1207
1135
  #
1208
1136
  def canonical_transcript
@@ -1210,7 +1138,6 @@ module Ensembl
1210
1138
  return ct[0]
1211
1139
  end
1212
1140
 
1213
- # = DESCRIPTION
1214
1141
  # The GeneStableId class provides an interface to the gene_stable_id
1215
1142
  # table. This table contains Ensembl stable IDs for genes.
1216
1143
  #
@@ -1218,7 +1145,7 @@ module Ensembl
1218
1145
  # See the general documentation of the Ensembl module for
1219
1146
  # more information on what this means and what methods are available.
1220
1147
  #
1221
- # = USAGE
1148
+ # @example
1222
1149
  # my_gene = GeneStableId.find_by_stable_id('ENSBTAG00000011670').gene
1223
1150
  class GeneStableId < DBConnection
1224
1151
  set_primary_key 'stable_id'
@@ -1226,7 +1153,6 @@ module Ensembl
1226
1153
  belongs_to :gene
1227
1154
  end
1228
1155
 
1229
- # = DESCRIPTION
1230
1156
  # The MarkerMapLocation class provides an interface to the
1231
1157
  # marker_map_location table. This table contains mappings of
1232
1158
  # MarkerSynonym objects to a chromosome, and basically just stores
@@ -1236,7 +1162,7 @@ module Ensembl
1236
1162
  # See the general documentation of the Ensembl module for
1237
1163
  # more information on what this means and what methods are available.
1238
1164
  #
1239
- # = USAGE
1165
+ # @example
1240
1166
  # marker_synonym = MarkerSynonym.find_by_name('CYP19A1_(5)')
1241
1167
  # marker_synonym.marker_map_locations.each do |mapping|
1242
1168
  # puts mapping.chromosome_name + "\t" + mapping.position.to_s
@@ -1249,7 +1175,6 @@ module Ensembl
1249
1175
 
1250
1176
  end
1251
1177
 
1252
- # = DESCRIPTION
1253
1178
  # The Map class provides an interface to the map
1254
1179
  # table. This table contains genetic maps.
1255
1180
  #
@@ -1257,7 +1182,7 @@ module Ensembl
1257
1182
  # See the general documentation of the Ensembl module for
1258
1183
  # more information on what this means and what methods are available.
1259
1184
  #
1260
- # = USAGE
1185
+ # @example
1261
1186
  # map = Map.find_by_name('MARC')
1262
1187
  # puts map.markers.length.to_s
1263
1188
  class Map < DBConnection
@@ -1271,7 +1196,6 @@ module Ensembl
1271
1196
  end
1272
1197
  end
1273
1198
 
1274
- # = DESCRIPTION
1275
1199
  # The RepeatConsensus class provides an interface to the repeat_consensus
1276
1200
  # table. This table contains consensus sequences for repeats.
1277
1201
  #
@@ -1279,7 +1203,7 @@ module Ensembl
1279
1203
  # See the general documentation of the Ensembl module for
1280
1204
  # more information on what this means and what methods are available.
1281
1205
  #
1282
- # = USAGE
1206
+ # @example
1283
1207
  # repeat = RepeatFeature.find(29)
1284
1208
  # puts repeat.repeat_consensus.repeat_name + "\t" + repeat.repeat_consensus.repeat_consensus
1285
1209
  class RepeatConsensus < DBConnection
@@ -1288,7 +1212,6 @@ module Ensembl
1288
1212
  has_many :repeat_features
1289
1213
  end
1290
1214
 
1291
- # = DESCRIPTION
1292
1215
  # The RepeatFeature class provides an interface to the repeat_feature
1293
1216
  # table. This table contains mappings of repeats to a SeqRegion.
1294
1217
  #
@@ -1300,7 +1223,7 @@ module Ensembl
1300
1223
  # to a SeqRegion object and a Slice can be created for objects of this
1301
1224
  # class. See Sliceable and Slice for more information.
1302
1225
  #
1303
- # = USAGE
1226
+ # @example
1304
1227
  # repeat_feature = RepeatFeature.find(29)
1305
1228
  # puts repeat_feature.seq_region_start.to_s
1306
1229
  class RepeatFeature < DBConnection
@@ -1312,7 +1235,6 @@ module Ensembl
1312
1235
  belongs_to :seq_region
1313
1236
  end
1314
1237
 
1315
- # = DESCRIPTION
1316
1238
  # The SeqRegionAttrib class provides an interface to the seq_region_attrib
1317
1239
  # table. This table contains attribute values for SeqRegion objects
1318
1240
  #
@@ -1320,7 +1242,7 @@ module Ensembl
1320
1242
  # See the general documentation of the Ensembl module for
1321
1243
  # more information on what this means and what methods are available.
1322
1244
  #
1323
- # = USAGE
1245
+ # @example
1324
1246
  # chr4 = SeqRegion.find_by_name('4')
1325
1247
  # chr4.seq_region_attribs.each do |attrib|
1326
1248
  # puts attrib.attrib_type.name + "\t" + attrib.value.to_s
@@ -1332,7 +1254,6 @@ module Ensembl
1332
1254
  belongs_to :attrib_type
1333
1255
  end
1334
1256
 
1335
- # = DESCRIPTION
1336
1257
  # The GeneAttrib class provides an interface to the gene_attrib
1337
1258
  # table. This table contains attribute values for Gene objects
1338
1259
  #
@@ -1340,7 +1261,7 @@ module Ensembl
1340
1261
  # See the general documentation of the Ensembl module for
1341
1262
  # more information on what this means and what methods are available.
1342
1263
  #
1343
- # = USAGE
1264
+ # @example
1344
1265
  # #TODO
1345
1266
  class GeneAttrib < DBConnection
1346
1267
  set_primary_key nil
@@ -1349,7 +1270,6 @@ module Ensembl
1349
1270
  belongs_to :attrib_type
1350
1271
  end
1351
1272
 
1352
- # = DESCRIPTION
1353
1273
  # The AttribType class provides an interface to the attrib_type
1354
1274
  # table. This table contains the types that attributes can belong to for
1355
1275
  # SeqRegion, Gene and Transcript.
@@ -1358,7 +1278,7 @@ module Ensembl
1358
1278
  # See the general documentation of the Ensembl module for
1359
1279
  # more information on what this means and what methods are available.
1360
1280
  #
1361
- # = USAGE
1281
+ # @example
1362
1282
  # #TODO
1363
1283
  class AttribType < DBConnection
1364
1284
  set_primary_key 'attrib_type_id'
@@ -1373,7 +1293,6 @@ module Ensembl
1373
1293
  has_many :transcripts, :through => :transcript_attrib
1374
1294
  end
1375
1295
 
1376
- # = DESCRIPTION
1377
1296
  # The Transcript class provides an interface to the transcript_stable_id
1378
1297
  # table. This table contains the Ensembl stable IDs for Transcript
1379
1298
  # objects.
@@ -1382,7 +1301,7 @@ module Ensembl
1382
1301
  # See the general documentation of the Ensembl module for
1383
1302
  # more information on what this means and what methods are available.
1384
1303
  #
1385
- # = USAGE
1304
+ # @example
1386
1305
  # transcript_stable_id = TranscriptStableId.find_by_stable_id('ENSBTAT00000015494')
1387
1306
  # puts transcript_stable_id.transcript.to_yaml
1388
1307
  class TranscriptStableId < DBConnection
@@ -1391,7 +1310,6 @@ module Ensembl
1391
1310
  belongs_to :transcript
1392
1311
  end
1393
1312
 
1394
- # = DESCRIPTION
1395
1313
  # The TranscriptAttrib class provides an interface to the transcript_attrib
1396
1314
  # table. This table contains the attributes for Transcript objects.
1397
1315
  #
@@ -1399,7 +1317,7 @@ module Ensembl
1399
1317
  # See the general documentation of the Ensembl module for
1400
1318
  # more information on what this means and what methods are available.
1401
1319
  #
1402
- # = USAGE
1320
+ # @example
1403
1321
  # transcript = Transcript.find(32495)
1404
1322
  # transcript.transcript_attribs.each do |attr|
1405
1323
  # puts attr.attrib_type.name + "\t" + attr.value
@@ -1411,7 +1329,6 @@ module Ensembl
1411
1329
  belongs_to :attrib_type
1412
1330
  end
1413
1331
 
1414
- # = DESCRIPTION
1415
1332
  # The DnaAlignFeature class provides an interface to the
1416
1333
  # dna_align_feature table. This table contains sequence similarity
1417
1334
  # mappings against a SeqRegion.
@@ -1424,7 +1341,7 @@ module Ensembl
1424
1341
  # to a SeqRegion object and a Slice can be created for objects of this
1425
1342
  # class. See Sliceable and Slice for more information.
1426
1343
  #
1427
- # = USAGE
1344
+ # @example
1428
1345
  # unigene_scan = Analysis.find_by_logic_name('Unigene')
1429
1346
  # unigene_scan.dna_align_features.each do |hit|
1430
1347
  # puts hit.seq_region.name + "\t" + hit.hit_name + "\t" + hit.cigar_line
@@ -1441,7 +1358,6 @@ module Ensembl
1441
1358
  has_many :protein_supporting_features
1442
1359
  end
1443
1360
 
1444
- # = DESCRIPTION
1445
1361
  # The Translation class provides an interface to the
1446
1362
  # translation table. This table contains the translation start and
1447
1363
  # stop positions and exons for a given Transcript
@@ -1450,7 +1366,7 @@ module Ensembl
1450
1366
  # See the general documentation of the Ensembl module for
1451
1367
  # more information on what this means and what methods are available.
1452
1368
  #
1453
- # = USAGE
1369
+ # @example
1454
1370
  # #TODO
1455
1371
  class Translation < DBConnection
1456
1372
  set_primary_key 'translation_id'
@@ -1472,14 +1388,12 @@ module Ensembl
1472
1388
  alias attribs translation_attribs
1473
1389
 
1474
1390
  # The Translation#stable_id method returns the stable ID of the translation.
1475
- # ---
1476
- # *Arguments*:: none
1477
- # *Returns*:: String
1391
+ #
1392
+ # @return [String] Ensembl stable ID
1478
1393
  def stable_id
1479
1394
  return self.translation_stable_id.stable_id
1480
1395
  end
1481
1396
 
1482
- # = DESCRIPTION
1483
1397
  # The Translation#display_label method returns the default name of the translation.
1484
1398
  def display_label
1485
1399
  return Xref.find(self.display_xref_id).display_label
@@ -1488,7 +1402,6 @@ module Ensembl
1488
1402
  alias :label :display_label
1489
1403
  alias :name :display_label
1490
1404
 
1491
- # = DESCRIPTION
1492
1405
  # The Translation#find_by_stable_id class method fetches a Translation
1493
1406
  # object based on its stable ID (i.e. the "ENSP" accession number). If the
1494
1407
  # name is not found, it returns nil.
@@ -1502,7 +1415,6 @@ module Ensembl
1502
1415
  end
1503
1416
  end
1504
1417
 
1505
- # = DESCRIPTION
1506
1418
  # The TranslationStableId class provides an interface to the
1507
1419
  # translation_stable_id table. This table contains the Ensembl stable IDs
1508
1420
  # for a given Translation.
@@ -1511,7 +1423,7 @@ module Ensembl
1511
1423
  # See the general documentation of the Ensembl module for
1512
1424
  # more information on what this means and what methods are available.
1513
1425
  #
1514
- # = USAGE
1426
+ # @example
1515
1427
  # stable_id = TranslationStableId.find_by_name('ENSBTAP00000015494')
1516
1428
  # puts stable_id.to_yaml
1517
1429
  class TranslationStableId < DBConnection
@@ -1520,7 +1432,6 @@ module Ensembl
1520
1432
  belongs_to :translation
1521
1433
  end
1522
1434
 
1523
- # = DESCRIPTION
1524
1435
  # The TranslationAttrib class provides an interface to the
1525
1436
  # translation_attrib table. This table contains attribute values for the
1526
1437
  # Translation class.
@@ -1529,7 +1440,7 @@ module Ensembl
1529
1440
  # See the general documentation of the Ensembl module for
1530
1441
  # more information on what this means and what methods are available.
1531
1442
  #
1532
- # = USAGE
1443
+ # @example
1533
1444
  # translation = Translation.find(9979)
1534
1445
  # translation.translation_attribs.each do |attr|
1535
1446
  # puts attr.attr_type.name + "\t" + attr.value
@@ -1541,7 +1452,6 @@ module Ensembl
1541
1452
  belongs_to :attrib_type
1542
1453
  end
1543
1454
 
1544
- # = DESCRIPTION
1545
1455
  # The Xref class provides an interface to the
1546
1456
  # xref table. This table contains external references for objects in the
1547
1457
  # database.
@@ -1550,7 +1460,7 @@ module Ensembl
1550
1460
  # See the general documentation of the Ensembl module for
1551
1461
  # more information on what this means and what methods are available.
1552
1462
  #
1553
- # = USAGE
1463
+ # @example
1554
1464
  # gene = Gene.find(1)
1555
1465
  # gene.xrefs.each do |xref|
1556
1466
  # puts xref.display_label + "\t" + xref.description
@@ -1568,7 +1478,6 @@ module Ensembl
1568
1478
  end
1569
1479
  end
1570
1480
 
1571
- # = DESCRIPTION
1572
1481
  # The ObjectXref class provides the link between gene, transcript and
1573
1482
  # translation objects on the one hand and an xref on the other.
1574
1483
  #
@@ -1576,7 +1485,7 @@ module Ensembl
1576
1485
  # See the general documentation of the Ensembl module for
1577
1486
  # more information on what this means and what methods are available.
1578
1487
  #
1579
- # = USAGE
1488
+ # @example
1580
1489
  # gene = Gene.find(1)
1581
1490
  # gene.object_xrefs.each do |ox|
1582
1491
  # puts ox.to_yaml
@@ -1591,7 +1500,6 @@ module Ensembl
1591
1500
  has_one :go_xref
1592
1501
  end
1593
1502
 
1594
- # = DESCRIPTION
1595
1503
  # The GoXref class provides an interface to the
1596
1504
  # go_xref table. This table contains the evidence codes for those object_refs
1597
1505
  # that are GO terms.
@@ -1605,7 +1513,6 @@ module Ensembl
1605
1513
  belongs_to :xref
1606
1514
  end
1607
1515
 
1608
- # = DESCRIPTION
1609
1516
  # The ExternalDb class provides an interface to the
1610
1517
  # external_db table. This table contains references to databases to which
1611
1518
  # xrefs can point to
@@ -1614,7 +1521,7 @@ module Ensembl
1614
1521
  # See the general documentation of the Ensembl module for
1615
1522
  # more information on what this means and what methods are available.
1616
1523
  #
1617
- # = USAGE
1524
+ # @example
1618
1525
  # embl_db = ExternalDb.find_by_db_name('EMBL')
1619
1526
  # puts embl_db.xrefs.length.to_s
1620
1527
  class ExternalDb < DBConnection
@@ -1626,7 +1533,6 @@ module Ensembl
1626
1533
  nil
1627
1534
  end
1628
1535
 
1629
- # = DESCRIPTION
1630
1536
  # The ExternalDb#find_all_by_display_label method returns all external
1631
1537
  # databases that have this label. There should normally be no more than
1632
1538
  # one. If no databases are found with this name, this method returns an
@@ -1641,7 +1547,6 @@ module Ensembl
1641
1547
  return answer
1642
1548
  end
1643
1549
 
1644
- # = DESCRIPTION
1645
1550
  # The ExternalDb#find_by_display_label method returns a
1646
1551
  # database that has this label. If no databases are found with this name,
1647
1552
  # this method returns nil.
@@ -1658,7 +1563,6 @@ module Ensembl
1658
1563
 
1659
1564
  end
1660
1565
 
1661
- # = DESCRIPTION
1662
1566
  # The ExternalSynonym class provides an interface to the
1663
1567
  # external_synonym table. This table contains synonyms for Xref objects.
1664
1568
  #
@@ -1670,7 +1574,7 @@ module Ensembl
1670
1574
  # to a SeqRegion object and a Slice can be created for objects of this
1671
1575
  # class. See Sliceable and Slice for more information.
1672
1576
  #
1673
- # = USAGE
1577
+ # @example
1674
1578
  # xref = Xref.find(185185)
1675
1579
  # puts xref.external_synonyms[0].synonyms
1676
1580
  class ExternalSynonym < DBConnection
@@ -1679,7 +1583,6 @@ module Ensembl
1679
1583
  belongs_to :xref
1680
1584
  end
1681
1585
 
1682
- # = DESCRIPTION
1683
1586
  # The Karyotype class provides an interface to the
1684
1587
  # karyotype table. This table contains <>.
1685
1588
  #
@@ -1691,7 +1594,7 @@ module Ensembl
1691
1594
  # to a SeqRegion object and a Slice can be created for objects of this
1692
1595
  # class. See Sliceable and Slice for more information.
1693
1596
  #
1694
- # = USAGE
1597
+ # @example
1695
1598
  # band = Karyotype.find_by_band('p36.32')
1696
1599
  # puts band.to_yaml
1697
1600
  class Karyotype < DBConnection
@@ -1702,7 +1605,6 @@ module Ensembl
1702
1605
  belongs_to :seq_region
1703
1606
  end
1704
1607
 
1705
- # = DESCRIPTION
1706
1608
  # The OligoFeature class provides an interface to the
1707
1609
  # oligo_feature table. This table contains mappings of Oligo objects to
1708
1610
  # a SeqRegion.
@@ -1715,7 +1617,7 @@ module Ensembl
1715
1617
  # to a SeqRegion object and a Slice can be created for objects of this
1716
1618
  # class. See Sliceable and Slice for more information.
1717
1619
  #
1718
- # = USAGE
1620
+ # @example
1719
1621
  # seq_region = SeqRegion.find_by_name('4')
1720
1622
  # puts seq_region.oligo_features.length
1721
1623
  class OligoFeature < DBConnection
@@ -1728,7 +1630,6 @@ module Ensembl
1728
1630
  belongs_to :analysis
1729
1631
  end
1730
1632
 
1731
- # = DESCRIPTION
1732
1633
  # The OligoProbe class provides an interface to the
1733
1634
  # oligo_probe table.
1734
1635
  #
@@ -1736,7 +1637,7 @@ module Ensembl
1736
1637
  # See the general documentation of the Ensembl module for
1737
1638
  # more information on what this means and what methods are available.
1738
1639
  #
1739
- # = USAGE
1640
+ # @example
1740
1641
  # probe = OligoProbe.find_by_name('373:434;')
1741
1642
  # puts probe.probeset + "\t" + probe.oligo_array.name
1742
1643
  class OligoProbe < DBConnection
@@ -1746,7 +1647,6 @@ module Ensembl
1746
1647
  belongs_to :oligo_array
1747
1648
  end
1748
1649
 
1749
- # = DESCRIPTION
1750
1650
  # The OligoArray class provides an interface to the
1751
1651
  # oligo_array table. This table contains data describing a microarray
1752
1652
  # slide.
@@ -1755,7 +1655,7 @@ module Ensembl
1755
1655
  # See the general documentation of the Ensembl module for
1756
1656
  # more information on what this means and what methods are available.
1757
1657
  #
1758
- # = USAGE
1658
+ # @example
1759
1659
  # array = OligoArray.find_by_name_and_type('Bovine','AFFY')
1760
1660
  # puts array.oligo_probes.length
1761
1661
  class OligoArray < DBConnection
@@ -1764,7 +1664,6 @@ module Ensembl
1764
1664
  has_many :oligo_probes
1765
1665
  end
1766
1666
 
1767
- # = DESCRIPTION
1768
1667
  # The PredictionExon class provides an interface to the
1769
1668
  # prediction_exon table. This table contains <>.
1770
1669
  #
@@ -1776,7 +1675,7 @@ module Ensembl
1776
1675
  # to a SeqRegion object and a Slice can be created for objects of this
1777
1676
  # class. See Sliceable and Slice for more information.
1778
1677
  #
1779
- # = USAGE
1678
+ # @example
1780
1679
  # #TODO
1781
1680
  class PredictionExon < DBConnection
1782
1681
  include Sliceable
@@ -1787,7 +1686,6 @@ module Ensembl
1787
1686
  belongs_to :seq_region
1788
1687
  end
1789
1688
 
1790
- # = DESCRIPTION
1791
1689
  # The PredictionTranscript class provides an interface to the
1792
1690
  # prediction_transcript table.
1793
1691
  #
@@ -1799,7 +1697,7 @@ module Ensembl
1799
1697
  # to a SeqRegion object and a Slice can be created for objects of this
1800
1698
  # class. See Sliceable and Slice for more information.
1801
1699
  #
1802
- # = USAGE
1700
+ # @example
1803
1701
  # predicted_transcript = PredictionTranscript.find_by_display_label('GENSCAN00000000006')
1804
1702
  # puts predicted_transcript.prediction_exons.length
1805
1703
  class PredictionTranscript < DBConnection
@@ -1812,7 +1710,6 @@ module Ensembl
1812
1710
  belongs_to :analysis
1813
1711
  end
1814
1712
 
1815
- # = DESCRIPTION
1816
1713
  # The ProteinFeature class provides an interface to the
1817
1714
  # protein_feature table. This table contains mappings of a Translation
1818
1715
  # onto a SeqRegion.
@@ -1825,7 +1722,7 @@ module Ensembl
1825
1722
  # to a SeqRegion object and a Slice can be created for objects of this
1826
1723
  # class. See Sliceable and Slice for more information.
1827
1724
  #
1828
- # = USAGE
1725
+ # @example
1829
1726
  # #TODO
1830
1727
  class ProteinFeature < DBConnection
1831
1728
  include Sliceable
@@ -1836,7 +1733,6 @@ module Ensembl
1836
1733
  belongs_to :analysis
1837
1734
  end
1838
1735
 
1839
- # = DESCRIPTION
1840
1736
  # The ProteinAlignFeature class provides an interface to the
1841
1737
  # protein_align_feature table. This table contains sequence similarity
1842
1738
  # mappings against a SeqRegion.
@@ -1849,7 +1745,7 @@ module Ensembl
1849
1745
  # to a SeqRegion object and a Slice can be created for objects of this
1850
1746
  # class. See Sliceable and Slice for more information.
1851
1747
  #
1852
- # = USAGE
1748
+ # @example
1853
1749
  # uniprot_scan = Analysis.find_by_logic_name('Uniprot')
1854
1750
  # uniprot_scan.protein_align_features.each do |hit|
1855
1751
  # puts hit.seq_region.name + "\t" + hit.hit_name + "\t" + hit.cigar_line
@@ -1866,7 +1762,6 @@ module Ensembl
1866
1762
  has_many :transcript_supporting_features
1867
1763
  end
1868
1764
 
1869
- # = DESCRIPTION
1870
1765
  # The RegulatoryFactor class provides an interface to the
1871
1766
  # regulatory_factor table.
1872
1767
  #
@@ -1874,7 +1769,7 @@ module Ensembl
1874
1769
  # See the general documentation of the Ensembl module for
1875
1770
  # more information on what this means and what methods are available.
1876
1771
  #
1877
- # = USAGE
1772
+ # @example
1878
1773
  # factor = RegulatoryFactor.find_by_name('crtHsap8070')
1879
1774
  # puts factor.to_yaml
1880
1775
  class RegulatoryFactor < DBConnection
@@ -1883,7 +1778,6 @@ module Ensembl
1883
1778
  has_many :regulatory_features
1884
1779
  end
1885
1780
 
1886
- # = DESCRIPTION
1887
1781
  # The RegulatoryFeature class provides an interface to the
1888
1782
  # regulatory_feature table. This table contains mappings of
1889
1783
  # RegulatoryFactor objects against a SeqRegion.
@@ -1896,7 +1790,7 @@ module Ensembl
1896
1790
  # to a SeqRegion object and a Slice can be created for objects of this
1897
1791
  # class. See Sliceable and Slice for more information.
1898
1792
  #
1899
- # = USAGE
1793
+ # @example
1900
1794
  # analysis = Analysis.find_by_logic_name('miRanda')
1901
1795
  # analysis.regulatory_features.each do |feature|
1902
1796
  # puts feature.name + "\t" + feature.regulatory_factor.name