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
@@ -1,52 +0,0 @@
1
- #
2
- # = test/unit/release_53/ensembl_genomes/test_gene.rb - Unit test for Ensembl::Core
3
- #
4
- # Copyright:: Copyright (C) 2009
5
- # Francesco Strozzi <francesco.strozzi@gmail.com>
6
- # License:: Ruby's
7
- #
8
- # $Id:
9
-
10
- require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
12
- $:.unshift(libpath) unless $:.include?(libpath)
13
-
14
- require 'test/unit'
15
- require 'lib/ensembl'
16
-
17
- include Ensembl::Core
18
-
19
- class TestGene < Test::Unit::TestCase
20
-
21
- def setup
22
- DBConnection.ensemblgenomes_connect('pyrococcus_collection',3)
23
- end
24
-
25
- def teardown
26
- DBConnection.remove_connection
27
- end
28
-
29
- def test_find_gene
30
- g = Gene.find_by_stable_id("EBPYRG00000005609")
31
- assert_equal("EBPYRG00000005609",g.stable_id)
32
- assert_equal(1195302,g.start)
33
- assert_equal(1196675,g.stop)
34
- assert_equal("Chromosome",g.seq_region.name)
35
- assert_equal("ATGAATAGGAGCTTGTACTTGATTTTTATAATTGTAGGATATACTTTGGGAATATGGACA",g.seq.slice(0,60).upcase)
36
- end
37
-
38
- def test_find_transcript
39
- g = Gene.find_by_stable_id("EBPYRG00000005609")
40
- t = g.transcripts
41
- assert_equal("EBPYRT00000005610",t[0].stable_id)
42
- end
43
-
44
- def test_find_exons
45
- g = Gene.find_by_stable_id("EBPYRG00000005609")
46
- t = g.transcripts
47
- e = t[0].exons
48
- assert_equal("EBPYRE00000005617",e[0].stable_id)
49
- assert_equal("ATGAATAGGAGCTTGTACTTGATTTTTATAATTGTAGGATATACTTTGGGAATATGGACA",e[0].seq.slice(0,60).upcase)
50
- end
51
-
52
- end
@@ -1,71 +0,0 @@
1
- #
2
- # = test/unit/release_53/ensembl_genomes/test_collection.rb - Unit test for Ensembl::Core
3
- #
4
- # Copyright:: Copyright (C) 2009
5
- # Francesco Strozzi <francesco.strozzi@gmail.com>
6
- # License:: Ruby's
7
- #
8
- # $Id:
9
-
10
- require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
12
- $:.unshift(libpath) unless $:.include?(libpath)
13
-
14
- require 'test/unit'
15
- require 'lib/ensembl'
16
-
17
- include Ensembl::Core
18
-
19
- class TestSlice < Test::Unit::TestCase
20
-
21
- def teardown
22
- DBConnection.remove_connection
23
- end
24
-
25
- def test_fetch_by_region
26
- DBConnection.ensemblgenomes_connect('mycobacterium_collection',3)
27
- slice = Slice.fetch_by_region('chromosome',"Chromosome",183617,183716,1,"Mycobacterium tuberculosis H37Rv")
28
- assert_equal("GCGCCATGACAGATCCGCAGACGCAGAGCACCAGGGTCGGGGTGGTTGCCGAGTCGGGGCCCGACGAACGACGGGTCGCGCTGGTTCCCAAGGCGGTCGC",slice.seq.upcase)
29
-
30
- slice = Slice.fetch_by_region('chromosome',"Chromosome",4285422,4285521,1,"Mycobacterium paratuberculosis")
31
- assert_equal("GGTGTTAACGGCCGAAAGGTGGTTGAAAGATCGGCGGAATCGGGCGCACCCGGGTGGTCGTCGACGCCGCGCTGGTGGTGCTCGGCTGCGCCGTCGTGGT",slice.seq.upcase)
32
-
33
- slice = Slice.fetch_by_region('chromosome',"Chromosome",2667164,2667263,1,"Mycobacterium paratuberculosis")
34
- assert_equal("GTTCCACCTGCCGATCGTCTTCCTCGCCGATAACCCGGGCATGCTGCCCGGCAGCCGGTCCGAACGCAGCGGTGTGCTGCGCGCCGGCGCGCGGATGTTC",slice.seq.upcase)
35
- end
36
-
37
- def test_fetch_genes_from_slice
38
- DBConnection.ensemblgenomes_connect('mycobacterium_collection',3)
39
- slice = Slice.fetch_by_region('chromosome',"Chromosome",620900,622130 ,1,"Mycobacterium tuberculosis H37Rv")
40
- genes = slice.genes
41
- assert_equal("EBMYCG00000001929",genes[0].stable_id)
42
-
43
- slice = Slice.fetch_by_region('chromosome',"Chromosome",923890,925120 ,1,"Mycobacterium paratuberculosis")
44
- genes = slice.genes
45
- assert_equal("EBMYCG00000037956",genes[0].stable_id)
46
- end
47
-
48
- def test_new_db_and_reverse_slice
49
- DBConnection.ensemblgenomes_connect('escherichia_coli_K12',3)
50
- slice = Slice.fetch_by_region('chromosome',"Chromosome",831691,831790,-1)
51
- assert_equal("AAACGATGCTTACTGGGGAGACGGTGGTCATGGTAAGGGCAAGAATCGACTGGGCTACCTTTTAATGGAGTTGCGCGAACAATTGGCTATAGAGAAGTAA",slice.seq.upcase)
52
-
53
- slice = Slice.fetch_by_region('chromosome',"Chromosome",831690,832175,-1)
54
- genes = slice.genes
55
- assert_equal("EBESCG00000001341",genes[0].stable_id)
56
- end
57
-
58
- def test_fetch_all
59
- DBConnection.ensemblgenomes_connect('bacillus_anthracis_Sterne',3)
60
- slices = Slice.fetch_all('chromosome')
61
- assert_equal(5228663,slices[0].length)
62
- end
63
-
64
- def test_error_species
65
- DBConnection.ensemblgenomes_connect('bacillus_collection',3)
66
- assert_raise ArgumentError do
67
- Slice.fetch_by_region('chromosome',"Chromosome",831690,832175,1,"Wrong specie name")
68
- end
69
- end
70
-
71
- end
@@ -1,17 +0,0 @@
1
- #
2
- # = test/unit/release_53/ensembl_genomes/test_variation.rb - Unit test for Ensembl::Core
3
- #
4
- # Copyright:: Copyright (C) 2009
5
- # Francesco Strozzi <francesco.strozzi@gmail.com>
6
- # License:: Ruby's
7
- #
8
- # $Id:
9
-
10
- require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
12
- $:.unshift(libpath) unless $:.include?(libpath)
13
-
14
- require 'test/unit'
15
- require 'lib/ensembl'
16
-
17
- # TO BE DONE AS SOON AS ENSEMBL GENOMES VARIATIONS WILL BE RELEASED
@@ -1,215 +0,0 @@
1
- #
2
- # = test/unit/test_project.rb - Unit test for Ensembl::Core
3
- #
4
- # Copyright:: Copyright (C) 2007
5
- # Jan Aerts <http://jandot.myopenid.com>
6
- # License:: Ruby's
7
- #
8
- # $Id:
9
- require 'pathname'
10
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
11
- $:.unshift(libpath) unless $:.include?(libpath)
12
-
13
- require 'test/unit'
14
- require 'lib/ensembl'
15
-
16
- include Ensembl::Core
17
-
18
- DBConnection.connect('bos_taurus', 50)
19
-
20
- class CoordinateMappingsTestSimple < Test::Unit::TestCase
21
- # First see if the relationships work
22
- def test_assemblies
23
- # Contig AAFC03055291 should only be a component of chromosome 20
24
- contig_coord_system = CoordSystem.find_by_name('contig')
25
- aafc03055291 = SeqRegion.find_by_name_and_coord_system_id('AAFC03055291', contig_coord_system.id)
26
- assert_equal(1, aafc03055291.assembled_seq_regions.length)
27
-
28
- # Chromosome 20 has 2970 components
29
- chr_coord_system = CoordSystem.find_by_name('chromosome')
30
- chr20 = SeqRegion.find_by_name_and_coord_system_id('20', chr_coord_system.id)
31
- assert_equal(2970, chr20.component_seq_regions.length)
32
-
33
- # Chromosome 20 has 2970 contigs
34
- assert_equal(2970, chr20.component_seq_regions('contig').length)
35
-
36
- # Positions of the link between Chr20 and AAFC03055291
37
- # * Contig AAFC03055291 starts at position 13970982 on chromosome Chr20
38
- assert_equal(13970982, aafc03055291.assembly_links_as_component(chr_coord_system)[0].asm_start)
39
- end
40
- end
41
-
42
- class Sequences < Test::Unit::TestCase
43
- def setup
44
- @seq_region = SeqRegion.find(92594)
45
- end
46
-
47
- def test_simple
48
- assert_equal('AGCTATTTTATGACTT', @seq_region.seq.slice(4,16))
49
- end
50
-
51
- def test_subseq
52
- assert_equal('AGCTATTTTATGACTT', @seq_region.subseq(5,20))
53
- end
54
- end
55
-
56
- #class SliceProjectFromComponentToAssembly < Test::Unit::TestCase
57
- # # |------------------------------------------> chromosome
58
- # # ^ ^
59
- # # | |
60
- # # |-----------------> scaffold
61
- # def test_project_from_whole_component_to_assembly
62
- # source_slice = Slice.fetch_by_region('contig','AAFC03055291')
63
- # target_slices = source_slice.project('chromosome')
64
- #
65
- # # Start and stop of chr4_105 on Chr4
66
- # assert_equal(13970982, target_slices[0].start)
67
- # assert_equal(13982069, target_slices[0].stop)
68
- # end
69
- #
70
- # # |------------------------------------------> chromosome
71
- # # ^ ^
72
- # # | |
73
- # # |-----------------> scaffold
74
- # def test_project_from_component_to_assembly_with_positions
75
- # source_slice = Slice.fetch_by_region('scaffold','Chr4.003.105', 42, 2007)
76
- # target_slices = source_slice.project('chromosome')
77
- #
78
- # # Position 42 on chr4_105 is position 96652152, position 2007 is 96654117
79
- # assert_equal(96652152, target_slices[0].start)
80
- # assert_equal(96654117, target_slices[0].stop)
81
- # end
82
- #
83
- # # |------------------------------------------> scaffold
84
- # # ^ ^
85
- # # | |
86
- # # ----------------> contig
87
- # # /
88
- # # |--
89
- # def test_project_from_component_to_assembly_with_positions_and_cmp_start_not_1
90
- # source_slice = Slice.fetch_by_region('contig', 'AAFC03020247', 42, 2007)
91
- # target_slices = source_slice.project('scaffold')
92
- #
93
- # # Position 42 on AAFC03020247 is position 6570 on ChrUn.003.3522, position 2007 is 8565
94
- # assert_equal(6570, target_slices[0].start)
95
- # assert_equal(8535, target_slices[0].stop)
96
- # end
97
- #
98
- # # |------------------------------------------> scaffold
99
- # # ^ ^
100
- # # | |
101
- # # <-----------------| contig
102
- # def test_project_from_component_to_assembly_with_strand
103
- # source_slice_fw = Slice.fetch_by_region('contig', 'AAFC03020247')
104
- # target_slices_fw = source_slice_fw.project('scaffold')
105
- #
106
- # assert_equal(1, target_slices_fw[0].strand)
107
- #
108
- # source_slice_rev = Slice.fetch_by_region('contig', 'AAFC03061502')
109
- # target_slices_rev = source_slice_rev.project('scaffold')
110
- #
111
- # assert_equal(-1, target_slices_rev[0].strand)
112
- # end
113
- #end
114
-
115
- #class SliceProjectFromComponentToAssemblyUsingTopLevel < Test::Unit::TestCase
116
- # # |------------------------------------------> chromosome
117
- # # ^ ^
118
- # # | |
119
- # # |-----------------> scaffold
120
- # def test_project_from_whole_component_to_assembly
121
- # source_slice = Slice.fetch_by_region('scaffold','Chr4.003.105')
122
- # target_slices = source_slice.project('toplevel')
123
- #
124
- # # Start and stop of chr4_105 on Chr4
125
- # assert_equal(96652111, target_slices[0].start)
126
- # assert_equal(97251689, target_slices[0].stop)
127
- # end
128
- #
129
- # # |------------------------------------------> chromosome
130
- # # ^ ^
131
- # # | |
132
- # # |-----------------> scaffold
133
- # def test_project_from_component_to_assembly_with_positions
134
- # source_slice = Slice.fetch_by_region('scaffold','Chr4.003.105', 42, 2007)
135
- # target_slices = source_slice.project('toplevel')
136
- #
137
- # # Position 42 on chr4_105 is position 96652152, position 2007 is 96654117
138
- # assert_equal(96652152, target_slices[0].start)
139
- # assert_equal(96654117, target_slices[0].stop)
140
- # end
141
- #end
142
-
143
- class SliceProjectFromAssemblyToComponentForwardStrands < Test::Unit::TestCase
144
- def setup
145
- @source_slice_single_contig = Slice.fetch_by_region('chromosome', '20', 175000, 180000)
146
- @target_slices_single_contig = @source_slice_single_contig.project('contig')
147
-
148
- @source_slice_two_contigs = Slice.fetch_by_region('chromosome','20', 175000, 190000)
149
- @target_slices_two_contigs = @source_slice_two_contigs.project('contig')
150
-
151
- @source_slice_contigs_with_strand = Slice.fetch_by_region('chromosome', '20', 160000, 190000)
152
- @target_slices_contigs_with_strand = @source_slice_contigs_with_strand.project('contig')
153
-
154
- @source_slice_contigs_with_strand_ends_in_gaps = Slice.fetch_by_region('chromosome', '20', 170950, 196000)
155
- @target_slices_contigs_with_strand_ends_in_gaps = @source_slice_contigs_with_strand_ends_in_gaps.project('contig')
156
- end
157
-
158
- # |-----------------> contig
159
- # ^ ^
160
- # | |
161
- # |------------------------------------------> chromosome
162
- def test_project_from_assembly_to_single_component
163
- # Position 175000 on chr20 is position 4030 on contig, position 180000 is 9030
164
- assert_equal('AAFC03028970', @target_slices_single_contig[0].seq_region.name)
165
- assert_equal(4030, @target_slices_single_contig[0].start)
166
- assert_equal(9030, @target_slices_single_contig[0].stop)
167
- end
168
-
169
- # |-----> |--------> contig
170
- # ^ ^
171
- # | |
172
- # |------------------------------------------> chromosome
173
- def test_project_from_assembly_to_two_components
174
- # This chromosomal region is covered by contigs AAFC03028970, a gap and AAFC03028962
175
- # * Position 175000 on chr 20 is position 4030 on contig AAFC03028970
176
- # * Position 190000 on chr 20 is position 35 on contig AAFC03028962
177
- assert_equal(3, @target_slices_two_contigs.length)
178
- assert_equal('contig:Btau_4.0:AAFC03028970:4030:17365:1', @target_slices_two_contigs[0].display_name)
179
- assert_equal(Gap, @target_slices_two_contigs[1].class)
180
- assert_equal('contig:Btau_4.0:AAFC03028962:1:35:1', @target_slices_two_contigs[2].display_name)
181
- end
182
-
183
- # |-----> <-------| |-------> |-------> contig
184
- # ^ ^
185
- # | |
186
- # |--------------------------------------------------> chromosome
187
- def test_project_from_assembly_to_contigs_with_strand
188
- # This chromosomal region is covered by 4 contigs and 3 gaps
189
- # One of the contigs are on the reverse strand.
190
- assert_equal(7, @target_slices_contigs_with_strand.length)
191
- assert_equal('contig:Btau_4.0:AAFC03028964:90:9214:1', @target_slices_contigs_with_strand[0].display_name)
192
- assert_equal(Gap, @target_slices_contigs_with_strand[1].class)
193
- assert_equal('contig:Btau_4.0:AAFC03028959:1:1746:-1', @target_slices_contigs_with_strand[2].display_name)
194
- assert_equal(Gap, @target_slices_contigs_with_strand[3].class)
195
- assert_equal('contig:Btau_4.0:AAFC03028970:1:17365:1', @target_slices_contigs_with_strand[4].display_name)
196
- assert_equal(Gap, @target_slices_contigs_with_strand[5].class)
197
- assert_equal('contig:Btau_4.0:AAFC03028962:1:35:1', @target_slices_contigs_with_strand[6].display_name)
198
- end
199
-
200
- # <--| |-----> contig
201
- # ^ ^
202
- # | |
203
- # |--------------------------------------------------> chromosome
204
- def test_project_from_assembly_to_contigs_with_strand_and_ending_in_gaps
205
- # This chromosomal region is covered by 2 contigs and 2 gaps at the end: GaCoGaCoGa
206
- assert_equal(5, @target_slices_contigs_with_strand_ends_in_gaps.length)
207
- assert_equal(Gap, @target_slices_contigs_with_strand_ends_in_gaps[0].class)
208
- assert_equal('contig:Btau_4.0:AAFC03028970:1:17365:1', @target_slices_contigs_with_strand_ends_in_gaps[1].display_name)
209
- assert_equal(Gap, @target_slices_contigs_with_strand_ends_in_gaps[2].class)
210
- assert_equal('contig:Btau_4.0:AAFC03028962:1:5704:1', @target_slices_contigs_with_strand_ends_in_gaps[3].display_name)
211
- assert_equal(Gap, @target_slices_contigs_with_strand_ends_in_gaps[4].class)
212
- end
213
-
214
-
215
- end
@@ -1,58 +0,0 @@
1
- #
2
- # = test/unit/test_project.rb - Unit test for Ensembl::Core
3
- #
4
- # Copyright:: Copyright (C) 2007
5
- # Jan Aerts <http://jandot.myopenid.com>
6
- # License:: Ruby's
7
- #
8
- # $Id:
9
- require 'pathname'
10
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
11
- $:.unshift(libpath) unless $:.include?(libpath)
12
-
13
- require 'test/unit'
14
- require 'lib/ensembl'
15
-
16
- include Ensembl::Core
17
-
18
- DBConnection.connect('homo_sapiens', 50)
19
-
20
- class AssemblyExceptions < Test::Unit::TestCase
21
- def test_chr_x
22
- source_slice = Slice.fetch_by_region('chromosome','X', 2709497, 2709520)
23
- assert_equal('tagttatagattaaaagaagttaa', source_slice.seq)
24
- end
25
-
26
- def test_slice_overlapping_PAR_and_allosome
27
- source_slice = Slice.fetch_by_region('chromosome','Y',2709500,2709540)
28
- target_slices = source_slice.project('contig')
29
- assert_equal('contig::AC006209.25.1.141759:23323:23343:-1', target_slices[0].display_name)
30
- assert_equal('contig::AC006040.3.1.186504:57272:57291:1', target_slices[1].display_name)
31
- end
32
-
33
- def test_seq_slice_overlapping_PAR
34
- seq = ''
35
- File.open('test/unit/data/seq_y.fa').reject{|l| l=~/^>/}.each do |line|
36
- line.chomp!
37
- seq += line
38
- end
39
- seq.downcase!
40
-
41
- source_slice = Slice.fetch_by_region('chromosome', 'Y', 2709497, 2709542)
42
- assert_equal(seq.downcase, source_slice.seq)
43
- end
44
-
45
- # The MHC haplotypes for human are not implemented yet, so we raise an error
46
- # in the code.
47
- def test_seq_slice_overlapping_HAP
48
- seq = ''
49
- File.open('test/unit/data/seq_c6qbl.fa').reject{|l| l=~/^>/}.each do |line|
50
- line.chomp!
51
- seq += line
52
- end
53
- seq.downcase!
54
-
55
- source_slice = Slice.fetch_by_region('chromosome', 'c6_QBL', 33451191, 33451690)
56
- assert_raise(NotImplementedError) {source_slice.seq}
57
- end
58
- end
@@ -1,66 +0,0 @@
1
- #
2
- # = test/unit/test_transfers.rb - Unit test for Ensembl::Core
3
- #
4
- # Copyright:: Copyright (C) 2007
5
- # Jan Aerts <http://jandot.myopenid.com>
6
- # License:: Ruby's
7
- #
8
- # $Id:
9
- require 'pathname'
10
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
11
- $:.unshift(libpath) unless $:.include?(libpath)
12
-
13
- require 'test/unit'
14
-
15
- require 'lib/ensembl'
16
-
17
- include Ensembl::Core
18
-
19
- DBConnection.connect('homo_sapiens', 50)
20
-
21
- # Let's see if we can 'find' things
22
- class SimpleRecordsTest < Test::Unit::TestCase
23
- def setup
24
- @sry_gene = Gene.find(34927)
25
- @sry_transcript = Transcript.find(60290)
26
- end
27
-
28
- def test_coord_system
29
- coord_system = CoordSystem.find(17)
30
- assert_equal('chromosome', coord_system.name)
31
- end
32
-
33
- def test_coord_system_toplevel
34
- coord_system = CoordSystem.find(17).find_toplevel
35
- assert_equal('chromosome', coord_system.name)
36
- end
37
-
38
- def test_coord_system_seqlevel
39
- coord_system = CoordSystem.find(17).find_seqlevel
40
- assert_equal('contig', coord_system.name)
41
- end
42
-
43
- def test_display_label
44
- assert_equal('SRY', @sry_gene.display_label)
45
- assert_equal('SRY', @sry_gene.display_name)
46
- assert_equal('SRY', @sry_gene.label)
47
- assert_equal('SRY', @sry_gene.name)
48
-
49
- assert_equal('SRY-001', @sry_transcript.display_label)
50
- assert_equal('SRY-001', @sry_transcript.display_name)
51
- assert_equal('SRY-001', @sry_transcript.label)
52
- assert_equal('SRY-001', @sry_transcript.name)
53
- end
54
- end
55
-
56
- class RelationshipsTest < Test::Unit::TestCase
57
- def test_go_terms
58
- gene = Gene.find(34928)
59
- assert_equal(["GO:0005576", "GO:0042742"], gene.go_terms.sort)
60
- end
61
-
62
- def test_hgnc
63
- gene = Gene.find_by_stable_id('ENSG00000169740')
64
- assert_equal('ZNF32', gene.hgnc)
65
- end
66
- end