<commit_before>#
# = bio/appl/mafft/report.rb - MAFFT report class
#
# Copyright:: Copyright (C) 2003 <NAME> <<EMAIL>>
# License::   Ruby's
#
#  $Id: report.rb,v 1.10 2006/12/14 15:22:05 ngoto Exp $
#
# MAFFT result parser class.
# MAFFT is a very fast multiple sequence alignment software.
#
# Since a result of MAFFT is simply a multiple-fasta format,
# the significance of this class is to keep standard form and
# interface between Bio::ClustalW::Report.
#
# == References
#
# * <NAME>, <NAME>, <NAME> and <NAME>.
#   MAFFT: a novel method for rapid multiple sequence alignment based
#   on fast Fourier transform. Nucleic Acids Res. 30: 3059-3066, 2002.
#   http://nar.oupjournals.org/cgi/content/abstract/30/14/3059
# * http://www.biophys.kyoto-u.ac.jp/~katoh/programs/align/mafft/
#

require 'bio/db/fasta'
require 'bio/io/flatfile'
require 'bio/appl/mafft'

module Bio
  class MAFFT

    # MAFFT result parser class.
    # MAFFT is a very fast multiple sequence alignment software.
    #
    # Since a result of MAFFT is simply a multiple-fasta format,
    # the significance of this class is to keep standard form and
    # interface between Bio::ClustalW::Report.
    class Report

      # Creates a new Report object.
      # +ary+ should be an Array of Bio::FastaFormat.
      # +seqclass+ should on of following:
      # Class:  Bio::Sequence::AA, Bio::Sequence::NA, ...
      # String: 'PROTEIN', 'DNA', ...
      def initialize(ary, seqclass = nil)
        @data = ary
        @align = nil
        case seqclass
        when /PROTEIN/i
          @seqclass = Bio::Sequence::AA
        when /[DR]NA/i
          @seqclass = Bio::Sequence::NA
        else
          if seqclass.is_a?(Module) then
            @seqclass = seqclass
          else
            @seqclass = Bio::Sequence
          end
        end<commit_msg>INCOMAPTIBLE CHANGE: Bio::MAFFT::Report#initialize now gets string of multi-fasta formmatted text instead of Array.<commit_after>#
# = bio/appl/mafft/report.rb - MAFFT report class
#
# Copyright:: Copyright (C) 2003 <NAME> <<EMAIL>>
# License::   Ruby's
#
#  $Id: report.rb,v 1.11 2006/12/15 16:23:18 ngoto Exp $
#
# MAFFT result parser class.
# MAFFT is a very fast multiple sequence alignment software.
#
# Since a result of MAFFT is simply a multiple-fasta format,
# the significance of this class is to keep standard form and
# interface between Bio::ClustalW::Report.
#
# == References
#
# * <NAME>, <NAME>, <NAME> and <NAME>.
#   MAFFT: a novel method for rapid multiple sequence alignment based
#   on fast Fourier transform. Nucleic Acids Res. 30: 3059-3066, 2002.
#   http://nar.oupjournals.org/cgi/content/abstract/30/14/3059
# * http://www.biophys.kyoto-u.ac.jp/~katoh/programs/align/mafft/
#

require 'stringio'
require 'bio/db/fasta'
require 'bio/io/flatfile'
require 'bio/appl/mafft'

module Bio
  class MAFFT

    # MAFFT result parser class.
    # MAFFT is a very fast multiple sequence alignment software.
    #
    # Since a result of MAFFT is simply a multiple-fasta format,
    # the significance of this class is to keep standard form and
    # interface between Bio::ClustalW::Report.
    class Report

      # Creates a new Report object.
      # +str+ should be multi-fasta formatted text as a string.
      # +seqclass+ should on of following:
      # Class:  Bio::Sequence::AA, Bio::Sequence::NA, ...
      # String: 'PROTEIN', 'DNA', ...
      #
      # Compatibility Note: the old usage (to get array of Bio::FastaFormat
      # objects) is deprecated.
      def initialize(str, seqclass = nil)
        if str.is_a?(Array) then
          warn "Array of Bio::FastaFormat objects will be no longer accepted."
          @data = str
        else
          ff = Bio::FlatFile.new(Bio::FastaFormat, StringIO.new(str))
          @data = ff.to_a
        end
        @align = nil
        case seqclass
        when /PROTEIN/i
          @seqclass = Bio::Sequence::AA
        when /[DR]NA/i
          @seqclass = Bio::Sequence::NA
        else
          if seqclass.is_a?(Module) then
            @seqclass = seqclass
          else
            @seqclass = Bio::Sequence
          end
        end
{'fraction_non_alphanumeric': 0.11245173745173745, 'fraction_numerical': 0.020752895752895753, 'mean_word_length': 2.6043478260869564, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '747948', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1309, 'n_words': 420}