class Sniffer

Public Class Methods

is_mgf_format(filepath) click to toggle source
# File lib/protk/sniffer.rb, line 26
def self.is_mgf_format(filepath)
        lines = File.foreach(filepath).first(@sniff_lines).join("\n")
        if lines =~ /^BEGIN IONS/
                return true
        end
        return false
end
is_mzml_format(filepath) click to toggle source
# File lib/protk/sniffer.rb, line 18
def self.is_mzml_format(filepath)
        lines = File.foreach(filepath).first(@sniff_lines).join("\n")
        if lines =~ /\<mzML.*http\:\/\/psi\.hupo\.org\/ms\/mzml/
                return true
        end
        return false
end
sniff_format(filepath) click to toggle source

Return nil if undetectable Return detected format otherwise

# File lib/protk/sniffer.rb, line 8
def self.sniff_format(filepath)
        if self.is_mgf_format(filepath)
                return "mgf"
        elsif self.is_mzml_format(filepath)
                return "mzML"
        end
        return nil
end