Class: BlastTypeParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/gene_assembler/blast_type_parser.rb

Direct Known Subclasses

ParserBlast, ParserExonerate

Instance Attribute Summary

Attributes inherited from Parser

#dataset

Instance Method Summary collapse

Methods inherited from Parser

#create_dataset, #parse_file

Constructor Details

#initialize(contig_type, hit_type, file, all = FALSE) ⇒ BlastTypeParser

Returns a new instance of BlastTypeParser.



5
6
7
8
9
10
11
# 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

Instance Method Details

#load_dataset(data, contig_type, hit_type) ⇒ Object

Introduce datos del blast en clases contig/hit/hsp



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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) ⇒ Object



37
38
39
# File 'lib/gene_assembler/blast_type_parser.rb', line 37

def populate_extra_atributes(contig,item)

end