Method: Ensembl::Core::Slice#initialize

Defined in:
lib/bio-ensembl/core/slice.rb

#initialize(seq_region, start = 1, stop = seq_region.length, strand = 1) ⇒ Slice

Create a new Slice object from scratch.

Examples:

chr4 = SeqRegion.find_by_name('4')
my_slice = Slice.new(chr4, 95000, 98000, -1)

Parameters:

  • seq_region (SeqRegion)

    SeqRegion object

  • start (Integer) (defaults to: 1)

    Start position of the slice on the seq_region

  • stop (Integer) (defaults to: seq_region.length)

    Stop position of the slice on the seq_region

  • strand (Integer) (defaults to: 1)

    Strand that the slice should be



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/bio-ensembl/core/slice.rb', line 47

def initialize(seq_region, start = 1, stop = seq_region.length, strand = 1)
  if start.nil?
    start = 1
  end
  if stop.nil?
    stop = seq_region.length
  end
  unless seq_region.class == Ensembl::Core::SeqRegion
    raise 'First argument has to be a Ensembl::Core::SeqRegion object'
  end
  @seq_region, @start, @stop, @strand = seq_region, start, stop, strand
  @seq = nil
end