Class: Bio::FinishM::ScaffoldBreaker::Scaffold
- Inherits:
-
Object
- Object
- Bio::FinishM::ScaffoldBreaker::Scaffold
- Defined in:
- lib/assembly/scaffold_breaker.rb
Instance Attribute Summary collapse
-
#contigs ⇒ Object
unscaffolded contigs from this scaffold, as an array in sorted order.
-
#name ⇒ Object
Name of sequence found in the fasta file.
Instance Method Summary collapse
-
#contig_number(contig) ⇒ Object
Which contig number is this, in the scaffold?.
-
#gaps ⇒ Object
Return an array of Gap objects.
- #sequence ⇒ Object
Instance Attribute Details
#contigs ⇒ Object
unscaffolded contigs from this scaffold, as an array in sorted order.
31 32 33 |
# File 'lib/assembly/scaffold_breaker.rb', line 31 def contigs @contigs end |
#name ⇒ Object
Name of sequence found in the fasta file
34 35 36 |
# File 'lib/assembly/scaffold_breaker.rb', line 34 def name @name end |
Instance Method Details
#contig_number(contig) ⇒ Object
Which contig number is this, in the scaffold?
72 73 74 75 76 77 |
# File 'lib/assembly/scaffold_breaker.rb', line 72 def contig_number(contig) @contigs.each_with_index do |current_contig, i| return i if contig==current_contig end raise "Contig not found in scaffold" end |
#gaps ⇒ Object
Return an array of Gap objects
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/assembly/scaffold_breaker.rb', line 37 def gaps gaps = [] last_contig = nil @contigs.each_with_index do |contig, i| if i!=0 gap = Bio::FinishM::ScaffoldBreaker::Gap.new gap.scaffold = self gap.start = last_contig.scaffold_position_end + 1 gap.stop = contig.scaffold_position_start - 1 gap.number = i-1 gaps.push gap end last_contig = contig end return gaps end |
#sequence ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/assembly/scaffold_breaker.rb', line 54 def sequence to_return = [] last_contig = nil @contigs.each_with_index do |contig, i| if i==0 to_return.push contig.sequence else gap_start = last_contig.scaffold_position_end + 1 gap_stop = contig.scaffold_position_start - 1 to_return.push 'N'*(gap_stop-gap_start+1) to_return.push contig.sequence end last_contig = contig end return to_return.join end |