class Bio::FastQC::Data

Public Class Methods

filenotfound(file) click to toggle source
# File lib/bio/fastqc/data.rb, line 34
def filenotfound(file)
  raise "FastQC data file fastqc_data.txt not found, input file: #{file}"
end
read(file) click to toggle source
# File lib/bio/fastqc/data.rb, line 8
def read(file)
  read_zipfile(file)
rescue Zip::Error
  read_flatfile(file)
rescue Errno::EISDIR
  read_dir(file)
end
read_dir(file) click to toggle source
# File lib/bio/fastqc/data.rb, line 28
def read_dir(file)
  open(File.join(file, "fastqc_data.txt")).read
rescue Errno::ENOENT
  filenotfound(file)
end
read_flatfile(file) click to toggle source
# File lib/bio/fastqc/data.rb, line 24
def read_flatfile(file)
  open(file).read
end
read_zipfile(file) click to toggle source
# File lib/bio/fastqc/data.rb, line 16
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