Class: Bio::FinishM::ConnectionInterpreter::Scaffold
- Inherits:
-
Object
- Object
- Bio::FinishM::ConnectionInterpreter::Scaffold
- Defined in:
- lib/assembly/connection_interpreter.rb
Instance Attribute Summary collapse
-
#circular ⇒ Object
Returns the value of attribute circular.
-
#contigs ⇒ Object
Returns the value of attribute contigs.
-
#gap_lengths ⇒ Object
Returns the value of attribute gap_lengths.
Instance Method Summary collapse
- #circular? ⇒ Boolean
-
#initialize ⇒ Scaffold
constructor
A new instance of Scaffold.
- #sequence(sequence_id_to_nucleotides_hash) ⇒ Object
Constructor Details
#initialize ⇒ Scaffold
Returns a new instance of Scaffold.
308 309 310 311 |
# File 'lib/assembly/connection_interpreter.rb', line 308 def initialize @contigs = [] @gap_lengths = [] end |
Instance Attribute Details
#circular ⇒ Object
Returns the value of attribute circular.
303 304 305 |
# File 'lib/assembly/connection_interpreter.rb', line 303 def circular @circular end |
#contigs ⇒ Object
Returns the value of attribute contigs.
301 302 303 |
# File 'lib/assembly/connection_interpreter.rb', line 301 def contigs @contigs end |
#gap_lengths ⇒ Object
Returns the value of attribute gap_lengths.
301 302 303 |
# File 'lib/assembly/connection_interpreter.rb', line 301 def gap_lengths @gap_lengths end |
Instance Method Details
#circular? ⇒ Boolean
304 305 306 |
# File 'lib/assembly/connection_interpreter.rb', line 304 def circular? @circular end |
#sequence(sequence_id_to_nucleotides_hash) ⇒ Object
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/assembly/connection_interpreter.rb', line 313 def sequence(sequence_id_to_nucleotides_hash) raise "Programming error" unless @contigs.length == @gap_lengths.length + 1 parts = [] add_sequence_of = lambda do |contig| seq = sequence_id_to_nucleotides_hash[contig.sequence_index] if contig.direction == true parts.push seq elsif contig.direction == false parts.push Bio::Sequence::NA.new(seq).reverse_complement.to_s.upcase else raise "Programming error" end end add_sequence_of.call @contigs[0] @gap_lengths.each_with_index do |gap_length, i| parts.push 'N'*gap_length add_sequence_of.call @contigs[i+1] end return parts.join('') end |