Class: GffHit

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

Instance Method Summary collapse

Instance Method Details

#report(hit, parent, seqid, id, name_mode, seq) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gene_assembler/gff_hit.rb', line 4

def report(hit,parent,seqid,id,name_mode,seq)
	hit_text=[]
	feature_parent=hit.name #Parent par las demas caracteristicas
	if name_mode=='l'
		feature_parent=feature_parent+'_'+hit.type
	end
	parent_tag=nil
	if !parent.nil?# si hay parent, hit se comporta como una estructura tipo proteina, o secuencia nucleotidica. En caso contrario pasara a ser un contig hijo de otro contig ya escrito
		parent_tag="Parent=#{parent};"
		name=hit.name
		feature_parent=id
	else
		name=id
		feature_parent=id			
	end
	hit_seq=nil
	if !seq.nil?
		hit_seq="seq=#{seq};"
	end
	strand='+'
	if hit.reversed
		strand='-'
	end
	ident="Perc_Qidentities=#{hit.q_p_ident};"
	if hit.q_p_ident.nil?
		ident=nil
	end
	conserved="Perc_Qconserved=#{hit.q_p_conserved};"
	if hit.q_p_conserved.nil?
		conserved=nil
	end
	description=nil
	if !hit.description.nil?
		description="Note=#{hit.description.gsub(';','_')};"	
	end
	if hit.source.nil?
		hit.source='Unknown'
	end
	text="#{seqid}\t#{hit.source}\t#{hit.type}\t#{hit.first_hsp.q_beg}\t#{hit.last_hsp.q_end}\t.\t#{strand}\t.\tID=#{name};#{parent_tag}Name=#{name};#{hit_seq}#{description}#{ident}#{conserved}"
	hit_text << text
	gff_hsp=GffHsp.new
	if hit.hsp_count>1 #Desarrollar si el hit presenta varias coincidencias parciales
		hit.each_hsp_with_index{|hsp,n|
			hit_text << gff_hsp.report(hsp,name,seqid,n,hit.type,hit.source)
		}
	end
	return hit_text,feature_parent
end