Class: Scaffolder::Region::Insert
- Inherits:
-
Scaffolder::Region
- Object
- Scaffolder::Region
- Scaffolder::Region::Insert
- Defined in:
- lib/scaffolder/region/insert.rb
Overview
Inserts are used to additional usually smaller sequences to larger sequences. The attributes in the sequence class are used to specify where the host sequence is ‘opened’ and ‘closed’ to add the insert. Either one of these two attributes may be ommitted. Omitting the ‘open’ attribute will cause the insert open position to be calculated based on the close minus the sequence length. The reverse is true if the close position is ommittted.
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Inserts are comparable by close position.
-
#close ⇒ Integer
End position where insert is added.
-
#open ⇒ Integer
Open position where insert is added.
-
#position ⇒ Range
Insertion position as a Range.
-
#size_diff ⇒ Integer
The difference in the insert sequence size and the insert location.
-
#source ⇒ String
Fasta identifier for the insert sequence.
Methods inherited from Scaffolder::Region
[], attribute, #entry_type, generate, #raw_sequence, #reverse, #sequence, #sequence_hook, #start, #stop
Instance Method Details
#<=>(other) ⇒ Integer
Inserts are comparable by close position.
47 48 49 |
# File 'lib/scaffolder/region/insert.rb', line 47 def <=>(other) self.close <=> other.close end |
#close ⇒ Integer
End position where insert is added. Default is open position plus the sequence length.
31 32 |
# File 'lib/scaffolder/region/insert.rb', line 31 attribute :close, :default => lambda{|s| s.open + s.sequence_hook.length - 1 } |
#open ⇒ Integer
Open position where insert is added. Default is close position minus the sequence length.
23 24 |
# File 'lib/scaffolder/region/insert.rb', line 23 attribute :open, :default => lambda{|s| s.close - s.sequence_hook.length - 1 } |
#position ⇒ Range
Insertion position as a Range
38 39 40 41 |
# File 'lib/scaffolder/region/insert.rb', line 38 def position raise CoordinateError if @close.nil? && @open.nil? open-1..close-1 end |
#size_diff ⇒ Integer
The difference in the insert sequence size and the insert location
54 55 56 57 |
# File 'lib/scaffolder/region/insert.rb', line 54 def size_diff insert_size = (close - open) + 1 sequence.length - insert_size end |
#source ⇒ String
Fasta identifier for the insert sequence
16 |
# File 'lib/scaffolder/region/insert.rb', line 16 attribute :source |