class Ms::Ident::Search
Attributes
hits[RW]
id[RW]
peptide_hits[RW]
Public Class Methods
new(id=nil, peptide_hits=[])
click to toggle source
# File lib/ms/ident/search.rb, line 10 def initialize(id=nil, peptide_hits=[]) @id = id @peptide_hits = peptide_hits end
Public Instance Methods
merge!(ar_of_peptide_hit_arrays) { |protein, [peptide]| ... }
click to toggle source
returns an array of peptide_hits
and protein_hits that are linked to one another. NOTE: this will update peptide and protein hits :proteins and :peptides attributes respectively). Assumes that each search responds to :peptides, each peptide responds to :proteins and each protein to :peptides. Can be done on a single file to restore protein/peptide linkages to their original single-file state. Assumes the protein is initialized with (reference, peptide_ar)
yields the protein that will become the template for a new protein and expects a new protein hit
# File lib/ms/ident/search.rb, line 25 def merge!(ar_of_peptide_hit_arrays) all_peptide_hits = [] reference_hash = {} ar_of_peptide_hit_arrays.each do |peptide_hits| all_peptide_hits.push(*peptide_hits) peptide_hits.each do |peptide| peptide.proteins.each do |protein| ref = protein.reference if reference_hash.key? ref reference_hash[ref].peptides << peptide reference_hash[ref] else reference_hash[ref] = yield(protein, [peptide]) end end end end [all_peptide_hits, reference_hash.values] end