Sha256: 0c829b11771ceda3db56563b2f43bab4a8648ab7f55afa2c4fe447b449e6ed23

Contents?: true

Size: 717 Bytes

Versions: 8

Compression:

Stored size: 717 Bytes

Contents

module SpecID::Pep

  # filter must be a hash with these keys allowed:
  # :xcorr1, :xcorr2, :xcorr3, :deltacn, :ppm, :include_deltacnstar
  def pass_filters?(filter)
    filter.all? do |k,v| 
      k_as_s = k.to_s
      if ((k_as_s[0...-1] == 'xcorr') and (k.to_s[-1,1].to_i == self.charge))
        charge = k.to_s[-1,1].to_i
        self.xcorr >= v
      elsif k_as_s == 'include_deltacnstar'
        if v == false
          self.deltacn <= 1.0
        else
          true
        end
      elsif k_as_s == 'ppm'
        self.send(k) <= v
      elsif k_as_s == 'deltacn'
        self.send(k) >= v
      else
        true
      end
    end
  end

  def fail_filters?(filter)
    !pass_filters?(filter)
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mspire-0.4.9 specs/spec_id_helper.rb
mspire-0.3.0 specs/spec_id_helper.rb
mspire-0.3.1 specs/spec_id_helper.rb
mspire-0.3.9 specs/spec_id_helper.rb
mspire-0.4.4 specs/spec_id_helper.rb
mspire-0.4.2 specs/spec_id_helper.rb
mspire-0.4.7 specs/spec_id_helper.rb
mspire-0.4.5 specs/spec_id_helper.rb