Sha256: bf3f395d8818b280e4e53d6efb2cbac2da50bfb430c3b5cc64b2338dcd4bc8e6

Contents?: true

Size: 846 Bytes

Versions: 21

Compression:

Stored size: 846 Bytes

Contents

module SequenceServer
  # Define BLAST::Query.
  module BLAST
    # Capture results per query of a BLAST search.
    # @member [String]     number
    # @member [String]     def
    # @member [Fixnum]     length
    # @member [Array(Hit)] hits
    Query = Struct.new(:report, :number, :def, :length, :hits) do
      def initialize(*args)
        args[1] = args[1].to_i
        if args[2] == 'No definition line' ||
           args[2] == 'unnamed protein product'
          args[2] = "Query_#{args[1]}"
        end
        args[3] = args[3].to_i
        @id, *rest = args[2].split
        @title = rest.join(' ')
        super
      end

      attr_reader :id, :title

      def to_json(*args)
        %i[number id title length hits].inject({}) do |h, k|
          h[k] = send(k)
          h
        end.to_json(*args)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
sequenceserver-3.1.3 lib/sequenceserver/blast/query.rb
sequenceserver-3.1.2 lib/sequenceserver/blast/query.rb
sequenceserver-3.1.1 lib/sequenceserver/blast/query.rb
sequenceserver-3.1.0 lib/sequenceserver/blast/query.rb
sequenceserver-3.0.1 lib/sequenceserver/blast/query.rb
sequenceserver-3.0 lib/sequenceserver/blast/query.rb
sequenceserver-2.2.0 lib/sequenceserver/blast/query.rb
sequenceserver-2.1.0 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.rc8 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.rc7 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.rc6 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.rc5 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.rc4 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.rc3 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.rc2 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.rc1 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.beta4 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.beta3 lib/sequenceserver/blast/query.rb
sequenceserver-2.0.0.beta1 lib/sequenceserver/blast/query.rb