Class: Chipgps::Search

Inherits:
Event
  • Object
show all
Defined in:
lib/chipgps.rb

Overview

End of Event class

Instance Attribute Summary

Attributes inherited from Event

#bp, #chr, #control_binding_strength, #fold_enrichment, #ip, #ip_binding_present, #ip_binding_strength, #ipvsCTR_KLD, #ipvsEMP_KLD, #line, #mlog10_pvalue, #mlog10_qvalue

Instance Method Summary collapse

Constructor Details

#initialize(line, options = {}) ⇒ Search

Returns a new instance of Search.



15
16
17
18
19
20
21
# File 'lib/chipgps.rb', line 15

def initialize(line, options = {})
  @line = line
  @event_number     = options[:event]
  @condition_number = options[:condition]

  parse
end

Instance Method Details

#cleanup(line) ⇒ Object



23
24
25
26
27
28
# File 'lib/chipgps.rb', line 23

def cleanup(line)
  new_line = line.strip
  new_line.chomp!
  new_line.gsub!(/ +/, "")
  return new_line
end

#parseObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/chipgps.rb', line 30

def parse
  # condition_number start from 0.

  line = cleanup(@line)
  f = line.split(/\t/)

  @chr = f[0].split(/:/)[0]
  @bp  = f[0].split(/:/)[1].to_i
  @ip  = f[1].to_f

  @ip_binding_present       = f[(@condition_number * 9 + 2) + 0].to_i 
  @ip_binding_strength      = f[(@condition_number * 9 + 2) + 1].to_f  
  @control_binding_strength = f[(@condition_number * 9 + 2) + 2].to_f  
  @fold_enrichment          = f[(@condition_number * 9 + 2) + 3].to_f  
  @mlog10_qvalue            = f[(@condition_number * 9 + 2) + 4].to_f  
  @mlog10_pvalue            = f[(@condition_number * 9 + 2) + 5].to_f  
  @ipvsEMP_KLD              = f[(@condition_number * 9 + 2) + 6].to_f  
  @ipvsCTR_KLD              = f[(@condition_number * 9 + 2) + 7].to_f  
end