Sha256: af83cc8e4e384669efe2ba71334f031e441e33b4da04151076442b3dfea5a982

Contents?: true

Size: 687 Bytes

Versions: 13

Compression:

Stored size: 687 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[/ 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

13 entries across 13 versions & 1 rubygems

Version Path
mspire-0.6.26 lib/ms/ident/protein.rb
mspire-0.6.25 lib/ms/ident/protein.rb
mspire-0.6.24 lib/ms/ident/protein.rb
mspire-0.6.22 lib/ms/ident/protein.rb
mspire-0.6.21 lib/ms/ident/protein.rb
mspire-0.6.20 lib/ms/ident/protein.rb
mspire-0.6.19 lib/ms/ident/protein.rb
mspire-0.6.18 lib/ms/ident/protein.rb
mspire-0.6.12 lib/ms/ident/protein.rb
mspire-0.6.11 lib/ms/ident/protein.rb
mspire-0.6.9 lib/ms/ident/protein.rb
mspire-0.6.7 lib/ms/ident/protein.rb
mspire-0.6.6 lib/ms/ident/protein.rb