Method: Bio::RestrictionEnzyme::DoubleStranded::AlignedStrands.align

Defined in:
lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb

.align(a, b) ⇒ Object

Pad and align two String objects without cut symbols.

This will look for the sub-sequence without left and right ‘n’ padding and re-apply ‘n’ padding to both strings on both sides equal to the maximum previous padding on that side.

The sub-sequences stripped of left and right ‘n’ padding must be of equal length.

Example:

AlignedStrands.align('nngattacannnnn', 'nnnnnctaatgtnn') # => 
 <struct Bio::RestrictionEnzyme::DoubleStranded::AlignedStrands::Result
   primary="nnnnngattacannnnn",
   complement="nnnnnctaatgtnnnnn">

Arguments

  • a: Primary strand

  • b: Complementary strand

Returns

Result object with equal padding on both strings



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb', line 51

def self.align(a, b)
  a = a.to_s
  b = b.to_s
  validate_input( strip_padding(a), strip_padding(b) )
  left = [left_padding(a), left_padding(b)].sort.last
  right = [right_padding(a), right_padding(b)].sort.last

  p = left + strip_padding(a) + right
  c = left + strip_padding(b) + right
  Result.new(p,c)
end