Class: Bio::Assembly::Ace::Contig
- Defined in:
- lib/bio-assembly/ace.rb
Overview
extend contig class and write ace specific methods for contig objects
Instance Attribute Summary
Attributes inherited from Contig
#from, #name, #orientation, #quality, #reads, #seq, #to
Instance Method Summary collapse
Methods inherited from Contig
#add_read, #each_read, #find_read_by_name, #find_reads_in_range, #initialize, #num_base_segments, #num_bases, #num_reads
Constructor Details
This class inherits a constructor from Bio::Assembly::Contig
Instance Method Details
#to_ace ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/bio-assembly/ace.rb', line 140 def to_ace ace = "" ace += ['CO', name, num_bases, num_reads, num_base_segments, orientation].join(' ') + "\n" ace += seq.to_s.gsub(Regexp.new(".{1,50}"), "\\0\n") + "\n" ace += "BQ\n" last_stop = quality.size - 1 (quality.size/50+1).times do |i| start = i * 50 stop = (i+1) * 50 - 1 stop = last_stop if stop > last_stop ace += ' ' + quality[start..stop].join(' ') + "\n" end ace += "\n" # holds BS data for reads bs_str = "" # holds RD, QA, and DS data for reads rest_str = "" @reads.values.sort.each do |read| ace += read.to_ace_af bs_str += read.to_ace_bs rest_str += read.to_ace_rest end # compile data in correct order ace += bs_str ace += "\n" ace += rest_str ace end |