class Ensembl::Core::SeqRegion

The SeqRegion class describes a part of a coordinate systems. It is an interface to the seq_region table of the Ensembl mysql database.

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.

@example

chr4 = SeqRegion.find_by_name('4')
puts chr4.coord_system.name     #--> 'chromosome'
chr4.genes.each do |gene|
  puts gene.biotype
end

Public Instance Methods

assembled_seq_regions(coord_system_name = nil) click to toggle source

The SeqRegion#assembled_seq_regions returns the sequence regions on which the current region is assembled. For example, calling this method on a contig sequence region, it might return the chromosome that that contig is part of. Optionally, this method takes a coordinate system name so that only regions of that coordinate system are returned.

@param [String] coord_system_name Name of coordinate system @return [Array<SeqRegion>] Array of SeqRegion objects

# File lib/bio-ensembl/core/activerecord.rb, line 400
def assembled_seq_regions(coord_system_name = nil)
  if coord_system_name.nil?
    return self.asm_seq_regions
  else
    answer = Array.new
    coord_system = CoordSystem.find_by_name(coord_system_name)
    self.asm_seq_regions.each do |asr|
      if asr.coord_system_id == coord_system.id
        answer.push(asr)
      end
    end
    return answer
  end
end
component_seq_regions(coord_system_name = nil) click to toggle source

The SeqRegion#component_seq_regions returns the sequence regions contained within the current region (in other words: the bits used to assemble the current region). For example, calling this method on a chromosome sequence region, it might return the contigs that were assembled into this chromosome. Optionally, this method takes a coordinate system name so that only regions of that coordinate system are returned.

@param [String] coord_system_name Name of coordinate system @return [Array<SeqRegion>] Array of SeqRegion objects

# File lib/bio-ensembl/core/activerecord.rb, line 424
def component_seq_regions(coord_system_name = nil)
  if coord_system_name.nil?
    return self.cmp_seq_regions
  else
    answer = Array.new
    coord_system = CoordSystem.find_by_name(coord_system_name)
    self.cmp_seq_regions.each do |csr|
      if csr.coord_system_id == coord_system.id
        answer.push(csr)
      end
    end
    return answer
  end
end
seq()
Alias for: sequence
sequence() click to toggle source

The SeqRegion#sequence method returns the sequence of this seq_region. At the moment, it will only return the sequence if the region belongs to the seqlevel coordinate system.

@return [String] DNA sequence

# File lib/bio-ensembl/core/activerecord.rb, line 486
def sequence
  return self.dna.sequence
end
Also aliased as: seq
slice() click to toggle source

The SeqRegion#slice method returns a slice object that covers the whole of the seq_region.

@return [Ensembl::Core::Slice] Slice object

# File lib/bio-ensembl/core/activerecord.rb, line 388
def slice
  return Ensembl::Core::Slice.new(self)
end
subseq(start, stop)
Alias for: subsequence
subsequence(start, stop) click to toggle source

The SeqRegion#subsequence method returns a subsequence of this seq_region. At the moment, it will only return the sequence if the region belongs to the seqlevel coordinate system.

@param [Integer] start Start position @param [Integer] stop Stop position @return [String] DNA sequence

# File lib/bio-ensembl/core/activerecord.rb, line 498
def subsequence(start, stop)
  return self.seq.slice(start - 1, (stop - start) + 1)
end
Also aliased as: subseq