Jump to content

Module:ImportProtein

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Wnt (talk | contribs) at 15:13, 16 March 2013 (This should import/read the parameters, at least...). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

function p.main (frame)
   local args=frame.args
   local parent=frame.getParent(frame)
   local pargs
   if parent then pargs=parent.args end
   local height=args.height or pargs.height or "200"
   local width=args.width or pargs.width or "600"
   local include=args.include or pargs.include or "all"
   if include == "all" then include = nil end -- anything but nil means to include only certain listed things.
   local tinclude={}
   if include then
      for i in mw.ustring.gmatch(include,[[%"(.-)%"]]) do
         table.insert(tinclude,i)
      end
   end
   local exclude=args.exclude or pargs.exclude or "" -- for these empty arrays will be ignored later.
   local texclude={}
   for i in mw.ustring.gmatch(exclude,[[%"(.-)%"]]) do
      table.insert(texclude,i)
   end
   local usenotes=args.usenotes or pargs.usenotes or ""
   local tusenotes={}
   for i in mw.ustring.gmatch(usenotes,[[%"(.-)%"]]) do
      table.insert(tusenotes,i)
   end
   local substitute=args.substitute or pargs.substitute or ""
   local tsubstitute
   for i,j in mw.ustring.gmatch(substitute,[[%"(.-)%":%"(.-)%"]]) do
      tsubstitute[i]=j
   end
   local file=args.file or pargs.file
   if file then else return "error: use 'file=some cut-and-pasted NCBI protein sequence' to input a protein to be diagrammed" end

 -- debug preliminary
   output = "height:".. tostring(height) .. "width:" .. tostring (width) .. "include:" .. include .. "=" .. unpack(tinclude)
   return output

end

return p