Module: Ucsc::Hg18::Sliceable

Included in:
Feature
Defined in:
lib/ucsc/hg18/activerecord.rb

Overview

DESCRIPTION

The Sliceable mixin holds the get_slice method and can be included in any class that lends itself to having a position on a chromosome.

Instance Method Summary collapse

Instance Method Details

#sliceObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/ucsc/hg18/activerecord.rb', line 60

def slice
  start, stop, strand = nil, nil, nil
	if self.class.column_names.include?('chromStart')
    start = self.chromStart
  end
	if self.class.column_names.include?('chromEnd')
    stop = self.chromEnd
  end
	if self.class.column_names.include?('strand')
    strand = self.strand
  end

  return Ucsc::Hg18::Slice.new(self.chrom, Range.new(start.to_i, stop.to_i), strand)
end