Class: Cytogenetics::Breakpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/cytogenetics/breakpoint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Breakpoint

Returns a new instance of Breakpoint.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cytogenetics/breakpoint.rb', line 7

def initialize(*args)
  config_logging
  c = args[0]; b = args[1]
  @type = args[2] if args.length > 2

  unless ((c.is_a? String and c.match(/\d+|X|Y/)) and (b.is_a? String and b.length > 0))
    @log.error("#{c}#{b} is not a valid breakpoint")
    raise ArgumentError, "#{c}#{b} is not a valid breakpoint"
  end
  @chr = c; @band = b
end

Instance Attribute Details

#bandObject

Returns the value of attribute band.



5
6
7
# File 'lib/cytogenetics/breakpoint.rb', line 5

def band
  @band
end

#chrObject

Returns the value of attribute chr.



5
6
7
# File 'lib/cytogenetics/breakpoint.rb', line 5

def chr
  @chr
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/cytogenetics/breakpoint.rb', line 5

def type
  @type
end

Instance Method Details

#armObject



19
20
21
22
# File 'lib/cytogenetics/breakpoint.rb', line 19

def arm
  @band.match(/(q|p)\d+/)
  return $1
end

#config_loggingObject



30
31
32
33
# File 'lib/cytogenetics/breakpoint.rb', line 30

def config_logging
  @log = Cytogenetics.logger
  #@log.progname = self.class.name
end

#to_sObject



24
25
26
# File 'lib/cytogenetics/breakpoint.rb', line 24

def to_s
  return "#{@chr}#{@band}"
end