class BlastTypeParser

Public Class Methods

new(contig_type,hit_type,file,all=FALSE) click to toggle source
# File lib/gene_assembler/blast_type_parser.rb, line 5
    def initialize(contig_type,hit_type,file,all=FALSE)
@file=file
            @dataset=create_dataset
            @all=all
            data=parse_file(file)
            load_dataset(data,contig_type,hit_type)
    end

Public Instance Methods

load_dataset(data,contig_type,hit_type) click to toggle source
# File lib/gene_assembler/blast_type_parser.rb, line 13
def load_dataset(data,contig_type,hit_type) # Introduce datos del blast en clases contig/hit/hsp
  data.querys.each do |item|
       if item.hits.empty? #Descartamos querys q no hayan dado nigun match
               next
       end
    contig=@dataset.add_contig(item.query_def) #query_def -> nombre de la query (nuestro contig)
    contig.length=item.full_query_length #full_query_length -> longitud de la query
    contig.type=contig_type
    populate_extra_atributes(contig,item)    
    
    last_hit_name=''
    hit=''
    item.hits.each do |ht| #Clasificacion hits del blast en hits-hsps
      if ht.subject_id != last_hit_name #Hit
       hit=contig.add_hit(ht.subject_id, ht.full_subject_length, ht.q_frame, hit_type)
      end
      hsp=hit.add_hsp(ht.q_beg+1, ht.q_end+1, ht.s_beg+1, ht.s_end+1, ht.align_len, ht.score, ht.ident, ht.gaps) # +1 xq gema parser blast resta 1 a todo
      hsp.type='match_part'   
      last_hit_name=ht.subject_id
    end
    contig.hits_sort!
  end    
end
populate_extra_atributes(contig,item) click to toggle source
# File lib/gene_assembler/blast_type_parser.rb, line 37
def populate_extra_atributes(contig,item)

end