Class: Chipgps
- Inherits:
-
Object
- Object
- Chipgps
- Defined in:
- lib/chipgps.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
Instance Method Summary collapse
-
#each_by_condition(condition_id) ⇒ Object
condition_id starts from 0.
-
#initialize(file) ⇒ Chipgps
constructor
End of Search class.
- #num_of_conditions ⇒ Object
- #num_of_events ⇒ Object
Constructor Details
#initialize(file) ⇒ Chipgps
End of Search class
52 53 54 55 56 57 58 59 |
# File 'lib/chipgps.rb', line 52 def initialize(file) @gps_out_file = file @lines = File.open(@gps_out_file).readlines @header = @lines.shift @num_of_conditions = num_of_conditions @num_of_events = num_of_events end |
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
60 61 62 |
# File 'lib/chipgps.rb', line 60 def header @header end |
Instance Method Details
#each_by_condition(condition_id) ⇒ Object
condition_id starts from 0
73 74 75 76 77 |
# File 'lib/chipgps.rb', line 73 def each_by_condition(condition_id) # condition_id starts from 0 @lines.each_with_index do |line, idx| yield Chipgps::Search.new(line, {:condition => condition_id, :event => idx}) end end |
#num_of_conditions ⇒ Object
62 63 64 65 66 67 |
# File 'lib/chipgps.rb', line 62 def num_of_conditions f = @lines[0].split(/\t/) num_of_conditions = (f.size - 2) / 9 # each condition has 9 cols # pp f.size return num_of_conditions end |
#num_of_events ⇒ Object
69 70 71 |
# File 'lib/chipgps.rb', line 69 def num_of_events return @lines.size end |