<commit_before>module Bio

class Sequence

# Amino Acid sequence

class AA < String

  include Bio::Sequence::Common

  # Generate a amino acid sequence object from a string.
  def initialize(str)
    super
    self.upcase!
    self.tr!(" \t\n\r",'')
  end

  # Estimate the weight of this protein.
  # AminoAcid is defined in bio/data/aa.rb
  def molecular_weight
    AminoAcid.weight(self)
  end

  def to_re
    AminoAcid.to_re(self)
  end

  # Generate the list of the names of the each residue along with the
  # sequence (3 letters code).
  def codes
    array = []
    self.each_byte do |x|
      array.push(AminoAcid.names[x.chr])
    end
    return array
  end

  # Similar to codes but returns long names.
  def names
    self.codes.map do |x|
      AminoAcid.names[x]
    end
  end

end # AA

end # Sequence

end # Bio<commit_msg>* added RDoc header with Ruby's license * changed to use autoload * use Bio::AminoAcid explicitly instead of AminoAcid<commit_after>#
# = bio/sequence/aa.rb - amino acid sequence class
#
# Copyright::   Copyright (C) 2006
#               <NAME> <<EMAIL>>
# License::     Ruby's
#
# $Id: aa.rb,v 1.2 2006/02/06 14:11:31 k Exp $
#

require 'bio/sequence/common'

module Bio

  autoload :AminoAcid, 'bio/data/aa'

class Sequence


# Amino Acid sequence
class AA < String

  include Bio::Sequence::Common

  # Generate a amino acid sequence object from a string.
  def initialize(str)
    super
    self.upcase!
    self.tr!(" \t\n\r",'')
  end


  # Estimate the weight of this protein.
  def molecular_weight
    Bio::AminoAcid.weight(self)
  end

  def to_re
    Bio::AminoAcid.to_re(self)
  end

  # Generate the list of the names of the each residue along with the
  # sequence (3 letters code).
  def codes
    array = []
    self.each_byte do |x|
      array.push(Bio::AminoAcid.names[x.chr])
    end
    return array
  end

  # Similar to codes but returns long names.
  def names
    self.codes.map do |x|
      Bio::AminoAcid.names[x]
    end
  end

end # AA

end # Sequence

end # Bio

{'fraction_non_alphanumeric': 0.09591736350221347, 'fraction_numerical': 0.010821446138711265, 'mean_word_length': 2.7252747252747254, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5249296', 'n_tokens_mistral': 752, 'n_tokens_neox': 704, 'n_words': 228}