Class: Ms::ErrorRate::Sbv::PeptideBased

Inherits:
Object
  • Object
show all
Defined in:
lib/ms/error_rate/sbv/peptide_based.rb

Overview

Constraints on aaseq attribute of peptides (the bare amino acid sequence) works by calculating amino acid frequencies in the fasta file used.

Class Method Summary collapse

Class Method Details

.generate_hashes(pep_to_prot_file, aa = "C", min_num = 1) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ms/error_rate/sbv/peptide_based.rb', line 10

def self.generate_hashes(pep_to_prot_file, aa="C", min_num=1 )
  Ms::ErrorRate::Sbv.generate_hashes(pep_to_prot_file, :type_code => "aa_min#{min_num}") do |pep|
    if min_num == 1
      if pep.include?(aa) ; 1
      else ; 0
      end
    else
      count = 0
      pep.each_char {|c| count += 1 if c == aa }
      if count >= min_num ; 1
      else ; 0
      end
    end
  end
end