Method: Bio::RestrictionEnzyme::DoubleStranded#create_action_at

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

#create_action_at(offset) ⇒ Object

Takes a RestrictionEnzyme object and a numerical offset to the sequence and returns an EnzymeAction

restriction_enzyme

RestrictionEnzyme

offset

Numerical offset of where the enzyme action occurs on the seqeunce



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/bio/util/restriction_enzyme/double_stranded.rb', line 160

def create_action_at( offset )
  # x is the size of the fully aligned sequence with maximum padding needed
  # to make a match on the primary and complement strand.
  #
  # For example -
  # Note how EcoRII needs extra padding on the beginning and ending of the
  # sequence 'ccagg' to make the match since the cut must occur between 
  # two nucleotides and can not occur on the very end of the sequence.
  #   
  #   EcoRII:
  #     :blunt: "0"
  #     :c2: "5"
  #     :c4: "0"
  #     :c1: "-1"
  #     :pattern: CCWGG
  #     :len: "5"
  #     :name: EcoRII
  #     :c3: "0"
  #     :ncuts: "2"
  #   
  #        -1 1 2 3 4 5
  #   5' - n^c c w g g n - 3'
  #   3' - n g g w c c^n - 5'
  #   
  #   (w == [at])
  
  x = aligned_strands.primary.size
  
  enzyme_action = EnzymeAction.new( offset,
                                    offset + x-1,
                                    offset,
                                    offset + x-1)

  @cut_locations.each do |cut_location_pair|
    # cut_pair is a DoubleStranded::CutLocationPair
    p, c = cut_location_pair.primary, cut_location_pair.complement
    if c >= p
      enzyme_action.add_cut_range(offset+p, nil, nil, offset+c)
    else
      enzyme_action.add_cut_range(nil, offset+p, offset+c, nil)
    end
  end

  enzyme_action
end