Class: Cytogenetics::Fragment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Fragment

Returns a new instance of Fragment.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cytogenetics/fragment.rb', line 7

def initialize(*args)
  config_logging()
  unless (args.length.eql? 2 and (args[0].is_a? Breakpoint and args[1].is_a? Breakpoint))
    raise ArgumentError, "Expected arguments are missing or are not Breakpoints: #{args}"
  end

  #@genes = []
  @start = args[0]
  @end = args[1]
  @chr = @start.chr

  unless @start.chr.eql? @end.chr
    raise StructureError, "Fragments must be within the same chromosome: #{args}"
  end
end

Instance Attribute Details

#chrObject (readonly)

Returns the value of attribute chr.



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

def chr
  @chr
end

#endObject (readonly)

Returns the value of attribute end.



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

def end
  @end
end

#genesObject (readonly)

Returns the value of attribute genes.



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

def genes
  @genes
end

#startObject (readonly)

Returns the value of attribute start.



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

def start
  @start
end

Instance Method Details

#add_gene(gene) ⇒ Object



23
24
25
# File 'lib/cytogenetics/fragment.rb', line 23

def add_gene(gene)
  @genes << gene
end

#config_loggingObject



38
39
40
41
# File 'lib/cytogenetics/fragment.rb', line 38

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

#to_sObject



27
28
29
# File 'lib/cytogenetics/fragment.rb', line 27

def to_s
  return "#{@start.to_s} --> #{@end.to_s}"
end