Class: Ucsc::Hg18::Slice

Inherits:
Object
  • Object
show all
Defined in:
lib/ucsc/hg18/slice.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chromosome, range, strand = nil) ⇒ Slice

Returns a new instance of Slice.



4
5
6
# File 'lib/ucsc/hg18/slice.rb', line 4

def initialize(chromosome, range, strand = nil)
  @chromosome, @range = chromosome, range, strand
end

Instance Attribute Details

#chromosomeObject

Returns the value of attribute chromosome.



7
8
9
# File 'lib/ucsc/hg18/slice.rb', line 7

def chromosome
  @chromosome
end

#rangeObject

Returns the value of attribute range.



7
8
9
# File 'lib/ucsc/hg18/slice.rb', line 7

def range
  @range
end

#strandObject

Returns the value of attribute strand.



7
8
9
# File 'lib/ucsc/hg18/slice.rb', line 7

def strand
  @strand
end

Instance Method Details

#contained_by?(other_slice) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ucsc/hg18/slice.rb', line 25

def contained_by?(other_slice)
  if self.chromosome != other_slice.chromosome
    return false
  end
  
  if self.range.contained_by?(other_slice.range)
    return true
  else
    return false
  end
end

#contains?(other_slice) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ucsc/hg18/slice.rb', line 37

def contains?(other_slice)
  if self.chromosome != other_slice.chromosome
    return false
  end
  
  if self.range.contains?(other_slice.range)
    return true
  else
    return false
  end
end

#overlaps?(other_slice) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ucsc/hg18/slice.rb', line 13

def overlaps?(other_slice)
  if self.chromosome != other_slice.chromosome
    return false
  end
  
  if self.range.overlaps?(other_slice.range)
    return true
  else
    return false
  end
end

#to_sObject



9
10
11
# File 'lib/ucsc/hg18/slice.rb', line 9

def to_s
  return @chromosome + ':' + @range.to_s
end