class Proph::ProtSummary

Constants

Filetype_and_version_re_new
Filetype_and_version_re_old

if you get this match it’s a protein prophet file and the version is the first match!

Attributes

prot_groups[RW]

the protein groups

version[RW]

Public Class Methods

new(file=nil) click to toggle source
# File lib/ms/ident/pepxml/prot_summary.rb, line 50
def initialize(file=nil)
  @prots = nil
  if file
    @version = get_version(file)
    #@prot_groups = ProtSummary::Parser.new.parse_file(file)
    SpecID::Parser::ProtProph.new(:spec_id).parse(file, :spec_id => self)
  end
end

Public Instance Methods

get_version(file) click to toggle source
# File lib/ms/ident/pepxml/prot_summary.rb, line 32
def get_version(file)
  answer = nil
  File.open(file) do |fh|
    5.times do
      line = fh.gets
      answer = 
        if line =~ Filetype_and_version_re_new
          $1.dup
        elsif line =~ Filetype_and_version_re_old
          $1.dup
        end
      break if answer
    end
  end
  raise(ArgumentError, "couldn't detect version in #{file}") unless answer
  answer
end
hi_prob_best() click to toggle source
# File lib/ms/ident/pepxml/prot_summary.rb, line 30
def hi_prob_best ; true end
unique_prots(prot_groups) click to toggle source

returns a set of unique proteins

# File lib/ms/ident/pepxml/prot_summary.rb, line 60
def unique_prots(prot_groups)
  all_prots = []
  prot_groups.each do |pg|
    pg.prots.each do |prt|
      all_prots << prt
    end
  end
  all_prots.hash_by(:protein_name).map{|name,prot_arr| prot_arr.first }
end