bio-ensembl 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,91 @@
1
+ #
2
+ # = test/unit/release_53/core/test_project.rb - Unit test for Ensembl::Core
3
+ #
4
+ # Copyright:: Copyright (C) 2009
5
+ # Jan Aerts <http://jandot.myopenid.com>
6
+ # Francesco Strozzi <francesco.strozzi@gmail.com>
7
+ # License:: Ruby's
8
+ #
9
+ # $Id:
10
+
11
+ require File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
12
+
13
+ include Ensembl::Core
14
+
15
+ class SliceProjectFromAssemblyToComponentForwardStrands < Test::Unit::TestCase
16
+ def setup
17
+ DBConnection.connect('bos_taurus', 53)
18
+ @source_slice_single_contig = Slice.fetch_by_region('chromosome', '20', 175000, 180000)
19
+ @target_slices_single_contig = @source_slice_single_contig.project('contig')
20
+
21
+ @source_slice_two_contigs = Slice.fetch_by_region('chromosome','20', 175000, 190000)
22
+ @target_slices_two_contigs = @source_slice_two_contigs.project('contig')
23
+
24
+ @source_slice_contigs_with_strand = Slice.fetch_by_region('chromosome', '20', 160000, 190000)
25
+ @target_slices_contigs_with_strand = @source_slice_contigs_with_strand.project('contig')
26
+
27
+ @source_slice_contigs_with_strand_ends_in_gaps = Slice.fetch_by_region('chromosome', '20', 170950, 196000)
28
+ @target_slices_contigs_with_strand_ends_in_gaps = @source_slice_contigs_with_strand_ends_in_gaps.project('contig')
29
+ end
30
+
31
+ def teardown
32
+ DBConnection.remove_connection
33
+ end
34
+
35
+ # |-----------------> contig
36
+ # ^ ^
37
+ # | |
38
+ # |------------------------------------------> chromosome
39
+ def test_project_from_assembly_to_single_component
40
+ # Position 175000 on chr20 is position 4030 on contig, position 180000 is 9030
41
+ assert_equal('AAFC03028970', @target_slices_single_contig[0].seq_region.name)
42
+ assert_equal(4030, @target_slices_single_contig[0].start)
43
+ assert_equal(9030, @target_slices_single_contig[0].stop)
44
+ end
45
+
46
+ # |-----> |--------> contig
47
+ # ^ ^
48
+ # | |
49
+ # |------------------------------------------> chromosome
50
+ def test_project_from_assembly_to_two_components
51
+ # This chromosomal region is covered by contigs AAFC03028970, a gap and AAFC03028962
52
+ # * Position 175000 on chr 20 is position 4030 on contig AAFC03028970
53
+ # * Position 190000 on chr 20 is position 35 on contig AAFC03028962
54
+ assert_equal(3, @target_slices_two_contigs.length)
55
+ assert_equal('contig:Btau_4.0:AAFC03028970:4030:17365:1', @target_slices_two_contigs[0].display_name)
56
+ assert_equal(Gap, @target_slices_two_contigs[1].class)
57
+ assert_equal('contig:Btau_4.0:AAFC03028962:1:35:1', @target_slices_two_contigs[2].display_name)
58
+ end
59
+
60
+ # |-----> <-------| |-------> |-------> contig
61
+ # ^ ^
62
+ # | |
63
+ # |--------------------------------------------------> chromosome
64
+ def test_project_from_assembly_to_contigs_with_strand
65
+ # This chromosomal region is covered by 4 contigs and 3 gaps
66
+ # One of the contigs are on the reverse strand.
67
+ assert_equal(7, @target_slices_contigs_with_strand.length)
68
+ assert_equal('contig:Btau_4.0:AAFC03028964:90:9214:1', @target_slices_contigs_with_strand[0].display_name)
69
+ assert_equal(Gap, @target_slices_contigs_with_strand[1].class)
70
+ assert_equal('contig:Btau_4.0:AAFC03028959:1:1746:-1', @target_slices_contigs_with_strand[2].display_name)
71
+ assert_equal(Gap, @target_slices_contigs_with_strand[3].class)
72
+ assert_equal('contig:Btau_4.0:AAFC03028970:1:17365:1', @target_slices_contigs_with_strand[4].display_name)
73
+ assert_equal(Gap, @target_slices_contigs_with_strand[5].class)
74
+ assert_equal('contig:Btau_4.0:AAFC03028962:1:35:1', @target_slices_contigs_with_strand[6].display_name)
75
+ end
76
+
77
+ # <--| |-----> contig
78
+ # ^ ^
79
+ # | |
80
+ # |--------------------------------------------------> chromosome
81
+ def test_project_from_assembly_to_contigs_with_strand_and_ending_in_gaps
82
+ # This chromosomal region is covered by 2 contigs and 2 gaps at the end: GaCoGaCoGa
83
+ assert_equal(5, @target_slices_contigs_with_strand_ends_in_gaps.length)
84
+ assert_equal(Gap, @target_slices_contigs_with_strand_ends_in_gaps[0].class)
85
+ assert_equal('contig:Btau_4.0:AAFC03028970:1:17365:1', @target_slices_contigs_with_strand_ends_in_gaps[1].display_name)
86
+ assert_equal(Gap, @target_slices_contigs_with_strand_ends_in_gaps[2].class)
87
+ assert_equal('contig:Btau_4.0:AAFC03028962:1:5704:1', @target_slices_contigs_with_strand_ends_in_gaps[3].display_name)
88
+ assert_equal(Gap, @target_slices_contigs_with_strand_ends_in_gaps[4].class)
89
+ end
90
+
91
+ end
@@ -0,0 +1,61 @@
1
+ #
2
+ # = test/unit/test_project.rb - Unit test for Ensembl::Core
3
+ #
4
+ # Copyright:: Copyright (C) 2009
5
+ # Jan Aerts <http://jandot.myopenid.com>
6
+ # Francesco Strozzi <francesco.strozzi@gmail.com>
7
+ # License:: Ruby's
8
+ #
9
+ # $Id:
10
+ require File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
11
+
12
+ include Ensembl::Core
13
+
14
+ class AssemblyExceptions < 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_chr_x
25
+ source_slice = Slice.fetch_by_region('chromosome','X', 2709497, 2709520)
26
+ assert_equal('tagttatagattaaaagaagttaa', source_slice.seq)
27
+ end
28
+
29
+ def test_slice_overlapping_PAR_and_allosome
30
+ source_slice = Slice.fetch_by_region('chromosome','Y',2709500,2709540)
31
+ target_slices = source_slice.project('contig')
32
+ assert_equal('contig::AC006209.25.1.141759:23323:23343:-1', target_slices[0].display_name)
33
+ assert_equal('contig::AC006040.3.1.186504:57272:57291:1', target_slices[1].display_name)
34
+ end
35
+
36
+ def test_seq_slice_overlapping_PAR
37
+ seq = ''
38
+ File.open("test/data/seq_y.fa").reject{|l| l=~/^>/}.each do |line|
39
+ line.chomp!
40
+ seq += line
41
+ end
42
+ seq.downcase!
43
+
44
+ source_slice = Slice.fetch_by_region('chromosome', 'Y', 2709497, 2709542)
45
+ assert_equal(seq.downcase, source_slice.seq)
46
+ end
47
+
48
+ # The MHC haplotypes for human are not implemented yet, so we raise an error
49
+ # in the code.
50
+ def test_seq_slice_overlapping_HAP
51
+ seq = ''
52
+ File.open('test/data/seq_c6qbl.fa').reject{|l| l=~/^>/}.each do |line|
53
+ line.chomp!
54
+ seq += line
55
+ end
56
+ seq.downcase!
57
+
58
+ source_slice = Slice.fetch_by_region('chromosome', 'c6_QBL', 33451191, 33451690)
59
+ assert_raise(NotImplementedError) {source_slice.seq}
60
+ end
61
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # = test/unit/release_53/core/test_slice.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 File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
11
+
12
+ include Ensembl::Core
13
+
14
+ class TestSlice < 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_forward
25
+ seq1 = "AGAACCAACGAATTCGGAGATGAAGTCAGGTCTTCCAGTTCAGCCTGCGAGGAAGACAGGTGATCCGAATCCTAAGAATGCAAAAGATGGGCCGGGTGTGGTGGCTCATGCCTGTAATCCCAGCGCTTTGGGAGGCCGAGGCAGGCAGATCACCTGAGGTCGGGAGGTTGAGACCAGACTGACCAACAACGGAGAAACCC"
26
+ s = Slice.fetch_by_region("chromosome","13",31786617,31786816,1)
27
+ assert_equal(seq1,s.seq.upcase)
28
+ assert_equal("13",s.seq_region.name)
29
+ assert_equal(31786617,s.start)
30
+ assert_equal(31786816,s.stop)
31
+ end
32
+
33
+ def test_reverse
34
+ seq2 = "GGGTTTCTCCGTTGTTGGTCAGTCTGGTCTCAACCTCCCGACCTCAGGTGATCTGCCTGCCTCGGCCTCCCAAAGCGCTGGGATTACAGGCATGAGCCACCACACCCGGCCCATCTTTTGCATTCTTAGGATTCGGATCACCTGTCTTCCTCGCAGGCTGAACTGGAAGACCTGACTTCATCTCCGAATTCGTTGGTTCT"
35
+ s_rev = Slice.fetch_by_region("chromosome","13",31786617,31786816,-1)
36
+ assert_equal(seq2,s_rev.seq.upcase)
37
+ assert_equal("13",s_rev.seq_region.name)
38
+ assert_equal(31786617,s_rev.start)
39
+ assert_equal(31786816,s_rev.stop)
40
+ end
41
+
42
+ end
@@ -0,0 +1,57 @@
1
+ #
2
+ # = test/unit/release_53/core/test_transform.rb - Unit test for Ensembl::Core
3
+ #
4
+ # Copyright:: Copyright (C) 2009
5
+ # Jan Aerts <http://jandot.myopenid.com>
6
+ # Francesco Strozzi <francesco.strozzi@gmail.com>
7
+ # License:: Ruby's
8
+ #
9
+ # $Id:
10
+
11
+ require File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
12
+
13
+ include Ensembl::Core
14
+
15
+
16
+ # For all tests, the source (i.e. the seq_region that the feature is annotated
17
+ # on initially) remains forward.
18
+ #
19
+ # Same coordinate system: test names refer to direction of gene vs chromosome
20
+ class TransformOntoSameCoordinateSystem < Test::Unit::TestCase
21
+
22
+ def setup
23
+ DBConnection.connect('homo_sapiens', 53)
24
+ end
25
+
26
+ def teardown
27
+ DBConnection.remove_connection
28
+ end
29
+
30
+ def test_rev
31
+ source_gene = Gene.find(102634)
32
+ target_gene = source_gene.transform('chromosome')
33
+
34
+ assert_equal('18', source_gene.seq_region.name)
35
+ assert_equal(17659657, source_gene.seq_region_start)
36
+ assert_equal(17659744, source_gene.seq_region_end)
37
+ assert_equal(-1, source_gene.seq_region_strand)
38
+ assert_equal('18', target_gene.seq_region.name)
39
+ assert_equal(17659657, target_gene.seq_region_start)
40
+ assert_equal(17659744, target_gene.seq_region_end)
41
+ assert_equal(-1, target_gene.seq_region_strand)
42
+ end
43
+
44
+ def test_fw
45
+ source_gene = Gene.find(103817)
46
+ target_gene = source_gene.transform('chromosome')
47
+ assert_equal('11', source_gene.seq_region.name)
48
+ assert_equal(66886461, source_gene.seq_region_start)
49
+ assert_equal(66886755, source_gene.seq_region_end)
50
+ assert_equal(1, source_gene.seq_region_strand)
51
+ assert_equal('11', target_gene.seq_region.name)
52
+ assert_equal(66886461, target_gene.seq_region_start)
53
+ assert_equal(66886755, target_gene.seq_region_end)
54
+ assert_equal(1, target_gene.seq_region_strand)
55
+ end
56
+
57
+ end
@@ -0,0 +1,137 @@
1
+ #
2
+ # = test/unit/release_50/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 File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
11
+
12
+ include Ensembl::Variation
13
+
14
+ class ActiveRecordVariation < 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_allele
25
+ allele = Allele.find(1)
26
+ assert_equal('C', allele.allele)
27
+ assert_equal(0.673913, allele.frequency)
28
+ end
29
+
30
+ def test_sample
31
+ n = Sample.count(:all)
32
+ assert_equal(15406,n)
33
+ individual = Sample.find(9146).individual
34
+ assert_equal('Female',individual.gender)
35
+ i = Sample.find(10128).individual_genotype_multiple_bp
36
+ assert_equal(990,i.size)
37
+ assert_equal(1533205,i[0].variation_id)
38
+ syn = Sample.find(21).sample_synonym
39
+ assert_equal('477',syn.name)
40
+ end
41
+
42
+ def test_individual
43
+ n = Individual.count(:all)
44
+ assert_equal(8658,n)
45
+ end
46
+
47
+ def test_individual_genotype_multiple_bp
48
+ n = IndividualGenotypeMultipleBp.count(:all)
49
+ assert_equal(208579,n)
50
+ end
51
+
52
+ def test_compressed_genotype_single_bp
53
+ n = CompressedGenotypeSingleBp.count(:all)
54
+ assert_equal(12580098,n)
55
+ end
56
+
57
+ def test_read_coverage
58
+ n = ReadCoverage.count(:all)
59
+ assert_equal(9300776,n)
60
+ end
61
+
62
+ def test_population
63
+ n = Population.count(:all)
64
+ assert_equal(6748,n)
65
+ end
66
+
67
+ def test_variation
68
+ n = Variation.count(:all)
69
+ assert_equal(15872232,n)
70
+
71
+ syn = Variation.find(84).variation_synonyms
72
+ assert_equal(6,syn.size)
73
+ assert_equal('TSC1239757',syn[0].name)
74
+
75
+ flanking = Variation.find(10000).flanking_sequence
76
+ assert_equal(3652320,flanking.up_seq_region_start)
77
+ assert_equal(3652519,flanking.up_seq_region_end)
78
+ assert_equal(3652521,flanking.down_seq_region_start)
79
+ assert_equal(3652720,flanking.down_seq_region_end)
80
+ assert_equal(226033,flanking.seq_region_id)
81
+ assert_equal(1,flanking.seq_region_strand)
82
+
83
+ ag = Variation.find(10000).allele_groups
84
+ assert_nil ag[0]
85
+
86
+ pg = Variation.find(10000).population_genotypes
87
+ assert_equal(12,pg.size)
88
+ assert_equal('C',pg[0].allele_1)
89
+ assert_equal('C',pg[0].allele_2)
90
+ assert_equal(1,pg[0].frequency)
91
+
92
+ a = Variation.find(115).alleles
93
+ assert_equal(8,a.size)
94
+ assert_equal('C',a[0].allele)
95
+ assert_equal(0.593,a[0].frequency)
96
+
97
+ vf = Variation.find(5345540).variation_features[0]
98
+ assert_equal('G/A',vf.allele_string)
99
+ assert_equal('rs8189278',vf.variation_name)
100
+ assert_equal(226044,vf.seq_region_id)
101
+ assert_equal(50727657,vf.seq_region_start)
102
+ assert_equal(50727657,vf.seq_region_end)
103
+ assert_equal(1,vf.seq_region_strand)
104
+
105
+ vg = Variation.find(1352735).variation_groups
106
+ assert_nil vg[0]
107
+
108
+ i = Variation.find(1533205).individual_genotype_multiple_bps
109
+ assert_equal(41,i.size)
110
+ end
111
+
112
+ def test_variation_feature
113
+ vf_sample = VariationFeature.find(8).samples
114
+ assert_equal(6,vf_sample.size)
115
+ assert_equal('PERLEGEN:AFD_EUR_PANEL',vf_sample[0].name)
116
+ end
117
+
118
+ def test_variation_transcript
119
+ t = Variation.find_by_name('rs35303525').variation_features[0].transcript_variations
120
+ assert_equal(2,t.size)
121
+ transcript = t[0].transcript
122
+ assert_equal('protein_coding',transcript.biotype)
123
+ assert_equal(2199894,transcript.seq_region_start)
124
+ assert_equal(2213658,transcript.seq_region_end)
125
+ assert_equal('ENST00000243706',transcript.stable_id)
126
+ e = transcript.exons
127
+ assert_equal('CTCCCGTGAGGCAGTGCGAGGCGCGCGGGGCACGGAGGGCGGTGGCGGCGGGCTCCTGCGAGAAGCAAGCGGAACTTCCTGAG',e[0].seq.upcase)
128
+ end
129
+
130
+ def test_source
131
+ syn = Source.find(1).sample_synonyms
132
+ assert_equal(15385,syn.size)
133
+
134
+ ag = Source.find(1).allele_groups
135
+ assert_nil ag[0]
136
+ end
137
+ end
@@ -0,0 +1,66 @@
1
+ #
2
+ # = test/unit/release_50/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 File.expand_path File.join(File.dirname(__FILE__),"../../helper.rb")
9
+
10
+ include Ensembl::Variation
11
+
12
+ class TestVariation < Test::Unit::TestCase
13
+
14
+ def setup
15
+ DBConnection.connect('homo_sapiens',53)
16
+ end
17
+
18
+ def teardown
19
+ DBConnection.remove_connection
20
+ end
21
+
22
+ def test_fetch_region
23
+ vf = Variation.find_by_name('rs2076175').variation_features[0]
24
+ slice = vf.fetch_region
25
+ assert_equal(29816349,slice.start)
26
+ assert_equal(29826349,slice.stop)
27
+ assert_equal('6',slice.seq_region.name)
28
+ slice = vf.fetch_region(30,30)
29
+ assert_equal(29821319,slice.start)
30
+ assert_equal(29821379,slice.stop)
31
+ assert_equal('CTCCCAGGACTGCTTCTGCCCACTGTCCCCGGGGCCCTGCCCTGCCTTTCTGCCTGTCACA',slice.seq.upcase)
32
+ end
33
+
34
+ def test_flanking_seq
35
+ vf = Variation.find_by_name('rs2076175').variation_features[0]
36
+ up,down = vf.flanking_seq
37
+ assert_equal(29820949,up.start)
38
+ assert_equal(29821348,up.stop)
39
+ assert_equal(29821350,down.start)
40
+ assert_equal(29821749,down.stop)
41
+ assert_equal('TCCTGATCTCACAAACCCTAATCTCCTGGAGGGAATGCAAGGCTGCCTGCCCCTACCCAGCAGTGACTTCTCCATTCCAGTCCAAGTGAGGAACTCGGACCAGGAAGGACCCCTCCCTGGCCCTCTTCCATCCCTCCCTGTGTGGGCTGAGCCCCGCTGAGCACCATTCCTCACCCCTACTCACAGCCAAATCCAGTGGGAAGAGACAGGTCCTGCTCTCTGCCCCCAACTCTCCTGGAAAAGGCCTCTCCCATTACTCTTGCCCACTGCCCACTCTCACCTCCTTTCTGGCCCTTGATATGAGCCAGGGTCCTCCTGAGCTCCTGCCCATTCTCTGTCAAGTCTTCAGTCTCTGTGTCCCAGGTCTCAGCTCCCAGGACTGCTTCTGCCCACTGTCCCC',
42
+ up.seq.upcase)
43
+ assert_equal('GGGCCCTGCCCTGCCTTTCTGCCTGTCACAGAGCAGGAAGAGCTGACCATCCAGATGTCCCTCAGCGAGAAACCCTGACTGCACAGATCCATCCTGGGACAGCACCGTGAGGTTGTAACAAAGACTGTGGGGCTCTGGGGAAGAGGAAATCACAGATGAAACTTCTTCCTGGAAGTAACTTCACATCAATGTTTAACACACAGGTCTGCTGTCCCGACCTTCCTGAGGAGGCAGGAAATGCACACGGGCAAAGGGACAAGAATGAGGATTTCAGACGCAAGGAAAACTGGGAAGGTGGGAGGATAGAGGAGGGGACTGAGGAACAGAAGAAGGGGGAATGGGGATGGCAAACTTGTAGGCCAGGTGCCAGGGCAGGGCAGCCACAGGCCCCCTCAGGATA',
44
+ down.seq.upcase)
45
+
46
+ end
47
+
48
+ def test_slice_variation
49
+ slice = Ensembl::Core::Slice.fetch_by_region('chromosome',1,50000,50300)
50
+ variations = slice.get_variation_features
51
+ assert_equal(8,variations.size)
52
+
53
+ assert_equal('rs987669',variations[0].variation_name)
54
+ assert_equal('ENSSNP4691381',variations[1].variation_name)
55
+ assert_equal('rs2854665',variations[2].variation_name)
56
+ assert_equal('rs62637816',variations[3].variation_name)
57
+ assert_equal('ENSSNP9996411',variations[4].variation_name)
58
+ assert_equal('rs62637817',variations[5].variation_name)
59
+ assert_equal('rs2691281',variations[6].variation_name)
60
+ assert_equal('ENSSNP4068519',variations[7].variation_name)
61
+
62
+ end
63
+
64
+
65
+
66
+ end