Class: Sequence
- Inherits:
-
Object
- Object
- Sequence
- Defined in:
- lib/full_lengther_next/sequence.rb
Instance Attribute Summary collapse
-
#area_without_annotation ⇒ Object
Returns the value of attribute area_without_annotation.
-
#coverage_analysis ⇒ Object
Returns the value of attribute coverage_analysis.
-
#db ⇒ Object
Returns the value of attribute db.
-
#db_name ⇒ Object
Returns the value of attribute db_name.
-
#fasta_length ⇒ Object
Returns the value of attribute fasta_length.
-
#fpkm ⇒ Object
Returns the value of attribute fpkm.
-
#functional_annotations ⇒ Object
Returns the value of attribute functional_annotations.
-
#hit ⇒ Object
Returns the value of attribute hit.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ignore ⇒ Object
Returns the value of attribute ignore.
-
#orfs ⇒ Object
Returns the value of attribute orfs.
-
#save_fasta ⇒ Object
Returns the value of attribute save_fasta.
-
#seq_aa ⇒ Object
Returns the value of attribute seq_aa.
-
#seq_fasta ⇒ Object
Returns the value of attribute seq_fasta.
-
#seq_name ⇒ Object
Returns the value of attribute seq_name.
-
#seq_nt ⇒ Object
Returns the value of attribute seq_nt.
-
#status ⇒ Object
Returns the value of attribute status.
-
#t_code ⇒ Object
Returns the value of attribute t_code.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #add_orf(orf_seq, orf_t_start, orf_t_end, orf_q_frame, orf_stop_codon, orf_type) ⇒ Object
- #all_warns ⇒ Object
- #area_without_annotation? ⇒ Boolean
- #calification ⇒ Object
- #change_degenerated_nt! ⇒ Object
- #check_warn(warn) ⇒ Object
- #clean_annotations ⇒ Object
- #clean_orfs ⇒ Object
- #clean_warnings ⇒ Object
- #clone ⇒ Object
- #clone_annotations(array_annotations) ⇒ Object
- #clone_warnings(array_warnings) ⇒ Object
- #fix_degenerated_fasta!(translate_hash) ⇒ Object
- #format_chimera! ⇒ Object
- #get_acc ⇒ Object
- #get_fasta(seq) ⇒ Object
- #get_pident ⇒ Object
-
#initialize(seq_name, seq_fasta, seq_qual = '') ⇒ Sequence
constructor
A new instance of Sequence.
- #print_alignment(aa_align, nt_align, color, show_nts, mark_subzone = nil) ⇒ Object
- #prot_annot_calification ⇒ Object
- #reduce_coordinates(subzone_align, aa_align, h) ⇒ Object
- #reset_classification ⇒ Object
- #show_alignment(h, nts, show_nts, original_query_coordinates = nil) ⇒ Object
- #test_code(test_code) ⇒ Object
- #unmapped? ⇒ Boolean
- #warnings(warn) ⇒ Object
- #write_align(file) ⇒ Object
-
#write_chimera(file) ⇒ Object
TODO : write ‘SOLVED’ tag.
- #write_coding(file) ⇒ Object
-
#write_info(output_files) ⇒ Object
Output_files is a hash.
- #write_misassembled(file) ⇒ Object
- #write_ncrna(file) ⇒ Object
- #write_nt_seq(file) ⇒ Object
- #write_other(file) ⇒ Object
- #write_prot_annot(file) ⇒ Object
-
#write_prot_seq(file) ⇒ Object
Write complementary files.
- #write_unknown(file) ⇒ Object
- #write_unmapped(file) ⇒ Object
Constructor Details
#initialize(seq_name, seq_fasta, seq_qual = '') ⇒ Sequence
Returns a new instance of Sequence.
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 |
# File 'lib/full_lengther_next/sequence.rb', line 10 def initialize(seq_name, seq_fasta, seq_qual='') @seq_name = seq_name @seq_fasta = seq_fasta @fasta_length = seq_fasta.length @db_name = nil @seq_nt = nil # Unigen sequence with tagged ATG & stop @seq_aa = nil # Protein sequence generated over unigen @db =nil @type = UNKNOWN # See types.rb @status = false # true => Sure, false => Putative @id = nil #Prot or EST id, can be several => array @warnings = [] @annotations=[] @functional_annotations = {} @orfs=[] #Mapping_info @fpkm = [] @coverage_analysis = [] @area_without_annotation=false @save_fasta=true @ignore = false @hit=nil @t_code=0 end |
Instance Attribute Details
#area_without_annotation ⇒ Object
Returns the value of attribute area_without_annotation.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def area_without_annotation @area_without_annotation end |
#coverage_analysis ⇒ Object
Returns the value of attribute coverage_analysis.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def coverage_analysis @coverage_analysis end |
#db ⇒ Object
Returns the value of attribute db.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def db @db end |
#db_name ⇒ Object
Returns the value of attribute db_name.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def db_name @db_name end |
#fasta_length ⇒ Object
Returns the value of attribute fasta_length.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def fasta_length @fasta_length end |
#fpkm ⇒ Object
Returns the value of attribute fpkm.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def fpkm @fpkm end |
#functional_annotations ⇒ Object
Returns the value of attribute functional_annotations.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def functional_annotations @functional_annotations end |
#hit ⇒ Object
Returns the value of attribute hit.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def hit @hit end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def id @id end |
#ignore ⇒ Object
Returns the value of attribute ignore.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def ignore @ignore end |
#orfs ⇒ Object
Returns the value of attribute orfs.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def orfs @orfs end |
#save_fasta ⇒ Object
Returns the value of attribute save_fasta.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def save_fasta @save_fasta end |
#seq_aa ⇒ Object
Returns the value of attribute seq_aa.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def seq_aa @seq_aa end |
#seq_fasta ⇒ Object
Returns the value of attribute seq_fasta.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def seq_fasta @seq_fasta end |
#seq_name ⇒ Object
Returns the value of attribute seq_name.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def seq_name @seq_name end |
#seq_nt ⇒ Object
Returns the value of attribute seq_nt.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def seq_nt @seq_nt end |
#status ⇒ Object
Returns the value of attribute status.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def status @status end |
#t_code ⇒ Object
Returns the value of attribute t_code.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def t_code @t_code end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/full_lengther_next/sequence.rb', line 8 def type @type end |
Instance Method Details
#add_orf(orf_seq, orf_t_start, orf_t_end, orf_q_frame, orf_stop_codon, orf_type) ⇒ Object
38 39 40 41 |
# File 'lib/full_lengther_next/sequence.rb', line 38 def add_orf(orf_seq, orf_t_start, orf_t_end, orf_q_frame, orf_stop_codon, orf_type) orf = Orf.new(orf_seq, orf_t_start, orf_t_end, orf_q_frame, orf_stop_codon, orf_type) @orfs << orf end |
#all_warns ⇒ Object
201 202 203 204 |
# File 'lib/full_lengther_next/sequence.rb', line 201 def all_warns all = @warnings.join(' ') return all end |
#area_without_annotation? ⇒ Boolean
464 465 466 467 468 469 470 471 472 473 474 475 476 |
# File 'lib/full_lengther_next/sequence.rb', line 464 def area_without_annotation? if @hit.class == Array hit = @hit.first else hit = @hit end upstream_annotation_space = hit.q_beg downstream_annotation_space = @fasta_length - hit.q_end if upstream_annotation_space >= 150 || downstream_annotation_space >= 150 @area_without_annotation = true end return @area_without_annotation end |
#calification ⇒ Object
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/full_lengther_next/sequence.rb', line 282 def calification type_description = nil case @type when FAILED type_description = 'Failed' when OTHER type_description = 'Other' when UNMAPPED type_description = 'Unmapped' when CHIMERA type_description = 'Chimera' when MISASSEMBLED type_description = 'Misassembled' when UNKNOWN type_description = 'Unknown' when COMPLETE type_description = 'Complete' when N_TERMINAL type_description = 'N_terminal' when C_TERMINAL type_description = 'C_terminal' when INTERNAL type_description = 'Internal' when CODING type_description = 'Coding' when NCRNA type_description = 'NcRNA' end end |
#change_degenerated_nt! ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/full_lengther_next/sequence.rb', line 44 def change_degenerated_nt! translate_hash = {} translate_hash['R']= [['a','g'],0] translate_hash['W']= [['a','t'],0] translate_hash['M']= [['a','c'],0] translate_hash['K']= [['g','t'],0] translate_hash['S']= [['g','c'],0] translate_hash['Y']= [['c','t'],0] translate_hash['H']= [['a','t','c'],0] translate_hash['B']= [['g','t','c'],0] translate_hash['D']= [['g','a','t'],0] translate_hash['V']= [['g','a','c'],0] translate_hash['N']= [['g','a','c','t'],0] fix_degenerated_fasta!(translate_hash) end |
#check_warn(warn) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/full_lengther_next/sequence.rb', line 128 def check_warn(warn) check = warn replace = nil if warn.class.to_s == 'Array' check = warn.shift # Take warning tag message replace = warn # Take values to replace in message end = $warnings_hash[check] if .nil? = check # If not exists the message end if !replace.nil? = .dup # Duplicate memory to avoid overwrite original warning hash messages replace.each do |rep| .sub!('(*replace*)',"#{rep}") #message variable end end return end |
#clean_annotations ⇒ Object
96 97 98 |
# File 'lib/full_lengther_next/sequence.rb', line 96 def clean_annotations @annotations = [] end |
#clean_orfs ⇒ Object
83 84 85 |
# File 'lib/full_lengther_next/sequence.rb', line 83 def clean_orfs @orfs=[] end |
#clean_warnings ⇒ Object
92 93 94 |
# File 'lib/full_lengther_next/sequence.rb', line 92 def clean_warnings @warnings = [] end |
#clone ⇒ Object
478 479 480 481 482 483 484 485 486 |
# File 'lib/full_lengther_next/sequence.rb', line 478 def clone new_seq = self.dup new_seq.clean_annotations new_seq.clean_warnings new_seq.clean_orfs new_seq.clone_warnings(@warnings) new_seq.clone_annotations(@annotations) return new_seq end |
#clone_annotations(array_annotations) ⇒ Object
488 489 490 |
# File 'lib/full_lengther_next/sequence.rb', line 488 def clone_annotations(array_annotations) array_annotations.map{|annotation| @annotations << annotation.dup} end |
#clone_warnings(array_warnings) ⇒ Object
124 125 126 |
# File 'lib/full_lengther_next/sequence.rb', line 124 def clone_warnings(array_warnings) array_warnings.map{|warn| @warnings << warn.dup} end |
#fix_degenerated_fasta!(translate_hash) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/full_lengther_next/sequence.rb', line 63 def fix_degenerated_fasta!(translate_hash) s = @seq_fasta res = [] nts_of_a_line = s.split('') nts_of_a_line.map{|e| if (e =~ /[RWMKSYHBDVN]/) translate_hash[e][1] += 1 e = translate_hash[e][0][translate_hash[e][1]%translate_hash[e][0].length] end res << e } @seq_fasta=res.compact.join end |
#format_chimera! ⇒ Object
110 111 112 |
# File 'lib/full_lengther_next/sequence.rb', line 110 def format_chimera! @hit = [] end |
#get_acc ⇒ Object
100 101 102 103 |
# File 'lib/full_lengther_next/sequence.rb', line 100 def get_acc acc=hit.acc return acc end |
#get_fasta(seq) ⇒ Object
157 158 159 160 |
# File 'lib/full_lengther_next/sequence.rb', line 157 def get_fasta(seq) fasta = ">#{@seq_name}\n#{seq}" return fasta end |
#get_pident ⇒ Object
105 106 107 108 |
# File 'lib/full_lengther_next/sequence.rb', line 105 def get_pident pident=hit.ident return pident end |
#print_alignment(aa_align, nt_align, color, show_nts, mark_subzone = nil) ⇒ Object
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/full_lengther_next/sequence.rb', line 375 def print_alignment(aa_align, nt_align, color, show_nts, mark_subzone = nil) original_color = color c={ 'GCT'=>'A','GCC'=>'A','GCA'=>'A','GCG'=>'A', 'CGT'=>'R','CGC'=>'R','CGA'=>'R','CGG'=>'R','AGA'=>'R','AGG'=>'R', 'AAT'=>'N','AAC'=>'N', 'GAT'=>'D','GAC'=>'D', 'TGT'=>'C','TGC'=>'C', 'CAA'=>'Q','CAG'=>'Q', 'GAA'=>'E','GAG'=>'E', 'GGT'=>'G','GGC'=>'G','GGA'=>'G','GGG'=>'G', 'CAT'=>'H','CAC'=>'H', 'ATT'=>'I','ATC'=>'I','ATA'=>'I', 'TTA'=>'L','TTG'=>'L','CTT'=>'L','CTC'=>'L','CTA'=>'L','CTG'=>'L', 'ATG'=>'M', 'AAA'=>'K','AAG'=>'K', 'TTT'=>'F','TTC'=>'F', 'CCT'=>'P','CCC'=>'P','CCA'=>'P','CCG'=>'P', 'TCT'=>'S','TCC'=>'S','TCA'=>'S','TCG'=>'S','AGT'=>'S','AGC'=>'S', 'ACT'=>'T','ACC'=>'T','ACA'=>'T','ACG'=>'T', 'TGG'=>'W', 'TAT'=>'Y','TAC'=>'Y', 'GTT'=>'V','GTC'=>'V','GTA'=>'V','GTG'=>'V', 'TAG'=>'*','TGA'=>'*','TAA'=>'*'} nt_line = '' aa_line = '' gaps = 0 count = 0 aa_align.each_with_index do |aa, n| if aa == '-' nt_line << '---' gaps += 1 else # Check aa with codon codon_window = (n-gaps)*3 codon = nt_align[codon_window..codon_window+2] nt_line << "#{codon}" if aa.upcase != 'X' if codon.upcase.include?('N') traslated_aa = '-' else traslated_aa = c[codon] end if traslated_aa != '-' && traslated_aa != aa puts "#{traslated_aa} #{aa}" aa = '?' end end end if !mark_subzone.nil? nts_coordenate = (n-gaps)*3 mark_subzone.values.each do |subzone| if nts_coordenate >= subzone[0] && nts_coordenate <= subzone[1] #0 => first coordenate, 1 => second coordenate color = subzone.last end end end space = nil if show_nts space = ' ' end aa_line << "\e[#{color}m#{space}#{aa}#{space}\e[0m" color = original_color line_length = 60 if (n+1) % line_length == 0 || n+1 == aa_align.length count = n + 1 print "#{count}\t" puts aa_line if show_nts print "#{count*3}\t" puts nt_line end aa_line = '' nt_line = '' end end end |
#prot_annot_calification ⇒ Object
313 314 315 316 317 318 319 320 321 |
# File 'lib/full_lengther_next/sequence.rb', line 313 def prot_annot_calification info = "#{calification} " if @status info << 'Sure' else info << 'Putative' end return info end |
#reduce_coordinates(subzone_align, aa_align, h) ⇒ Object
454 455 456 457 458 459 460 461 462 |
# File 'lib/full_lengther_next/sequence.rb', line 454 def reduce_coordinates(subzone_align, aa_align, h) if !subzone_align.nil? aligned = 3 * aa_align.length + h.q_frame-1 subzone_align.values.each do |subzone| subzone[0]-= aligned subzone[1]-= aligned end end end |
#reset_classification ⇒ Object
87 88 89 90 |
# File 'lib/full_lengther_next/sequence.rb', line 87 def reset_classification @type = UNKNOWN @status = false end |
#show_alignment(h, nts, show_nts, original_query_coordinates = nil) ⇒ Object
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/full_lengther_next/sequence.rb', line 323 def show_alignment(h, nts, show_nts, original_query_coordinates = nil) puts "Prot id:\t#{h.acc}", "Alignment length:\t#{h.align_len} aa", "Subject length:\t#{h.s_len} aa", "Query length:\t#{nts.length/3} aa" puts prot_annot_calification puts aa_unigen = nts[h.q_frame - 1 .. nts.length-1].translate index = contenidos_en_prot(h.q_seq, aa_unigen) # View desplacements 5-prime/align/3-prime subzone_align = nil if !original_query_coordinates.nil? subzone_align = {} if h.q_beg > original_query_coordinates.first #alignment has transferred characters to 5 prime subzone_align['beg'] = [original_query_coordinates.first, h.q_beg-3, 42] # -3 to exclude the last aa elsif h.q_beg < original_query_coordinates.first subzone_align['beg'] = [h.q_beg, original_query_coordinates.first-3, 46] #alignment has received characters from 5 prime end if h.q_end < original_query_coordinates.last #alignment has transferred characters to 3 prime subzone_align['end'] = [h.q_end, original_query_coordinates.last, 42] elsif h.q_end > original_query_coordinates.last subzone_align['end'] = [original_query_coordinates.last, h.q_end, 43] #alignment has received characters from 3 prime end end # Print 5 prime if index > 0 # 5 prime exists aa_align = aa_unigen[0 .. index-1].split('') nt_align = nts[h.q_frame-1..h.q_beg-1] print_alignment(aa_align, nt_align, 36, show_nts, subzone_align) reduce_coordinates(subzone_align, aa_align, h) end # Print core alignment or protein aa_align = h.q_seq.split('') nt_align = nts[h.q_beg..h.q_end] print_alignment(aa_align, nt_align, 32, show_nts, subzone_align) reduce_coordinates(subzone_align, aa_align, h) # Print 3 prime gaps = h.q_seq.count('-') three_prime_beg = index+h.q_seq.length-gaps if aa_unigen.length > three_prime_beg # 3 prime exists aa_align = aa_unigen[three_prime_beg .. aa_unigen.length-1].split('') fs = check_frame_shift(h) nt_align = nts[h.q_end+1-fs..nts.length-1] print_alignment(aa_align, nt_align, 33, show_nts, subzone_align) end end |
#test_code(test_code) ⇒ Object
150 151 152 153 154 155 |
# File 'lib/full_lengther_next/sequence.rb', line 150 def test_code(test_code) @t_code = test_code if @t_code >= 0.95 @status = true end end |
#unmapped? ⇒ Boolean
492 493 494 495 496 |
# File 'lib/full_lengther_next/sequence.rb', line 492 def unmapped? res = false res = true if !@coverage_analysis.empty? && @coverage_analysis[3] == 0 #3 => percentage of sequence covered by reads return res end |
#warnings(warn) ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'lib/full_lengther_next/sequence.rb', line 114 def warnings(warn) if warn.class.to_s == 'Array' warn.each do |w| @warnings << check_warn(w) end else @warnings << check_warn(warn) end end |
#write_align(file) ⇒ Object
265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/full_lengther_next/sequence.rb', line 265 def write_align(file) tabs = (seq_name.length/8).ceil if tabs == 0 tabs = 1 end second_tab = 0 if seq_name.length > 7 second_tab = 1 end file.puts "#{@seq_name}#{"\t"*tabs}#{@hit.q_seq}\n#{@hit.acc}#{"\t"*(tabs+second_tab)}#{@hit.s_seq}" file.puts end |
#write_chimera(file) ⇒ Object
TODO : write ‘SOLVED’ tag
214 215 216 217 218 219 |
# File 'lib/full_lengther_next/sequence.rb', line 214 def write_chimera(file) #TODO : write 'SOLVED' tag @hit.each do |h| file.puts "#{@seq_name}\t#{@fasta_length}\t#{h.acc}\t#{@db_name}\t#{h.q_frame}\t#{h.e_val}\t#{h.ident}\t#{h.q_beg + 1}\t#{h.q_end + 1}\t#{h.s_beg + 1}\t#{h.s_end + 1}\t#{h.definition}" end file.puts end |
#write_coding(file) ⇒ Object
251 252 253 254 255 256 257 258 |
# File 'lib/full_lengther_next/sequence.rb', line 251 def write_coding(file) # ħit is an array. 2 => q_frame, 1 ORF end, 0 ORF beg calification = 'Putative' if @status calification = 'Sure' end file.puts "#{@seq_name}\t#{@fasta_length}\t#{calification}\t#{@t_code}\t#{@hit.last}\t#{@hit.first}\t#{@hit[1]}" end |
#write_info(output_files) ⇒ Object
Output_files is a hash
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/full_lengther_next/sequence.rb', line 162 def write_info(output_files) # Output_files is a hash if @save_fasta output_files['seqs'].puts get_fasta(@seq_fasta) end if !@fpkm.empty? output_files['fpkm'].puts "#{@seq_name}\t#{@fpkm.join("\t")}" end if !@coverage_analysis.empty? all_coverages = @coverage_analysis.last output_files['coverage'].puts "#{@seq_name}\t#{@coverage_analysis[0..@coverage_analysis.length-1].join("\t")}" end case @type when OTHER write_other(output_files[@type]) when CHIMERA write_chimera(output_files[@type]) when UNMAPPED write_unmapped(output_files[@type]) when MISASSEMBLED write_misassembled(output_files[@type]) when UNKNOWN write_unknown(output_files[@type]) when COMPLETE .. INTERNAL write_prot_annot(output_files['db']) write_prot_seq(output_files['prot']) write_nt_seq(output_files['nts']) write_align(output_files['align']) when NCRNA write_ncrna(output_files[@type]) when CODING write_coding(output_files[@type]) else if @type != FAILED raise "#{@type} is an incorrect type" end end end |
#write_misassembled(file) ⇒ Object
221 222 223 |
# File 'lib/full_lengther_next/sequence.rb', line 221 def write_misassembled(file) file.puts "#{@seq_name}\t#{@fasta_length}\t#{@hit.acc}\t#{@db_name}" end |
#write_ncrna(file) ⇒ Object
247 248 249 |
# File 'lib/full_lengther_next/sequence.rb', line 247 def write_ncrna(file) file.puts "#{@seq_name}\t#{@fasta_length}\t#{@hit.acc}\t#{@hit.e_val}\t#{@hit.ident}\t#{@hit.q_beg + 1}\t#{@hit.q_end + 1}\t#{@hit.s_beg + 1}\t#{@hit.s_end + 1}\t#{@hit.definition}" end |
#write_nt_seq(file) ⇒ Object
278 279 280 |
# File 'lib/full_lengther_next/sequence.rb', line 278 def write_nt_seq(file) file.puts "#{@seq_name}\t#{@fasta_length}\t#{@seq_nt}" end |
#write_other(file) ⇒ Object
206 207 208 |
# File 'lib/full_lengther_next/sequence.rb', line 206 def write_other(file) file.puts "#{@seq_name}\t#{@fasta_length}\t#{@hit.acc}\t#{@db_name}\t#{all_warns}" end |
#write_prot_annot(file) ⇒ Object
239 240 241 242 243 244 245 |
# File 'lib/full_lengther_next/sequence.rb', line 239 def write_prot_annot(file) final_func_annot = Array.new(9, '-') if !@functional_annotations.empty? final_func_annot = @functional_annotations.values end file.puts "#{@seq_name}\t#{@fasta_length}\t#{@hit.acc}\t#{@db_name}\t#{prot_annot_calification}\t#{@hit.e_val}\t#{@hit.ident}\t#{@hit.full_subject_length}\t#{@seq_aa.length}\t#{all_warns}\t#{@hit.q_frame}\t#{@hit.q_beg + 1}\t#{@hit.q_end + 1}\t#{@hit.s_beg + 1}\t#{@hit.s_end + 1}\t#{@hit.definition}\t#{final_func_annot.join("\t")}" end |
#write_prot_seq(file) ⇒ Object
Write complementary files
261 262 263 |
# File 'lib/full_lengther_next/sequence.rb', line 261 def write_prot_seq(file) file.puts get_fasta(@seq_aa) end |
#write_unknown(file) ⇒ Object
225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/full_lengther_next/sequence.rb', line 225 def write_unknown(file) # ħit is an array. 2 => q_frame, 1 ORF end, 0 ORF beg if hit.class.to_s == 'Array' orf_beg = @hit[0] orf_end = @hit[1] q_frame = @hit[2] else orf_beg = '-' orf_end = '-' q_frame = '-' end file.puts "#{@seq_name}\t#{@fasta_length}\t#{@t_code}\t#{all_warns}\t#{q_frame}\t#{orf_beg}\t#{orf_end}" end |
#write_unmapped(file) ⇒ Object
210 211 212 |
# File 'lib/full_lengther_next/sequence.rb', line 210 def write_unmapped(file) file.puts "#{@seq_name}\t#{@fasta_length}" end |