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
@@ -26,38 +26,38 @@ include Ensembl::Core
26
26
  class TransformOntoSameCoordinateSystem < Test::Unit::TestCase
27
27
 
28
28
  def setup
29
- DBConnection.connect('homo_sapiens', 53)
29
+ DBConnection.connect('homo_sapiens', 60)
30
30
  end
31
31
 
32
32
  def teardown
33
33
  DBConnection.remove_connection
34
34
  end
35
35
 
36
- def test_rev
37
- source_gene = Gene.find(102634)
36
+ def test_fw
37
+ source_gene = Gene.find_by_stable_id("ENSG00000242450")
38
38
  target_gene = source_gene.transform('chromosome')
39
39
 
40
- assert_equal('18', source_gene.seq_region.name)
41
- assert_equal(17659657, source_gene.seq_region_start)
42
- assert_equal(17659744, source_gene.seq_region_end)
43
- assert_equal(-1, source_gene.seq_region_strand)
44
- assert_equal('18', target_gene.seq_region.name)
45
- assert_equal(17659657, target_gene.seq_region_start)
46
- assert_equal(17659744, target_gene.seq_region_end)
47
- assert_equal(-1, target_gene.seq_region_strand)
40
+ assert_equal('22', source_gene.seq_region.name)
41
+ assert_equal(24349643, source_gene.seq_region_start)
42
+ assert_equal(24349710, source_gene.seq_region_end)
43
+ assert_equal(1, source_gene.seq_region_strand)
44
+ assert_equal('22', target_gene.seq_region.name)
45
+ assert_equal(24349643, target_gene.seq_region_start)
46
+ assert_equal(24349710, target_gene.seq_region_end)
47
+ assert_equal(1, target_gene.seq_region_strand)
48
48
  end
49
49
 
50
- def test_fw
51
- source_gene = Gene.find(103817)
50
+ def test_rev
51
+ source_gene = Gene.find_by_stable_id("ENSG00000240339")
52
52
  target_gene = source_gene.transform('chromosome')
53
- assert_equal('11', source_gene.seq_region.name)
54
- assert_equal(66886461, source_gene.seq_region_start)
55
- assert_equal(66886755, source_gene.seq_region_end)
56
- assert_equal(1, source_gene.seq_region_strand)
57
- assert_equal('11', target_gene.seq_region.name)
58
- assert_equal(66886461, target_gene.seq_region_start)
59
- assert_equal(66886755, target_gene.seq_region_end)
60
- assert_equal(1, target_gene.seq_region_strand)
53
+ assert_equal('22', source_gene.seq_region.name)
54
+ assert_equal(24349560, source_gene.seq_region_start)
55
+ assert_equal(24349631, source_gene.seq_region_end)
56
+ assert_equal(-1, source_gene.seq_region_strand)
57
+ assert_equal('22', target_gene.seq_region.name)
58
+ assert_equal(24349560, target_gene.seq_region_start)
59
+ assert_equal(24349631, target_gene.seq_region_end)
60
+ assert_equal(-1, target_gene.seq_region_strand)
61
61
  end
62
62
 
63
63
  end
@@ -0,0 +1,213 @@
1
+ #
2
+ # = test/unit/release_56/variation/test_activerecord.rb - Unit test for Ensembl::Variation
3
+ #
4
+ # Copyright:: Copyright (C) 2009
5
+ # Francesco Strozzi <francesco.strozzi@gmail.com>
6
+ #
7
+ # License:: Ruby's
8
+ #
9
+ # $Id:
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::Variation
18
+
19
+ class ActiveRecordVariation < Test::Unit::TestCase
20
+
21
+ def setup
22
+ DBConnection.connect('homo_sapiens',60)
23
+ end
24
+
25
+ def teardown
26
+ DBConnection.remove_connection
27
+ end
28
+
29
+ def test_allele
30
+ allele = Allele.find(1)
31
+ assert_equal('T', allele.allele)
32
+ assert_equal(0.04, allele.frequency)
33
+ end
34
+
35
+ def test_sample
36
+ n = Sample.count(:all)
37
+ assert_equal(30351,n)
38
+ individual = Sample.find(12468).individual
39
+ assert_equal('Male',individual.gender)
40
+ i = Sample.find(13131).individual_genotype_multiple_bp
41
+ assert_equal(5,i.size)
42
+ assert_equal(1688213,i[0].variation_id)
43
+ syn = Sample.find(21).sample_synonym
44
+ assert_equal('6',syn.name)
45
+ end
46
+
47
+ def test_individual
48
+ n = Individual.count(:all)
49
+ assert_equal(12307,n)
50
+ end
51
+
52
+ def test_individual_genotype_multiple_bp
53
+ n = IndividualGenotypeMultipleBp.count(:all)
54
+ assert_equal(1009778,n)
55
+ end
56
+
57
+ def test_compressed_genotype_single_bp
58
+ n = CompressedGenotypeSingleBp.count(:all)
59
+ assert_equal(67856517,n)
60
+ end
61
+
62
+ def test_read_coverage
63
+ n = ReadCoverage.count(:all)
64
+ assert_equal(4183832,n)
65
+ end
66
+
67
+ def test_population
68
+ n = Population.count(:all)
69
+ assert_equal(11673,n)
70
+ p = Population.find(236)
71
+ ind = p.individuals
72
+ assert_equal(653,ind.size)
73
+ end
74
+
75
+ def test_variation
76
+ n = Variation.count(:all)
77
+ assert_equal(24623913,n)
78
+
79
+ syn = Variation.find(712422).variation_synonyms
80
+ assert_equal(1,syn.size)
81
+ assert_equal('rs56673311',syn[0].name)
82
+
83
+ flanking = Variation.find(10000).flanking_sequence
84
+ assert_equal(132077099,flanking.up_seq_region_start)
85
+ assert_equal(132077128,flanking.up_seq_region_end)
86
+ assert_equal(132077130,flanking.down_seq_region_start)
87
+ assert_equal(132077159,flanking.down_seq_region_end)
88
+ assert_equal(27517,flanking.seq_region_id)
89
+ assert_equal(1,flanking.seq_region_strand)
90
+
91
+ ag = Variation.find(10000).allele_groups
92
+ assert_nil ag[0]
93
+
94
+ pg = Variation.find(1234).population_genotypes
95
+ assert_equal(28,pg.size)
96
+ assert_equal('A',pg[0].allele_1)
97
+ assert_equal('A',pg[0].allele_2)
98
+ assert_equal(1,pg[0].frequency)
99
+
100
+ a = Variation.find(115).alleles
101
+ assert_equal(14,a.size)
102
+ assert_equal('C',a[0].allele)
103
+ assert_equal(0.733,a[0].frequency)
104
+
105
+ vf = Variation.find(5345540).variation_features[0]
106
+ assert_equal('C/T',vf.allele_string)
107
+ assert_equal('rs8192830',vf.variation_name)
108
+ assert_equal(27506,vf.seq_region_id)
109
+ assert_equal(139618573,vf.seq_region_start)
110
+ assert_equal(139618573,vf.seq_region_end)
111
+ assert_equal(1,vf.seq_region_strand)
112
+
113
+ vg = Variation.find(1352735).variation_groups
114
+ assert_nil vg[0]
115
+
116
+ i = Variation.find(243).individual_genotype_multiple_bps
117
+ assert_equal(68,i.size)
118
+ end
119
+
120
+ def test_variation_feature
121
+ vf_sample = VariationFeature.find_by_variation_name('rs167125').samples
122
+ assert_equal(1,vf_sample.size)
123
+ assert_equal('CSHL-HAPMAP:HapMap-JPT',vf_sample[0].name)
124
+ end
125
+
126
+ def test_variation_transcript
127
+ t = Variation.find_by_name('rs7671997').variation_features[0].transcript_variations
128
+ assert_equal(7,t.size)
129
+ assert_equal('WITHIN_NON_CODING_GENE',t[0].consequence_type)
130
+ assert_equal('5PRIME_UTR',t[2].consequence_type)
131
+ assert_equal(4079207,t[0].variation_feature_id)
132
+ transcript = t[0].transcript
133
+ assert_equal('processed_transcript',transcript.biotype)
134
+ assert_equal(2158121,transcript.seq_region_start)
135
+ assert_equal(2243848,transcript.seq_region_end)
136
+ assert_equal('ENST00000515357',transcript.stable_id)
137
+ e = transcript.exons
138
+ assert_equal('AGTGCGAGGCGCGCGGGGCACGGAGGGCGGTGGCGGCGGGCTCCTGCGAGAAGCAAGCGGAACTTCCTGAG',e[0].seq.upcase)
139
+
140
+ end
141
+
142
+ def test_source
143
+ syn = Source.find(1).sample_synonyms
144
+ assert_equal(23061,syn.size)
145
+
146
+ ag = Source.find(1).allele_groups
147
+ assert_nil ag[0]
148
+ end
149
+
150
+ def test_variation_annotation
151
+ va = VariationAnnotation.find(95)
152
+ assert_equal(1756227,va.variation_id)
153
+ assert_equal('EGAS00000000060',va.local_stable_id)
154
+ assert_equal('rs2306027',va.variation_names)
155
+ assert_equal(0.218132812399633,va.risk_allele_freq_in_controls.to_f)
156
+ end
157
+
158
+ def test_phenotype
159
+ pheno = Phenotype.find(1527)
160
+ va = pheno.variation_annotations
161
+ assert_equal(14,va.size)
162
+ assert_equal('GATA6,CTAGE1,RBBP8,CABLES1',va[5].associated_gene)
163
+ end
164
+
165
+ def test_structural_variation
166
+ sv = StructuralVariation.find(171276)
167
+ assert_equal('nsv429550',sv.variation_name)
168
+ assert_equal(224676,sv.seq_region_start)
169
+ assert_equal(44780026,sv.seq_region_end)
170
+ assert_equal('11',sv.seq_region.name)
171
+ end
172
+
173
+ def test_population_genotype
174
+ v = Variation.find(1082)
175
+ pg = v.population_genotypes
176
+ assert_equal(41,pg.size)
177
+ assert_equal(0.6,pg[0].frequency)
178
+ pop = Population.find(132)
179
+ pg = pop.population_genotypes
180
+ assert_equal(1070,pg.size)
181
+ end
182
+
183
+ def test_subsnp_handle
184
+ s = SubsnpHandle.find(946)
185
+ assert_equal('WIAF',s.handle)
186
+ pg = s.population_genotypes
187
+ assert_equal(2,pg.size)
188
+ assert_equal(0.4,pg[0].frequency)
189
+ alleles = s.alleles
190
+ assert_equal(2,alleles.size)
191
+ assert_equal('A',alleles[0].allele)
192
+ s = SubsnpHandle.find(107935890)
193
+ vs = s.variation_synonyms
194
+ assert_equal(1,vs.size)
195
+ assert_equal('ENSSNP10154320',vs[0].name)
196
+ end
197
+
198
+ def test_variation_synonym
199
+ v = Variation.find(12659557)
200
+ vs = v.variation_synonyms
201
+ assert_equal(1,vs.size)
202
+ assert_equal('rs66792216',vs[0].name)
203
+ end
204
+
205
+ def test_failed_description
206
+ v = Variation.find(15005920)
207
+ fd = v.failed_descriptions
208
+ assert_equal(1,fd.size)
209
+ assert_equal('Variation maps to more than 3 different locations',fd[0].description)
210
+ end
211
+
212
+
213
+ end
@@ -0,0 +1,158 @@
1
+ #
2
+ # = test/unit/release_56/variation/test_variation.tb - Unit test for Ensembl::Variation
3
+ #
4
+ # Copyright:: Copyright (C) 2009
5
+ # Francesco Strozzi <francesco.strozzi@gmail.com>
6
+ # License:: Ruby's
7
+ #
8
+ require 'pathname'
9
+ libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
10
+ $:.unshift(libpath) unless $:.include?(libpath)
11
+
12
+ require 'test/unit'
13
+ require 'lib/ensembl'
14
+
15
+ include Ensembl::Variation
16
+ DBConnection.connect('homo_sapiens',60)
17
+
18
+ class TestVariation < Test::Unit::TestCase
19
+
20
+ def test_intergenic
21
+ # INTERGENIC
22
+ vf = VariationFeature.new(:seq_region_id => SeqRegion.find_by_name("X").seq_region_id, :seq_region_start => 23694, :seq_region_end => 23694, :seq_region_strand => 1, :allele_string => "A/T",:variation_name => "fake_SNP")
23
+ tv = vf.transcript_variations
24
+ assert_instance_of(TranscriptVariation,tv[0])
25
+ assert_equal("INTERGENIC",tv[0].consequence_type)
26
+ end
27
+
28
+ def test_3prime
29
+ # 3PRIME_UTR
30
+ vf = VariationFeature.new(:seq_region_id => 27506, :seq_region_start => 96810688, :seq_region_end => 96810688, :seq_region_strand => 1, :allele_string => "G/C", :variation_name => "rs16869283")
31
+ tv = vf.transcript_variations
32
+ assert_equal("3PRIME_UTR", tv[0].consequence_type)
33
+ end
34
+
35
+ def test_5prime
36
+ # 5PRIME_UTR
37
+ vf = VariationFeature.new(:seq_region_id => 27506, :seq_region_start => 158536411, :seq_region_end => 158536411, :seq_region_strand => 1, :allele_string => "T/C", :variation_name => "rs71547565")
38
+ tv = vf.transcript_variations
39
+ assert_equal("5PRIME_UTR", tv[3].consequence_type)
40
+ end
41
+
42
+ def test_upstream
43
+ # UPSTREAM
44
+ vf = VariationFeature.new(:seq_region_id => 27506, :seq_region_start => 96831018, :seq_region_end => 96831018, :seq_region_strand => 1, :allele_string => "G/T", :variation_name => "rs6975185")
45
+ tv = vf.transcript_variations
46
+ assert_equal("UPSTREAM",tv[0].consequence_type)
47
+ end
48
+
49
+ def test_downstream
50
+ # DOWNSTREAM
51
+ vf = VariationFeature.new(:seq_region_id => 27506, :seq_region_start => 105727321, :seq_region_end => 105727321, :seq_region_strand => 1, :allele_string => "G/T", :variation_name => "rs35113830")
52
+ tv = vf.transcript_variations
53
+ assert_equal("DOWNSTREAM",tv[-1].consequence_type)
54
+ end
55
+
56
+ def test_mirna
57
+ # WITHIN_MATURE_miRNA
58
+ vf = VariationFeature.new(:seq_region_id => 27527, :seq_region_start => 175878848, :seq_region_end => 175878848, :seq_region_strand => 1, :allele_string => "C/T", :variation_name => "rs12716316")
59
+ tv = vf.transcript_variations
60
+ assert_equal("WITHIN_MATURE_miRNA",tv[-1].consequence_type)
61
+ end
62
+
63
+
64
+ def test_non_coding
65
+ # WITHIN_NON_CODING_GENE
66
+ vf = VariationFeature.new(:seq_region_id => 27506, :seq_region_start => 97601052, :seq_region_end => 97601052, :seq_region_strand => 1, :allele_string => "G/A", :variation_name => "rs13245475")
67
+ tv = vf.transcript_variations
68
+ assert_equal("WITHIN_NON_CODING_GENE",tv[1].consequence_type)
69
+ end
70
+
71
+ def test_complex_indel
72
+ # COMPLEX_INDEL
73
+ vf = VariationFeature.new(:seq_region_id => 27515, :seq_region_start => 31902068, :seq_region_end => 31902095, :seq_region_strand => 1, :allele_string => "GTGGACAGGGTCAGGAATCAGGAGTCTG/-", :variation_name => "rs9332736")
74
+ tv = vf.transcript_variations
75
+ assert_equal("COMPLEX_INDEL",tv[6].consequence_type)
76
+ end
77
+
78
+ def test_essential_splice
79
+ # ESSENTIAL_SPLICE_SITE
80
+ vf = VariationFeature.new(:seq_region_id => 27515, :seq_region_start => 33385862, :seq_region_end => 33385862, :seq_region_strand => 1, :allele_string => "A/G", :variation_name => "GA005718")
81
+ tv = vf.transcript_variations
82
+ assert_equal("ESSENTIAL_SPLICE_SITE",tv[21].consequence_type)
83
+ end
84
+
85
+ def test_splice_site
86
+ # SPLICE_SITE
87
+ vf = VariationFeature.new(:seq_region_id => 27506, :seq_region_start => 102301587, :seq_region_end => 102301587, :seq_region_strand => 1, :allele_string => "A/G", :variation_name => "rs434833")
88
+ tv = vf.transcript_variations
89
+ assert_equal("SPLICE_SITE",tv[5].consequence_type)
90
+ end
91
+
92
+ def test_intronic
93
+ # INTRONIC
94
+ vf = VariationFeature.new(:seq_region_id => 27515, :seq_region_start => 31902068, :seq_region_end => 31902095, :seq_region_strand => 1, :allele_string => "GTGGACAGGGTCAGGAATCAGGAGTCTG/-", :variation_name => "rs9332736")
95
+ tv = vf.transcript_variations
96
+ assert_equal("INTRONIC",tv[3].consequence_type)
97
+ end
98
+
99
+ def test_frameshift
100
+ # FRAMESHIFT
101
+ vf = VariationFeature.new(:seq_region_id => 27511, :seq_region_start => 78958619, :seq_region_end => 78958618, :seq_region_strand => 1, :allele_string => "-/G", :variation_name => "rs35065683")
102
+ tv = vf.transcript_variations
103
+ assert_equal("FRAMESHIFT_CODING",tv[1].consequence_type)
104
+ end
105
+
106
+ def test_stop_gained
107
+ # STOP_GAINED
108
+ vf = VariationFeature.new(:seq_region_id => 27516, :seq_region_start => 38262908, :seq_region_end => 38262908, :seq_region_strand => 1, :allele_string => "G/A", :variation_name => "rs72556299")
109
+ tv = vf.transcript_variations
110
+ assert_equal("STOP_GAINED",tv[-1].consequence_type)
111
+ end
112
+
113
+ def test_stop_lost
114
+ # STOP_LOST
115
+ vf = VariationFeature.new(:seq_region_id => 27511, :seq_region_start => 152770613, :seq_region_end => 152770613, :seq_region_strand => 1, :allele_string => "T/G", :variation_name => "rs41268500")
116
+ tv = vf.transcript_variations
117
+ assert_equal("STOP_LOST",tv[0].consequence_type)
118
+ end
119
+
120
+ def test_synonymous
121
+ # SYNONYMOUS_CODING
122
+ vf = VariationFeature.new(:seq_region_id => 27506, :seq_region_start => 99688238, :seq_region_end => 99688238, :seq_region_strand => 1, :allele_string => "C/T", :variation_name => "rs11550651")
123
+ tv = vf.transcript_variations
124
+ assert_equal("SYNONYMOUS_CODING",tv[5].consequence_type)
125
+ end
126
+
127
+ def test_non_synonymous
128
+ # NON_SYNONYMOUS_CODING
129
+ vf = VariationFeature.new(:seq_region_id => 27506, :seq_region_start => 99057720, :seq_region_end => 99057720, :seq_region_strand => 1, :allele_string => "G/A", :variation_name => "rs11545970")
130
+ tv = vf.transcript_variations
131
+ assert_equal("NON_SYNONYMOUS_CODING",tv[9].consequence_type)
132
+ assert_equal("A/V",tv[9].peptide_allele_string)
133
+ end
134
+
135
+ # Checking CDNA coordinates calculation
136
+
137
+ def test_genomic2cdna_fw # forward strand (variation rs67960011)
138
+ t = Ensembl::Core::Transcript.find_by_stable_id("ENST00000039007")
139
+ assert_equal(573,t.genomic2cdna(38260562))
140
+ end
141
+
142
+ def test_cdna2genomic_fw # forward strand (variation rs67960011)
143
+ t = Ensembl::Core::Transcript.find_by_stable_id("ENST00000039007")
144
+ assert_equal(38260562,t.cdna2genomic(573))
145
+ end
146
+
147
+ def test_genomic2cdna_rev # reverse strand (variation rs11545970)
148
+ t = Ensembl::Core::Transcript.find_by_stable_id("ENST00000422429")
149
+ assert_equal(110,t.genomic2cdna(99057720))
150
+ end
151
+
152
+ def test_cdna2genomic_rev # reverse strand (variation rs11545970)
153
+ t = Ensembl::Core::Transcript.find_by_stable_id("ENST00000422429")
154
+ assert_equal(99057720,t.cdna2genomic(110))
155
+ end
156
+
157
+
158
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # = test/unit/release_50/variation/test_variation.tb - Unit test for Ensembl::Variation
2
+ # = test/unit/release_56/variation/test_variation.tb - Unit test for Ensembl::Variation
3
3
  #
4
4
  # Copyright:: Copyright (C) 2009
5
5
  # Francesco Strozzi <francesco.strozzi@gmail.com>
@@ -17,7 +17,7 @@ include Ensembl::Variation
17
17
  class TestVariation < Test::Unit::TestCase
18
18
 
19
19
  def setup
20
- DBConnection.connect('homo_sapiens',56)
20
+ DBConnection.connect('homo_sapiens',60)
21
21
  end
22
22
 
23
23
  def teardown
@@ -39,13 +39,13 @@ class TestVariation < Test::Unit::TestCase
39
39
  def test_flanking_seq
40
40
  vf = Variation.find_by_name('rs2076175').variation_features[0]
41
41
  up,down = vf.flanking_seq
42
- assert_equal(29713371,up.start)
43
- assert_equal(29713770,up.stop)
44
- assert_equal(29712970,down.start)
45
- assert_equal(29713369,down.stop)
46
- assert_equal('GGGCCCTGCCCTGCCTTTCTGCCTGTCACAGAGCAGGAAGAGCTGACCATCCAGATGTCCCTCAGCGAGAAACCCTGACTGCACAGATCCATCCTGGGACAGCACCGTGAGGTTGTAACAAAGACTGTGGGGCTCTGGGGAAGAGGAAATCACAGATGAAACTTCTTCCTGGAAGTAACTTCACATCAATGTTTAACACACAGGTCTGCTGTCCCGACCTTCCTGAGGAGGCAGGAAATGCACACGGGCAAAGGGACAAGAATGAGGATTTCAGACGCAAGGAAAACTGGGAAGGTGGGAGGATAGAGGAGGGGACTGAGGAACAGAAGAAGGGGGAATGGGGATGGCAAACTTGTAGGCCAGGTGCCAGGGCAGGGCAGCCACAGGCCCCCTCAGGATA',
47
- up.seq.upcase)
42
+ assert_equal(29712970,up.start)
43
+ assert_equal(29713369,up.stop)
44
+ assert_equal(29713371,down.start)
45
+ assert_equal(29713770,down.stop)
48
46
  assert_equal('TCCTGATCTCACAAACCCTAATCTCCTGGAGGGAATGCAAGGCTGCCTGCCCCTACCCAGCAGTGACTTCTCCATTCCAGTCCAAGTGAGGAACTCGGACCAGGAAGGACCCCTCCCTGGCCCTCTTCCATCCCTCCCTGTGTGGGCTGAGCCCCGCTGAGCACCATTCCTCACCCCTACTCACAGCCAAATCCAGTGGGAAGAGACAGGTCCTGCTCTCTGCCCCCAACTCTCCTGGAAAAGGCCTCTCCCATTACTCTTGCCCACTGCCCACTCTCACCTCCTTTCTGGCCCTTGATATGAGCCAGGGTCCTCCTGAGCTCCTGCCCATTCTCTGTCAAGTCTTCAGTCTCTGTGTCCCAGGTCTCAGCTCCCAGGACTGCTTCTGCCCACTGTCCCC',
47
+ up.seq.upcase)
48
+ assert_equal('GGGCCCTGCCCTGCCTTTCTGCCTGTCACAGAGCAGGAAGAGCTGACCATCCAGATGTCCCTCAGCGAGAAACCCTGACTGCACAGATCCATCCTGGGACAGCACCGTGAGGTTGTAACAAAGACTGTGGGGCTCTGGGGAAGAGGAAATCACAGATGAAACTTCTTCCTGGAAGTAACTTCACATCAATGTTTAACACACAGGTCTGCTGTCCCGACCTTCCTGAGGAGGCAGGAAATGCACACGGGCAAAGGGACAAGAATGAGGATTTCAGACGCAAGGAAAACTGGGAAGGTGGGAGGATAGAGGAGGGGACTGAGGAACAGAAGAAGGGGGAATGGGGATGGCAAACTTGTAGGCCAGGTGCCAGGGCAGGGCAGCCACAGGCCCCCTCAGGATA',
49
49
  down.seq.upcase)
50
50
 
51
51
  end
@@ -53,16 +53,17 @@ class TestVariation < Test::Unit::TestCase
53
53
  def test_slice_variation
54
54
  slice = Ensembl::Core::Slice.fetch_by_region('chromosome',1,100834,101331)
55
55
  variations = slice.get_variation_features
56
- assert_equal(6,variations.size)
57
-
58
- assert_equal('rs3912703',variations[0].variation_name)
59
- assert_equal('ENSSNP5435782',variations[1].variation_name)
60
- assert_equal('ENSSNP3491774',variations[2].variation_name)
61
- assert_equal('ENSSNP283782',variations[3].variation_name)
62
- assert_equal('ENSSNP4578340',variations[4].variation_name)
63
-
56
+ assert_equal(1,variations.size)
57
+ assert_equal('rs78180088',variations[0].variation_name)
58
+ end
59
+
60
+ def test_slice_structural_variation
61
+ slice = Ensembl::Core::Slice.fetch_by_region('chromosome',11,60125,320837)
62
+ sv = slice.get_structural_variations
63
+ assert_equal(16,sv.size)
64
+ assert_equal('nsv8753',sv[0].variation_name)
64
65
  end
65
66
 
66
67
 
67
68
 
68
- end
69
+ end