Sha256: e9331f5e0efe080c243459e1b9b41e7ad5852d788fe3abe14cad1bd4a8c981aa

Contents?: true

Size: 697 Bytes

Versions: 2

Compression:

Stored size: 697 Bytes

Contents

require 'andand'

module MS ; end
module MS::Ident
  module ProteinLike
    # an id for the protein
    attr_accessor :id

    # the protein sequence
    attr_accessor :sequence
    alias_method :seq, :sequence
    alias_method :seq=, :sequence=

      # a description of the protein
      attr_accessor :description

    # if the GN=([^\s]+) regexp is found in the description, returns the first
    # match, or nil if not found
    def gene_id
      description.andand.match(/ GN=(\w+) ?/)[1]
    end
  end

  # a generic protein class that is ProteinLike
  class Protein
    include ProteinLike

    def initialize(id=nil, sequence=nil)
      (@id, @sequence) = id, sequence
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mspire-0.6.2 lib/ms/ident/protein.rb
mspire-0.6.1 lib/ms/ident/protein.rb