Class: Bio::FastQC::Data
- Inherits:
-
Object
- Object
- Bio::FastQC::Data
- Defined in:
- lib/bio/fastqc/data.rb
Class Method Summary collapse
- .filenotfound(file) ⇒ Object
- .read(file) ⇒ Object
- .read_dir(file) ⇒ Object
- .read_flatfile(file) ⇒ Object
- .read_zipfile(file) ⇒ Object
Class Method Details
.filenotfound(file) ⇒ Object
35 36 37 |
# File 'lib/bio/fastqc/data.rb', line 35 def filenotfound(file) raise "FastQC data file fastqc_data.txt not found, input file: #{file}" end |
.read(file) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/bio/fastqc/data.rb', line 9 def read(file) read_zipfile(file) rescue Zip::Error read_flatfile(file) rescue Errno::EISDIR read_dir(file) end |
.read_dir(file) ⇒ Object
29 30 31 32 33 |
# File 'lib/bio/fastqc/data.rb', line 29 def read_dir(file) open(File.join(file, "fastqc_data.txt")).read rescue Errno::ENOENT filenotfound(file) end |
.read_flatfile(file) ⇒ Object
25 26 27 |
# File 'lib/bio/fastqc/data.rb', line 25 def read_flatfile(file) open(file).read end |
.read_zipfile(file) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/bio/fastqc/data.rb', line 17 def read_zipfile(file) Zip::File.open(file) do |zipfile| d = zipfile.glob('*/fastqc_data.txt').first filenotfound(file) if !d d.get_input_stream.read end end |