Module:Wnt/Templates/Restriction
Appearance
Unchecked
Documentation for this module may be created at Module:Wnt/Templates/Restriction/doc
local p={}
function p.main(frame)
local args=frame.args
local pframe=frame:getParent()
local pargs=pframe.args
local sequence=pargs.sequence or args.sequence or "ERROR - NO SEQUENCE PROVIDED"
sequence=string.upper(string.gsub (sequence, "[^acgtACGTwsrykmWSRYKMbdhvBDHVnNuU]", ""))
-- this is supposed to strip everything out of the sequence but nucleotides, and make it all uppercase
sequence=string.gsub (sequence, "[uU]", "T")
-- if someone gives mRNA, assume they're cutting DNA
local name=pargs.name or args.name or "unnamed sequence"
local cutcount=1
local site={}
local cutsite=pargs["cutsite" .. cutcount] or args["cutsite" .. cutcount]
local cutname=pargs["cutname" .. cutcount] or args["cutname" .. cutcount]
while (cutsite and cutname) do
local cutoffset=pargs["cutoffset" .. cutcount] or args["cutoffset" .. cutcount]
local match=0
repeat
match = string.find(sequence,cutsite,match+1)
if match then site[match+cutoffset]=cutname end
until not match
end
-- then sort the table? or otherwise figure out adjacent cuts for a complete digest...
end
return p