Sha256: 5ea9682917e8fe25189b8ec4cd9f03224103990719803ecc9e31e8e21f4781db

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

module GeneValidator
  # This is a class for the storing data on each sequence
  class Query
    attr_accessor :type # protein | mRNA
    attr_accessor :definition
    attr_accessor :identifier
    attr_accessor :species
    attr_accessor :accession_no
    attr_accessor :length_protein
    attr_accessor :reading_frame
    attr_accessor :hsp_list # array of Hsp objects

    attr_accessor :raw_sequence
    attr_accessor :protein_translation # used only for nucleotides
    attr_accessor :nucleotide_rf # used only for nucleotides

    def initialize
      @hsp_list            = []
      @raw_sequence        = nil
      @protein_translation = nil
      @nucleotide_rf       = nil
    end

    def protein_translation
      (@type == :protein) ? raw_sequence : @protein_translation
    end

    ##
    # Initializes the corresponding attribute of the sequence
    # with respect to the column name of the tabular blast output
    def init_tabular_attribute(hash)
      @identifier     = hash['sseqid'] if hash['sseqid']
      @accession_no   = hash['sacc'] if hash['sacc']
      @length_protein = hash['slen'].to_i if hash['slen']
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
genevalidator-1.6.12 lib/genevalidator/query.rb
genevalidator-1.6.11 lib/genevalidator/query.rb
genevalidator-1.6.10 lib/genevalidator/query.rb
genevalidator-1.6.9 lib/genevalidator/query.rb
genevalidator-1.6.8 lib/genevalidator/query.rb
genevalidator-1.6.6 lib/genevalidator/query.rb
genevalidator-1.6.5 lib/genevalidator/query.rb
genevalidator-1.6.4 lib/genevalidator/query.rb
genevalidator-1.6.3 lib/genevalidator/query.rb