class Hit
Attributes
description[RW]
e_value[RW]
hsps[RW]
name[RW]
q_p_conserved[RW]
q_p_ident[RW]
reversed[RW]
s_length[RW]
source[RW]
type[RW]
Public Class Methods
new(hit_name, s_length, q_frame, type)
click to toggle source
# File lib/gene_assembler/hit.rb, line 4 def initialize (hit_name, s_length, q_frame, type) @name=hit_name #Nombre tomado del subject_id #@s_seq=s_seq #Secuencia del subject #@q_seq=q_seq #Secuencia del query @s_length=s_length # Longitud total del subject @hsps=[] if q_frame>0 @reversed=FALSE else @reversed=TRUE end @type=type @source=nil @description=nil @e_value=nil @q_p_ident=nil @q_p_conserved=nil end
Public Instance Methods
add_hsp(q_beg, q_end, s_beg, s_end, align_len, score, ident, gaps)
click to toggle source
# File lib/gene_assembler/hit.rb, line 24 def add_hsp(q_beg, q_end, s_beg, s_end, align_len, score, ident, gaps) hsp= Hsp.new(q_beg, q_end, s_beg, s_end, align_len, score, ident, gaps) @hsps << hsp return hsp end
correct_hsps(blast_coor_type)
click to toggle source
# File lib/gene_assembler/hit.rb, line 148 def correct_hsps(blast_coor_type)# 's' => subject, 'q' => query # puts self.inspect if hsp_count>1 delete_hsps=[] each_hsp_with_index{|hsp,i| each_hsp_with_index{|hsp_second,j| if i==j next end # puts hsp.compare(hsp_second) compare=nil if blast_coor_type == 's' compare = hsp.compare(hsp_second) else compare = hsp.compare_q(hsp_second) end if compare >= 0.9 if hsp.score == hsp_second.score # En caso de hsps con scores iguales, nos quedamos con el mas pequeño if hsp.align_len == hsp_second.align_len # Si dos hsps son exactamente iguales eliminamos el segundo delete_hsps << j elsif hsp.align_len < hsp_second.align_len delete_hsps << j else delete_hsps << i end elsif hsp.score > hsp_second.score delete_hsps << j else delete_hsps << i end end } } delete_hsps.uniq! delete_hsps.reverse_each do |hsp| drop_hsp(hsp) end end end
drop_hsp(position)
click to toggle source
# File lib/gene_assembler/hit.rb, line 188 def drop_hsp(position) hsps.delete_at(position) end
each_hsp() { |hsp| ... }
click to toggle source
# File lib/gene_assembler/hit.rb, line 30 def each_hsp @hsps.each do |hsp| yield hsp end end
each_hsp_with_index() { |hsp,i| ... }
click to toggle source
# File lib/gene_assembler/hit.rb, line 47 def each_hsp_with_index @hsps.each_with_index do |hsp,i| yield hsp,i end end
first_hsp()
click to toggle source
# File lib/gene_assembler/hit.rb, line 65 def first_hsp h=nil each_hsp{|hit| h=hit break } return h end
hsp_at(n)
click to toggle source
# File lib/gene_assembler/hit.rb, line 36 def hsp_at(n) hsp_at=nil each_hsp_with_index{|hsp,i| if n==i hsp_at=hsp break end } return hsp_at end
hsp_count()
click to toggle source
# File lib/gene_assembler/hit.rb, line 57 def hsp_count n=0 each_hsp{|hsp| n+=1 } return n end
hsp_minor_than?(hsp_length)
click to toggle source
# File lib/gene_assembler/hit.rb, line 137 def hsp_minor_than?(hsp_length)# En nt minor=FALSE each_hsp {|hsp| if hsp.length_q < hsp_length minor=TRUE break end } return minor end
hsp_overlap()
click to toggle source
# File lib/gene_assembler/hit.rb, line 111 def hsp_overlap overlap=[] last_hsp=nil each_hsp_with_index{|hsp,i| if i>0 diference=hsp.overlap_with(last_hsp) if diference<0 overlap << diference end end last_hsp=hsp } return overlap end
hsps_correlative?()
click to toggle source
# File lib/gene_assembler/hit.rb, line 82 def hsps_correlative? # Ver si los hsps del hit son contiguos en la query is_correlative=FALSE ends=0 each_hsp_with_index{|hsp,i| if i==0 ends=hsp.q_end next end if (ends-hsp.q_beg).abs>3 is_correlative=TRUE break end ends=hsp.q_end } return is_correlative end
hsps_sort!()
click to toggle source
# File lib/gene_assembler/hit.rb, line 53 def hsps_sort! # Se ordenan los hsps en base a posicion en el subject @hsps.sort!{|e1,e2| e1.s_beg<=>e2.s_beg} end
last_hsp()
click to toggle source
# File lib/gene_assembler/hit.rb, line 74 def last_hsp h=nil each_hsp{|hit| h=hit } return h end
modified_coordenates(add)
click to toggle source
# File lib/gene_assembler/hit.rb, line 99 def modified_coordenates(add) each_hsp{|hsp| hsp.modified_coordenates(add) } end
overlap_with(last_hit)
click to toggle source
# File lib/gene_assembler/hit.rb, line 126 def overlap_with(last_hit) overlap=0 if self.name==last_hit.name diference=self.first_hsp.overlap_with(last_hit.last_hsp) if diference<0 overlap=diference end end return overlap end
rev_coord(contig_length)
click to toggle source
# File lib/gene_assembler/hit.rb, line 105 def rev_coord(contig_length) each_hsp{|hsp| hsp.rev_coord(contig_length) } end