Class: DTALog
- Inherits:
-
Object
- Object
- DTALog
- Defined in:
- lib/spec_id/srf.rb
Overview
class to extract information from <file>_dta.log files
Class Method Summary collapse
-
.dta_and_scans_by_dta_index(file) ⇒ Object
returns an array indexed by the dta file number (starting at 0) each entry is an array [first_scan, last_scan, dta_filename_noext] this is now obsolete since I found the scan # index at the end of the srf files.
Class Method Details
.dta_and_scans_by_dta_index(file) ⇒ Object
returns an array indexed by the dta file number (starting at 0) each entry is an array [first_scan, last_scan, dta_filename_noext] this is now obsolete since I found the scan # index at the end of the srf files
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/spec_id/srf.rb', line 24 def self.dta_and_scans_by_dta_index(file) dta_index = nil final_scan = nil dta_cnt = 0 re = /^ m/o scan_line_re = /scan: (\d+) - (\d+), Datafile: (.*?) (.*)/o other_dta_re = /Datafile: (.*?) /o File.open(file) do |fh| 10.times { fh.readline } scan_range_line = fh.readline if scan_range_line =~ /scan range\s+= \d+ - (\d+)/ # this is an overestimate (since MS scans have no dta, but that's OK) dta_index = Array.new($1.to_i) else dta_index = [] end 3.times { fh.readline } fh.each do |line| if line =~ re if line =~ scan_line_re first_scan = $1.to_i last_scan = $2.to_i the_rest = $4.dup dta_index[dta_cnt] = [first_scan, last_scan, $3.sub(/\.dta/,'')] dta_cnt += 1 if the_rest =~ other_dta_re dta_index[dta_cnt] = [first_scan, last_scan, $1.sub(/\.dta/,'')] dta_cnt += 1 end end break end end fh.each do |line| if line =~ scan_line_re first_scan = $1.to_i last_scan = $2.to_i the_rest = $4.dup dta_index[dta_cnt] = [first_scan, last_scan, $3.sub(/\.dta/,'')] dta_cnt += 1 if the_rest =~ other_dta_re dta_index[dta_cnt] = [first_scan, last_scan, $1.sub(/\.dta/,'')] dta_cnt += 1 end end end end dta_index.compact! # remove those trailing nils dta_index end |