Class: Ensembl::Variation::VariationFeature
- Inherits:
-
DBConnection
- Object
- ActiveRecord::Base
- DBRegistry::Base
- DBConnection
- Ensembl::Variation::VariationFeature
- Defined in:
- lib/ensembl/variation/variation.rb
Overview
The VariationFeature class gives information about the genomic position of each Variation, including also validation status and consequence type.
This class uses ActiveRecord to access data in the Ensembl database. See the general documentation of the Ensembl module for more information on what this means and what methods are available.
Instance Method Summary collapse
-
#consequence_type ⇒ Object
workaround as ActiveRecord do not parse SET field in MySQL.
-
#fetch_region(up = 5000, down = 5000) ⇒ Slice
Based on Perl API ‘get_all_Genes’ method for Variation class.
- #flanking_seq ⇒ Object
- #transcript_variations ⇒ Object
Methods inherited from DBConnection
connect, ensemblgenomes_connect
Methods inherited from DBRegistry::Base
generic_connect, get_info, get_name_from_db
Instance Method Details
#consequence_type ⇒ Object
workaround as ActiveRecord do not parse SET field in MySQL
105 106 107 |
# File 'lib/ensembl/variation/variation.rb', line 105 def consequence_type # workaround as ActiveRecord do not parse SET field in MySQL "#{attributes_before_type_cast['consequence_type']}" end |
#fetch_region(up = 5000, down = 5000) ⇒ Slice
Based on Perl API ‘get_all_Genes’ method for Variation class. Get a genomic region starting from the Variation coordinates, expanding the region upstream and downstream.
116 117 118 119 120 |
# File 'lib/ensembl/variation/variation.rb', line 116 def fetch_region(up = 5000, down = 5000) sr = core_connection(self.seq_region_id) slice = Ensembl::Core::Slice.fetch_by_region(Ensembl::Core::CoordSystem.find(sr.coord_system_id).name,sr.name,self.seq_region_start-up,self.seq_region_end+down) return slice end |
#flanking_seq ⇒ Object
122 123 124 125 126 127 128 |
# File 'lib/ensembl/variation/variation.rb', line 122 def flanking_seq sr = core_connection(self.seq_region_id) f = Variation.find(self.variation_id).flanking_sequence slice_up = Ensembl::Core::Slice.fetch_by_region(Ensembl::Core::CoordSystem.find(sr.coord_system_id).name,sr.name,f.up_seq_region_start,f.up_seq_region_end,self.seq_region_strand) slice_down = Ensembl::Core::Slice.fetch_by_region(Ensembl::Core::CoordSystem.find(sr.coord_system_id).name,sr.name,f.down_seq_region_start,f.down_seq_region_end,self.seq_region_strand) return slice_up,slice_down end |
#transcript_variations ⇒ Object
130 131 132 133 134 135 136 137 138 |
# File 'lib/ensembl/variation/variation.rb', line 130 def transcript_variations tvs = TranscriptVariation.find_all_by_variation_feature_id(self.variation_feature_id) if tvs[0].nil? then # the variation is not stored in the database, so run the calculations sr = core_connection(self.seq_region_id) return custom_transcript_variation(self,sr) else return tvs # the variation is already present in the database end end |