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

DESCRIPTION

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.

USAGE

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

Methods

External Aliases

seq_region_attribs -> attribs

Public Instance methods

DESCRIPTION

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.


Arguments:coord_system_name (optional)
Returns:array of SeqRegion objects

[Source]

     # File lib/ensembl/core/activerecord.rb, line 386
386:       def assembled_seq_regions(coord_system_name = nil)
387:         if coord_system_name.nil?
388:           return self.asm_seq_regions
389:         else
390:           answer = Array.new
391:           coord_system = CoordSystem.find_by_name(coord_system_name)
392:           self.asm_seq_regions.each do |asr|
393:             if asr.coord_system_id == coord_system.id
394:               answer.push(asr)
395:             end
396:           end
397:           return answer
398:         end
399:       end

DESCRIPTION

This method queries the assembly table to find those rows (i.e. AssemblyLink objects) for which this seq_region is the assembly.

USAGE

 my_seq_region = SeqRegion.find('4')
 first_link = my_seq_region.assembly_links_as_assembly[0]
 puts first_link.asm_start.to_s + "\t" + first_link.asm_end.to_s

Arguments:

  • coord_system_name: name of coordinate system that the components should belong to (default = nil)
Returns:array of AssemblyLink objects

[Source]

     # File lib/ensembl/core/activerecord.rb, line 441
441:       def assembly_links_as_assembly(coord_system_name = nil)
442:         if coord_system_name.nil?
443:           return self.asm_links_as_asm
444:         else
445:           coord_system = CoordSystem.find_by_name(coord_system_name)
446: #         return self.asm_links_as_asm.select{|alaa| alaa.cmp_seq_region.coord_system_id == coord_system.id}

447:           return AssemblyLink.find_by_sql("SELECT * FROM assembly a WHERE a.asm_seq_region_id = " + self.id.to_s + " AND a.cmp_seq_region_id IN (SELECT sr.seq_region_id FROM seq_region sr WHERE coord_system_id = " + coord_system.id.to_s + ")")
448:         end
449:       end

DESCRIPTION

This method queries the assembly table to find those rows (i.e. AssemblyLink objects) for which this seq_region is the component.

USAGE

 my_seq_region = SeqRegion.find('Chr4.003.1')
 first_link = my_seq_region.assembly_links_as_component[0]
 puts first_link.asm_start.to_s + "\t" + first_link.asm_end.to_s

Arguments:

  • coord_system_name: name of coordinate system that the assembly should belong to (default = nil)
Returns:array of AssemblyLink objects

[Source]

     # File lib/ensembl/core/activerecord.rb, line 466
466:       def assembly_links_as_component(coord_system_name = nil)
467:         if coord_system_name.nil?
468:           return self.asm_links_as_cmp
469:         else
470:           coord_system = CoordSystem.find_by_name(coord_system_name)
471:           return self.asm_links_as_cmp.select{|alac| alac.asm_seq_region.coord_system_id == coord_system.id}
472:         end
473:       end

DESCRIPTION

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.


Arguments:coord_system_name (optional)
Returns:array of SeqRegion objects

[Source]

     # File lib/ensembl/core/activerecord.rb, line 411
411:       def component_seq_regions(coord_system_name = nil)
412:         if coord_system_name.nil?
413:           return self.cmp_seq_regions
414:         else
415:           answer = Array.new
416:           coord_system = CoordSystem.find_by_name(coord_system_name)
417:           self.cmp_seq_regions.each do |csr|
418:             if csr.coord_system_id == coord_system.id
419:               answer.push(csr)
420:             end
421:           end
422:           return answer
423:         end
424:       end
seq()

Alias for sequence

DESCRIPTION

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.


Arguments:none
Returns:DNA sequence as String

[Source]

     # File lib/ensembl/core/activerecord.rb, line 482
482:       def sequence
483:         return self.dna.sequence
484:       end

DESCRIPTION

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


Arguments:none
Returns:Ensembl::Core::Slice object

[Source]

     # File lib/ensembl/core/activerecord.rb, line 373
373:       def slice
374:         return Ensembl::Core::Slice.new(self)
375:       end
subseq(start, stop)

Alias for subsequence

DESCRIPTION

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.


Arguments:start and stop position
Returns:DNA sequence as String

[Source]

     # File lib/ensembl/core/activerecord.rb, line 494
494:       def subsequence(start, stop)
495:         return self.seq.slice(start - 1, (stop - start) + 1)
496:       end

[Validate]