Class: Bio::RestrictionEnzyme::DoubleStranded::CutLocationsInEnzymeNotation
- Inherits:
-
CutLocations
- Object
- Array
- CutLocations
- Bio::RestrictionEnzyme::DoubleStranded::CutLocationsInEnzymeNotation
- Defined in:
- lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb
Overview
Inherits from DoubleStranded::CutLocations. Contains CutLocationPairInEnzymeNotation objects. Adds helper methods to convert from enzyme index notation to 0-based array index notation.
Instance Method Summary collapse
-
#complement_to_array_index ⇒ Object
Returns
Array
of locations of cuts on the complementary strand in 0-based array index notation. -
#primary_to_array_index ⇒ Object
Returns
Array
of locations of cuts on the primary strand in 0-based array index notation. -
#to_array_index ⇒ Object
Returns the contents of the present CutLocationsInEnzymeNotation object as a CutLocations object with the contents converted from enzyme notation to 0-based array index notation.
Methods inherited from CutLocations
#complement, #initialize, #primary
Constructor Details
This class inherits a constructor from Bio::RestrictionEnzyme::DoubleStranded::CutLocations
Instance Method Details
#complement_to_array_index ⇒ Object
Returns Array
of locations of cuts on the complementary strand in 0-based array index notation.
Arguments
-
none
- Returns
-
Array
of locations of cuts on the complementary strand in 0-based array index notation.
39 40 41 |
# File 'lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb', line 39 def complement_to_array_index helper_for_to_array_index(self.complement) end |
#primary_to_array_index ⇒ Object
Returns Array
of locations of cuts on the primary strand in 0-based array index notation.
Arguments
-
none
- Returns
-
Array
of locations of cuts on the primary strand in 0-based array index notation.
28 29 30 |
# File 'lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb', line 28 def primary_to_array_index helper_for_to_array_index(self.primary) end |
#to_array_index ⇒ Object
Returns the contents of the present CutLocationsInEnzymeNotation object as a CutLocations object with the contents converted from enzyme notation to 0-based array index notation.
Arguments
-
none
- Returns
-
CutLocations
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb', line 51 def to_array_index unless self.primary_to_array_index.size == self.complement_to_array_index.size err = "Primary and complement strand cut locations are not available in equal numbers.\n" err += "primary: #{self.primary_to_array_index.inspect}\n" err += "primary.size: #{self.primary_to_array_index.size}\n" err += "complement: #{self.complement_to_array_index.inspect}\n" err += "complement.size: #{self.complement_to_array_index.size}" raise IndexError, err end a = self.primary_to_array_index.zip(self.complement_to_array_index) CutLocations.new( *a.collect {|cl| CutLocationPair.new(cl)} ) end |