bio-ensembl 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.document +5 -0
  2. data/Gemfile +20 -0
  3. data/Gemfile.lock +40 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +19 -0
  6. data/Rakefile +71 -0
  7. data/VERSION +1 -0
  8. data/bin/ensembl +40 -0
  9. data/bin/variation_effect_predictor +106 -0
  10. data/bio-ensembl.gemspec +190 -0
  11. data/lib/bio-ensembl.rb +65 -0
  12. data/lib/bio-ensembl/core/activerecord.rb +1812 -0
  13. data/lib/bio-ensembl/core/collection.rb +64 -0
  14. data/lib/bio-ensembl/core/project.rb +262 -0
  15. data/lib/bio-ensembl/core/slice.rb +657 -0
  16. data/lib/bio-ensembl/core/transcript.rb +409 -0
  17. data/lib/bio-ensembl/core/transform.rb +95 -0
  18. data/lib/bio-ensembl/db_connection.rb +205 -0
  19. data/lib/bio-ensembl/variation/activerecord.rb +536 -0
  20. data/lib/bio-ensembl/variation/variation_feature.rb +376 -0
  21. data/lib/bio-ensembl/variation/variation_feature62.rb +444 -0
  22. data/samples/ensembl_genomes_example.rb +60 -0
  23. data/samples/examples_perl_tutorial.rb +125 -0
  24. data/samples/small_example_ruby_api.rb +34 -0
  25. data/samples/variation_effect_predictor_data.txt +4 -0
  26. data/samples/variation_example.rb +67 -0
  27. data/test/data/seq_c6qbl.fa +10 -0
  28. data/test/data/seq_cso19_coding.fa +16 -0
  29. data/test/data/seq_cso19_transcript.fa +28 -0
  30. data/test/data/seq_drd3_gene.fa +838 -0
  31. data/test/data/seq_drd3_transcript.fa +22 -0
  32. data/test/data/seq_drd4_transcript.fa +24 -0
  33. data/test/data/seq_forward_composite.fa +1669 -0
  34. data/test/data/seq_par_boundary.fa +169 -0
  35. data/test/data/seq_rnd3_transcript.fa +47 -0
  36. data/test/data/seq_ub2r1_coding.fa +13 -0
  37. data/test/data/seq_ub2r1_gene.fa +174 -0
  38. data/test/data/seq_ub2r1_transcript.fa +26 -0
  39. data/test/data/seq_y.fa +2 -0
  40. data/test/default/test_connection.rb +60 -0
  41. data/test/default/test_releases.rb +130 -0
  42. data/test/ensembl_genomes/test_collection.rb +122 -0
  43. data/test/ensembl_genomes/test_gene.rb +46 -0
  44. data/test/ensembl_genomes/test_slice.rb +65 -0
  45. data/test/ensembl_genomes/test_variation.rb +38 -0
  46. data/test/helper.rb +18 -0
  47. data/test/release_50/core/test_project.rb +210 -0
  48. data/test/release_50/core/test_project_human.rb +52 -0
  49. data/test/release_50/core/test_relationships.rb +72 -0
  50. data/test/release_50/core/test_sequence.rb +170 -0
  51. data/test/release_50/core/test_slice.rb +116 -0
  52. data/test/release_50/core/test_transcript.rb +125 -0
  53. data/test/release_50/core/test_transform.rb +217 -0
  54. data/test/release_50/variation/test_activerecord.rb +138 -0
  55. data/test/release_50/variation/test_variation.rb +79 -0
  56. data/test/release_53/core/test_gene.rb +61 -0
  57. data/test/release_53/core/test_project.rb +91 -0
  58. data/test/release_53/core/test_project_human.rb +61 -0
  59. data/test/release_53/core/test_slice.rb +42 -0
  60. data/test/release_53/core/test_transform.rb +57 -0
  61. data/test/release_53/variation/test_activerecord.rb +137 -0
  62. data/test/release_53/variation/test_variation.rb +66 -0
  63. data/test/release_56/core/test_gene.rb +61 -0
  64. data/test/release_56/core/test_project.rb +91 -0
  65. data/test/release_56/core/test_slice.rb +49 -0
  66. data/test/release_56/core/test_transform.rb +57 -0
  67. data/test/release_56/variation/test_activerecord.rb +141 -0
  68. data/test/release_56/variation/test_consequence.rb +131 -0
  69. data/test/release_56/variation/test_variation.rb +63 -0
  70. data/test/release_60/core/test_gene.rb +61 -0
  71. data/test/release_60/core/test_project_human.rb +34 -0
  72. data/test/release_60/core/test_slice.rb +42 -0
  73. data/test/release_60/core/test_transcript.rb +120 -0
  74. data/test/release_60/core/test_transform.rb +57 -0
  75. data/test/release_60/variation/test_activerecord.rb +216 -0
  76. data/test/release_60/variation/test_consequence.rb +153 -0
  77. data/test/release_60/variation/test_variation.rb +64 -0
  78. data/test/release_62/core/test_gene.rb +42 -0
  79. data/test/release_62/variation/test_activerecord.rb +86 -0
  80. data/test/release_62/variation/test_consequence.rb +191 -0
  81. metadata +287 -0
@@ -0,0 +1,217 @@
1
+ #
2
+ # = test/unit/test_transform.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 File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
10
+
11
+ include Ensembl::Core
12
+ DBConnection.connect('bos_taurus', 50)
13
+
14
+ # For all tests, the source (i.e. the seq_region that the feature is annotated
15
+ # on initially) remains forward.
16
+ #
17
+ # Same coordinate system: test names refer to direction of gene vs chromosome
18
+ class TransformOntoSameCoordinateSystem < Test::Unit::TestCase
19
+ # |-------|========>-------------------------> chromosome
20
+ # ^ ^
21
+ # | |
22
+ # |-------|========>-------------------------> chromosome
23
+ # This should return itself.
24
+ def test_fw
25
+ source_gene = Gene.find(6043)
26
+ target_gene = source_gene.transform('chromosome')
27
+
28
+ assert_equal('4', source_gene.seq_region.name)
29
+ assert_equal(4595538, source_gene.seq_region_start)
30
+ assert_equal(4827723, source_gene.seq_region_end)
31
+ assert_equal(1, source_gene.seq_region_strand)
32
+ assert_equal('4', target_gene.seq_region.name)
33
+ assert_equal(4595538, target_gene.seq_region_start)
34
+ assert_equal(4827723, target_gene.seq_region_end)
35
+ assert_equal(1, target_gene.seq_region_strand)
36
+ end
37
+
38
+ # |-------<========|-------------------------> chromosome
39
+ # ^ ^
40
+ # | |
41
+ # |-------<========|-------------------------> chromosome
42
+ # This should return itself.
43
+ def test_rev
44
+ source_gene = Gene.find(6053)
45
+ target_gene = source_gene.transform('chromosome')
46
+
47
+ assert_equal('4', source_gene.seq_region.name)
48
+ assert_equal(5199677, source_gene.seq_region_start)
49
+ assert_equal(5201728, source_gene.seq_region_end)
50
+ assert_equal(-1, source_gene.seq_region_strand)
51
+ assert_equal('4', target_gene.seq_region.name)
52
+ assert_equal(5199677, target_gene.seq_region_start)
53
+ assert_equal(5201728, target_gene.seq_region_end)
54
+ assert_equal(-1, target_gene.seq_region_strand)
55
+ end
56
+ end
57
+
58
+ ## Test names refer to:
59
+ ## (1) direction of gene vs chromosome
60
+ ## (2) direction of component (scaffold) vs assembly (chromosome)
61
+ #class TransformFromComponentToAssembly < Test::Unit::TestCase
62
+ # def test_fw_fw
63
+ # assert true
64
+ # end
65
+ #
66
+ # def test_fw_rev
67
+ # assert true
68
+ # end
69
+ #
70
+ # def test_rev_fw
71
+ # assert true
72
+ # end
73
+ #
74
+ # def test_rev_rev
75
+ # assert true
76
+ # end
77
+ #end
78
+ #
79
+ ## Test names refer to:
80
+ ## (1) direction of gene vs chromosome
81
+ ## (2) direction of component (scaffold) vs assembly (chromosome)
82
+ ## We have to test for features that are covered by a scaffold, and those
83
+ ## overlapping more than 1 scaffold.
84
+ #class TransformFromAssemblyToComponent < Test::Unit::TestCase
85
+ # # |-----------------> scaffold
86
+ # # ^ ^
87
+ # # | |
88
+ # # |---------|=====>-----------------------------> chromosome
89
+ # def test_fw_fw_full_overlap
90
+ # source_gene = Gene.find(2995)
91
+ # target_gene = source_gene.transform('scaffold')
92
+ #
93
+ # assert_equal('4', source_gene.seq_region.name)
94
+ # assert_equal(10333321, source_gene.seq_region_start)
95
+ # assert_equal(10510842, source_gene.seq_region_end)
96
+ # assert_equal(1, source_gene.seq_region_strand)
97
+ # assert_equal('Chr4.003.12', target_gene.seq_region.name)
98
+ # assert_equal(43842, target_gene.seq_region_start)
99
+ # assert_equal(221363, target_gene.seq_region_end)
100
+ # assert_equal(1, target_gene.seq_region_strand)
101
+ # end
102
+ #
103
+ # # |-----------------> scaffold
104
+ # # |
105
+ # # |
106
+ # # |---|===>-------------------------------> chromosome
107
+ # def test_fw_fw_partial_overlap
108
+ # source_feature = PredictionTranscript.find(52425)
109
+ # target_feature = source_feature.transform('scaffold')
110
+ #
111
+ # assert_equal('4', source_feature.seq_region.name)
112
+ # assert_equal(1443280, source_feature.seq_region_start)
113
+ # assert_equal(1482777, source_feature.seq_region_end)
114
+ # assert_equal(1, source_feature.seq_region_strand)
115
+ # assert_equal(nil, target_feature)
116
+ # end
117
+ #
118
+ # # <-----------------| scaffold
119
+ # # ^ ^
120
+ # # | |
121
+ # # |----------|=====>-----------------------------> chromosome
122
+ # def test_fw_rev_full_overlap
123
+ # source_gene = Gene.find(2708)
124
+ # target_gene = source_gene.transform('scaffold')
125
+ #
126
+ # assert_equal('4', source_gene.seq_region.name)
127
+ # assert_equal(8312492, source_gene.seq_region_start)
128
+ # assert_equal(8312812, source_gene.seq_region_end)
129
+ # assert_equal(1, source_gene.seq_region_strand)
130
+ # assert_equal('Chr4.003.10', target_gene.seq_region.name)
131
+ # assert_equal(1774466, target_gene.seq_region_start)
132
+ # assert_equal(1774786, target_gene.seq_region_end)
133
+ # assert_equal(-1, target_gene.seq_region_strand)
134
+ # end
135
+ #
136
+ # # <-----------------| scaffold
137
+ # # |
138
+ # # |
139
+ # # |---------------------|===>------------------> chromosome
140
+ # def test_fw_rev_partial_overlap
141
+ # source_feature = PredictionTranscript.find(23305)
142
+ # target_feature = source_feature.transform('scaffold')
143
+ #
144
+ # assert_equal('4', source_feature.seq_region.name)
145
+ # assert_equal(10008188, source_feature.seq_region_start)
146
+ # assert_equal(10156104, source_feature.seq_region_end)
147
+ # assert_equal(1, source_feature.seq_region_strand)
148
+ # assert_equal(nil, target_feature)
149
+ # end
150
+ #
151
+ # # |-----------------> scaffold
152
+ # # | ^ ^
153
+ # # | | |
154
+ # # |---<===|--<=====|-----------------------------> chromosome
155
+ # def test_rev_fw_full_overlap
156
+ # source_gene = Gene.find(3124)
157
+ # target_gene = source_gene.transform('scaffold')
158
+ #
159
+ # assert_equal('4', source_gene.seq_region.name)
160
+ # assert_equal(10353230, source_gene.seq_region_start)
161
+ # assert_equal(10371155, source_gene.seq_region_end)
162
+ # assert_equal(-1, source_gene.seq_region_strand)
163
+ # assert_equal('Chr4.003.12', target_gene.seq_region.name)
164
+ # assert_equal(63751, target_gene.seq_region_start)
165
+ # assert_equal(81676, target_gene.seq_region_end)
166
+ # assert_equal(-1, target_gene.seq_region_strand)
167
+ # end
168
+ #
169
+ # # |-----------------> scaffold
170
+ # # |
171
+ # # |
172
+ # # |---------------------<===|------------------> chromosome
173
+ # def test_rev_fw_partial_overlap
174
+ # source_feature = PredictionTranscript.find(24185)
175
+ # target_feature = source_feature.transform('scaffold')
176
+ #
177
+ # assert_equal('4', source_feature.seq_region.name)
178
+ # assert_equal(11389212, source_feature.seq_region_start)
179
+ # assert_equal(11471635, source_feature.seq_region_end)
180
+ # assert_equal(-1, source_feature.seq_region_strand)
181
+ # assert_equal(nil, target_feature)
182
+ # end
183
+ #
184
+ # # <-----------------| scaffold
185
+ # # | ^ ^
186
+ # # | | |
187
+ # # |---<===|--<=====|-----------------------------> chromosome
188
+ # def test_rev_rev_full_overlap
189
+ # source_gene = Gene.find(2408)
190
+ # target_gene = source_gene.transform('scaffold')
191
+ #
192
+ # assert_equal('4', source_gene.seq_region.name)
193
+ # assert_equal(8104409, source_gene.seq_region_start)
194
+ # assert_equal(8496477, source_gene.seq_region_end)
195
+ # assert_equal(-1, source_gene.seq_region_strand)
196
+ # assert_equal('Chr4.003.10', target_gene.seq_region.name)
197
+ # assert_equal(1590801, target_gene.seq_region_start)
198
+ # assert_equal(1982869, target_gene.seq_region_end)
199
+ # assert_equal(1, target_gene.seq_region_strand)
200
+ # end
201
+ #
202
+ # # <-----------------| scaffold
203
+ # # |
204
+ # # |
205
+ # # |---<===|-----------------------------> chromosome
206
+ # def test_rev_rev_partial_overlap
207
+ # source_feature = Transcript.find(14723)
208
+ # target_feature = source_feature.transform('scaffold')
209
+ #
210
+ # assert_equal('4', source_feature.seq_region.name)
211
+ # assert_equal(55713316, source_feature.seq_region_start)
212
+ # assert_equal(55792273, source_feature.seq_region_end)
213
+ # assert_equal(-1, source_feature.seq_region_strand)
214
+ # assert_equal(nil, target_feature)
215
+ # end
216
+ #
217
+ #end
@@ -0,0 +1,138 @@
1
+ #
2
+ # = test/unit/release_50/variation/test_activerecord.rb - Unit test for Ensembl::Variation
3
+ #
4
+ # Copyright:: Copyright (C) 2008 Francesco Strozzi <francesco.strozzi@gmail.com>
5
+ #
6
+ # License:: Ruby's
7
+ #
8
+ # $Id:
9
+ require File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
10
+
11
+ include Ensembl::Variation
12
+ DBConnection.connect('homo_sapiens',50)
13
+
14
+ class ActiveRecordVariation < Test::Unit::TestCase
15
+
16
+ def test_allele
17
+ allele = Allele.find(1)
18
+ assert_equal('T', allele.allele)
19
+ assert_equal(0.04, allele.frequency)
20
+ end
21
+
22
+ def test_allele_group
23
+ n = AlleleGroup.count(:all)
24
+ assert_equal(0, n)
25
+ end
26
+
27
+ def test_sample
28
+ n = Sample.count(:all)
29
+ assert_equal(12385,n)
30
+ individual = Sample.find(5499).individual
31
+ assert_equal('Male',individual.gender)
32
+ i = Sample.find(6201).individual_genotype_multiple_bp
33
+ assert_equal(1256,i.size)
34
+ assert_equal(548383,i[0].variation_id)
35
+ syn = Sample.find(17).sample_synonym
36
+ assert_equal('5',syn.name)
37
+ end
38
+
39
+ def test_individual
40
+ n = Individual.count(:all)
41
+ assert_equal(7769,n)
42
+ end
43
+
44
+ def test_individual_genotype_multiple_bp
45
+ n = IndividualGenotypeMultipleBp.count(:all)
46
+ assert_equal(835033,n)
47
+ end
48
+
49
+ def test_compressed_genotype_single_bp
50
+ n = CompressedGenotypeSingleBp.count(:all)
51
+ assert_equal(12473477,n)
52
+ end
53
+
54
+ def test_read_coverage
55
+ n = ReadCoverage.count(:all)
56
+ assert_equal(9328349,n)
57
+ end
58
+
59
+ def test_population
60
+ n = Population.count(:all)
61
+ assert_equal(4616,n)
62
+ end
63
+
64
+ def test_variation
65
+ n = Variation.count(:all)
66
+ assert_equal(13383219,n)
67
+
68
+ syn = Variation.find(27).variation_synonyms
69
+ assert_equal('SNP001745772',syn[0].name)
70
+
71
+ flanking = Variation.find(130).flanking_sequence
72
+ assert_equal(24910767,flanking.up_seq_region_start)
73
+ assert_equal(24911281,flanking.up_seq_region_end)
74
+ assert_equal(24911283,flanking.down_seq_region_start)
75
+ assert_equal(24911367,flanking.down_seq_region_end)
76
+ assert_equal(226030,flanking.seq_region_id)
77
+ assert_equal(1,flanking.seq_region_strand)
78
+
79
+ ag = Variation.find(130).allele_groups
80
+ assert_nil ag[0]
81
+
82
+ pg = Variation.find(1125).population_genotypes
83
+ assert_equal(26,pg.size)
84
+ assert_equal('A',pg[0].allele_1)
85
+ assert_equal('A',pg[0].allele_2)
86
+ assert_equal(0.2,pg[0].frequency)
87
+
88
+ a = Variation.find(115).alleles
89
+ assert_equal(8,a.size)
90
+ assert_equal('C',a[0].allele)
91
+ assert_equal(0.733,a[0].frequency)
92
+
93
+ vf = Variation.find(5345540).variation_features[0]
94
+ assert_equal('G/A',vf.allele_string)
95
+ assert_equal('rs8175337',vf.variation_name)
96
+ assert_equal(226028,vf.seq_region_id)
97
+ assert_equal(10052344,vf.seq_region_start)
98
+ assert_equal(10052344,vf.seq_region_end)
99
+ assert_equal(1,vf.seq_region_strand)
100
+
101
+ vg = Variation.find(1352735).variation_groups
102
+ assert_nil vg[0]
103
+
104
+ i = Variation.find(1352735).individual_genotype_multiple_bps
105
+ assert_equal(31,i.size)
106
+ end
107
+
108
+ def test_variation_feature
109
+ vf_sample = VariationFeature.find(4571).samples
110
+ assert_equal(5,vf_sample.size)
111
+ assert_equal('PERLEGEN:AFD_EUR_PANEL',vf_sample[0].name)
112
+ end
113
+
114
+ def test_variation_transcript
115
+ t = Variation.find_by_name('rs35303525').variation_features[0].transcript_variations
116
+ assert_equal(5,t.size)
117
+ assert_equal(69644,t[0].transcript_id)
118
+ transcript = t[0].transcript
119
+ assert_equal('protein_coding',transcript.biotype)
120
+ assert_equal(2050017,transcript.seq_region_start)
121
+ assert_equal(2148813,transcript.seq_region_end)
122
+ assert_equal('ENST00000382857',transcript.stable_id)
123
+ e = transcript.exons
124
+ assert_equal('ATGGCTGTGGGGAGCCAG',e[0].seq.upcase)
125
+ end
126
+
127
+ def test_source
128
+ syn = Source.find(1).sample_synonyms
129
+ assert_equal('2',syn[0].name)
130
+
131
+ ag = Source.find(1).allele_groups
132
+ assert_nil ag[0]
133
+
134
+ v = Source.find(6).variations
135
+ assert_equal(19,v.size)
136
+ assert_equal('SNP_A-8319323',v[0].name)
137
+ end
138
+ end
@@ -0,0 +1,79 @@
1
+ #
2
+ # = test/unit/release_50/variation/test_variation.tb - Unit test for Ensembl::Variation
3
+ #
4
+ # Copyright:: Copyright (C) 2008 Francesco Strozzi <francesco.strozzi@gmail.com>
5
+ #
6
+ # License:: Ruby's
7
+ #
8
+ require File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
9
+
10
+ include Ensembl::Variation
11
+
12
+ DBConnection.connect('homo_sapiens',50)
13
+
14
+ class TestVariation < Test::Unit::TestCase
15
+
16
+ def test_fetch_region
17
+ vf = Variation.find_by_name('rs2076175').variation_features[0]
18
+ slice = vf.fetch_region
19
+ assert_equal(29816349,slice.start)
20
+ assert_equal(29826349,slice.stop)
21
+ assert_equal('6',slice.seq_region.name)
22
+ slice = vf.fetch_region(30,30)
23
+ assert_equal(29821319,slice.start)
24
+ assert_equal(29821379,slice.stop)
25
+ assert_equal('CTCCCAGGACTGCTTCTGCCCACTGTCCCCGGGGCCCTGCCCTGCCTTTCTGCCTGTCACA',slice.seq.upcase)
26
+ end
27
+
28
+ def test_flanking_seq
29
+ vf = Variation.find_by_name('rs2076175').variation_features[0]
30
+ up,down = vf.flanking_seq
31
+ assert_equal(29820949,up.start)
32
+ assert_equal(29821348,up.stop)
33
+ assert_equal(29821350,down.start)
34
+ assert_equal(29821749,down.stop)
35
+ assert_equal('TCCTGATCTCACAAACCCTAATCTCCTGGAGGGAATGCAAGGCTGCCTGCCCCTACCCAGCAGTGACTTCTCCATTCCAGTCCAAGTGAGGAACTCGGACCAGGAAGGACCCCTCCCTGGCCCTCTTCCATCCCTCCCTGTGTGGGCTGAGCCCCGCTGAGCACCATTCCTCACCCCTACTCACAGCCAAATCCAGTGGGAAGAGACAGGTCCTGCTCTCTGCCCCCAACTCTCCTGGAAAAGGCCTCTCCCATTACTCTTGCCCACTGCCCACTCTCACCTCCTTTCTGGCCCTTGATATGAGCCAGGGTCCTCCTGAGCTCCTGCCCATTCTCTGTCAAGTCTTCAGTCTCTGTGTCCCAGGTCTCAGCTCCCAGGACTGCTTCTGCCCACTGTCCCC',
36
+ up.seq.upcase)
37
+ assert_equal('GGGCCCTGCCCTGCCTTTCTGCCTGTCACAGAGCAGGAAGAGCTGACCATCCAGATGTCCCTCAGCGAGAAACCCTGACTGCACAGATCCATCCTGGGACAGCACCGTGAGGTTGTAACAAAGACTGTGGGGCTCTGGGGAAGAGGAAATCACAGATGAAACTTCTTCCTGGAAGTAACTTCACATCAATGTTTAACACACAGGTCTGCTGTCCCGACCTTCCTGAGGAGGCAGGAAATGCACACGGGCAAAGGGACAAGAATGAGGATTTCAGACGCAAGGAAAACTGGGAAGGTGGGAGGATAGAGGAGGGGACTGAGGAACAGAAGAAGGGGGAATGGGGATGGCAAACTTGTAGGCCAGGTGCCAGGGCAGGGCAGCCACAGGCCCCCTCAGGATA',
38
+ down.seq.upcase)
39
+
40
+ end
41
+
42
+ def test_slice_variation
43
+ slice = Ensembl::Core::Slice.fetch_by_region('chromosome',1,50000,51000)
44
+ variations = slice.get_variation_features
45
+ assert_equal(9,variations.size)
46
+ assert_equal('ENSSNP4691381',variations[0].variation_name)
47
+ assert_equal('ENSSNP9996411',variations[1].variation_name)
48
+ assert_equal('rs2691281',variations[2].variation_name)
49
+ assert_equal('ENSSNP4068519',variations[3].variation_name)
50
+ assert_equal('ENSSNP230814',variations[4].variation_name)
51
+ assert_equal('ENSSNP4010737',variations[5].variation_name)
52
+ assert_equal('rs2531295',variations[6].variation_name)
53
+ assert_equal('ENSSNP5092147',variations[7].variation_name)
54
+ assert_equal('ENSSNP5346602',variations[8].variation_name)
55
+
56
+ genotyped = slice.get_genotyped_variation_features
57
+ assert_equal(7,genotyped.size)
58
+ assert_equal('ENSSNP4691381',genotyped[0].variation_name)
59
+ assert_equal('genotyped',genotyped[0].flags)
60
+ assert_equal('ENSSNP9996411',genotyped[1].variation_name)
61
+ assert_equal('genotyped',genotyped[1].flags)
62
+ assert_equal('ENSSNP4068519',genotyped[2].variation_name)
63
+ assert_equal('genotyped',genotyped[2].flags)
64
+ assert_equal('ENSSNP230814',genotyped[3].variation_name)
65
+ assert_equal('genotyped',genotyped[3].flags)
66
+ assert_equal('ENSSNP4010737',genotyped[4].variation_name)
67
+ assert_equal('genotyped',genotyped[4].flags)
68
+ assert_equal('ENSSNP5092147',genotyped[5].variation_name)
69
+ assert_equal('genotyped',genotyped[5].flags)
70
+ assert_equal('ENSSNP5346602',genotyped[6].variation_name)
71
+ assert_equal('genotyped',genotyped[6].flags)
72
+
73
+ v = variations[0].variation
74
+ assert_equal(16366812,v.variation_id)
75
+ end
76
+
77
+
78
+
79
+ end
@@ -0,0 +1,61 @@
1
+ #
2
+ # = test/unit/release_53/core/test_gene.rb - Unit test for Ensembl::Core
3
+ #
4
+ # Copyright:: Copyright (C) 2009 Francesco Strozzi <francesco.strozzi@gmail.com>
5
+ #
6
+ # License:: Ruby's
7
+ #
8
+ # $Id:
9
+
10
+ require File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
11
+
12
+ include Ensembl::Core
13
+
14
+ class TestGene < Test::Unit::TestCase
15
+
16
+ def setup
17
+ DBConnection.connect('homo_sapiens', 53)
18
+ end
19
+
20
+ def teardown
21
+ DBConnection.remove_connection
22
+ end
23
+
24
+ def test_gene
25
+ g = Gene.find_by_stable_id("ENSG00000006451")
26
+ assert_equal("ENSG00000006451",g.stable_id)
27
+ assert_equal("7",g.seq_region.name)
28
+ assert_equal(39629687,g.start)
29
+ assert_equal(39714240,g.stop)
30
+ assert_equal(1,g.strand)
31
+ assert_equal(84554,g.seq.length)
32
+ assert_equal("Ras-related protein Ral-A Precursor [Source:UniProtKB/Swiss-Prot;Acc:P11233]",g.description)
33
+ assert_equal("RALA",g.name)
34
+ end
35
+
36
+ def test_transcript
37
+ g = Gene.find_by_stable_id("ENSG00000006451")
38
+ t = g.transcripts
39
+ assert_equal(1,t.size)
40
+ assert_equal("ENST00000005257",t[0].stable_id)
41
+ t = t[0]
42
+ assert_equal(2792,t.seq.length)
43
+ end
44
+
45
+ def test_exons
46
+ t = Transcript.find_by_stable_id("ENST00000005257")
47
+ e = t.exons
48
+ assert_equal(5,e.size)
49
+ assert_equal("ENSE00001324495",e[0].stable_id)
50
+ seq1 = "AAGTGATCTGTGGCGGCTGCTGCAGAGCCGCCAGGAGGAGGGTGGATCTCCCCAGAGCAAAGCGTCGGAGTCCTCCTCCTCCTTCTCCTCCTCCTCCTCCTCCTCCTCCAGCCGCCCAGGCTCCCCCGCCACCCGTCAGACTCCTCCTTCGACCGCTCCCGGCGCGGGGCCTTCCAGGCGACAAGGACCGAGTACCCTCCGGCCGGAGCCACGCAGCCGCGGCTTCCGGAGCCCTCGGGGCGGCGGACTGGCTCGCGGTGCAG"
51
+ assert_equal(seq1,e[0].seq.upcase)
52
+ assert_equal(39629687,e[0].start)
53
+ assert_equal(39629949,e[0].stop)
54
+ assert_equal("ENSE00000832451",e[1].stable_id)
55
+ seq2 = "ATTCTTCTTAATCCTTTGGTGAAAACTGAGACACAAAATGGCTGCAAATAAGCCCAAGGGTCAGAATTCTTTGGCTTTACACAAAGTCATCATGGTGGGCAGTGGTGGCGTGGGCAAGTCAGCTCTGACTCTACAGTTCATGTACGATGAG"
56
+ assert_equal(seq2,e[1].seq.upcase)
57
+ assert_equal(39692755,e[1].start)
58
+ assert_equal(39692905,e[1].stop)
59
+ end
60
+
61
+ end