Class: Scaffolder::Region::Sequence
- Inherits:
-
Scaffolder::Region
- Object
- Scaffolder::Region
- Scaffolder::Region::Sequence
- Defined in:
- lib/scaffolder/region/sequence.rb
Overview
Class for inserting fasta sequence into the genome scaffold. The #raw_sequence method is also responsible for applying each of the sequence inserts to the original sequence. The following example specifies the insertion of a sequence identified by the fasta header ‘sequence1’. The example also outlines and insert to be added to the sequence in the region between 3 and 10.
- sequence:
source: 'sequence1'
inserts:
-
source: 'insert1'
open: 3
close: 10
Instance Method Summary collapse
-
#inserts(inserts = nil) ⇒ Array
Array of inserts to add to this sequence.
-
#sequence_hook ⇒ String
Adds each of the sequence inserts to the raw sequence.
-
#source ⇒ String
Fasta identifier for this sequence.
Methods inherited from Scaffolder::Region
[], attribute, #entry_type, generate, #raw_sequence, #reverse, #sequence, #start, #stop
Instance Method Details
#inserts(inserts = nil) ⇒ Array
Array of inserts to add to this sequence. Each array entry may be either a Scaffolder::Region:Inserts or a corresponding to the attributes of an Insert. In the case of the latter each hash is used to generate a new Scaffolder::Region::Insert instance.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/scaffolder/region/sequence.rb', line 31 def inserts(inserts=nil) if inserts.nil? @inserts || Array.new else @inserts = inserts.map do |insert| if insert.instance_of? Insert insert else Insert.generate(insert) end end end end |
#sequence_hook ⇒ String
Adds each of the sequence inserts to the raw sequence. Updates the sequence length each time an insert is added to reflect the change.
54 55 56 |
# File 'lib/scaffolder/region/sequence.rb', line 54 def sequence_hook @updated_sequence ||= update_sequence_with_inserts end |
#source ⇒ String
Fasta identifier for this sequence
21 |
# File 'lib/scaffolder/region/sequence.rb', line 21 attribute :source |