Class Ensembl::Core::CoordSystem
In: lib/ensembl/core/activerecord.rb
Parent: DBConnection

DESCRIPTION

The CoordSystem class describes the coordinate system to which a given SeqRegion belongs. It is an interface to the coord_system table of the Ensembl mysql database.

Two virtual coordinate systems exist for every species:

  • toplevel: the coordinate system with rank 1
  • seqlevel: the coordinate system that contains the seq_regions with the sequence

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.

USAGE

 coord_system = Ensembl::Core::CoordSystem.find_by_name('chromosome')
 if coord_system == CoordSystem.toplevel
   puts coord_system.name + " is the toplevel coordinate system."
 end

Methods

Public Class methods

DESCRIPTION

The CoordSystem#find_default_by_name class method returns the coordinate system by that name with the lowest rank. Normally, a lower rank means a ‘bigger’ coordinate system. The ‘chromosome’ typically has rank 1. However, there might be more than one coordinate system with the name chromosome but with different version (e.g. in human, there is one for the NCBI36 and one for the NCBI35 version). The older version of these is typically given a high number and the one with the new version is the ‘default’ system.


Arguments:none
Returns:CoordSystem object

[Source]

     # File lib/ensembl/core/activerecord.rb, line 276
276:       def self.find_default_by_name(name)
277:         all_coord_systems_with_name = Ensembl::Core::CoordSystem.find_all_by_name(name)
278:         if all_coord_systems_with_name.length == 1
279:           return all_coord_systems_with_name[0]
280:         else
281:           return all_coord_systems_with_name.select{|cs| cs.attrib =~ /default_version/}[0]
282:         end
283:       end

DESCRIPTION

The CoordSystem#find_seqlevel class method returns the seqlevel coordinate system.


Arguments:none
Returns:CoordSystem object

[Source]

     # File lib/ensembl/core/activerecord.rb, line 260
260:       def self.find_seqlevel
261:         return CoordSystem.find_by_sql("SELECT * FROM coord_system WHERE attrib LIKE '%sequence_level%'")[0]
262:       end

DESCRIPTION

The CoordSystem#find_toplevel class method returns the toplevel coordinate system.


Arguments:none
Returns:CoordSystem object

[Source]

     # File lib/ensembl/core/activerecord.rb, line 250
250:       def self.find_toplevel
251:         return CoordSystem.find_by_rank(1)
252:       end

Public Instance methods

DESCRIPTION

The CoordSystem#name_with_version returns a string containing the name and version of the coordinate system. If no version is available, then just the name is returned


Arguments:none
Returns:String object

[Source]

     # File lib/ensembl/core/activerecord.rb, line 292
292:       def name_with_version
293:         if self.version.nil?
294:           return name
295:         else
296:           return [name, version].join(':')
297:         end
298:       end

DESCRIPTION

The CoordSystem#seqlevel? method checks if this coordinate system is the seqlevel coordinate system or not.


Arguments:none
Returns:TRUE or FALSE

[Source]

     # File lib/ensembl/core/activerecord.rb, line 236
236:       def seqlevel?
237:         if self == CoordSystem.find_by_sql("SELECT * FROM coord_system WHERE attrib LIKE '%sequence_level%'")[0]
238:           return true
239:         else
240:           return false
241:         end
242:       end

DESCRIPTION

The CoordSystem#toplevel? method checks if this coordinate system is the toplevel coordinate system or not.


Arguments:none
Returns:TRUE or FALSE

[Source]

     # File lib/ensembl/core/activerecord.rb, line 222
222:       def toplevel?
223:         if self == CoordSystem.find_by_rank(1)
224:           return true
225:         else
226:           return false
227:         end
228:       end

[Validate]