Template:LBS/FormatSugar
{{#lua:
local seq = stdin:match("%S+"); local ret = ""; for p,q,r,s in string.gmatch(seq, "(%a+[%dMe]?)([?ab])([1-9])%-([1-9])") do if (string.match(p, "^Glc")) then ret = ret .. '' .. p .. "" elseif (string.match(p, "^Gal")) then ret = ret .. '' .. p .. "" elseif (string.match(p, "^Man")) then ret = ret .. '' .. p .. "" elseif (string.match(p, "^Fuc")) then ret = ret .. '' .. p .. "" elseif (string.match(p, "^Neu")) then ret = ret .. '' .. p .. "" else ret = ret .. p end
if (q == "a") then ret = ret .. "α" elseif (q == "b") then ret = ret .. "β" else ret = ret .. "" .. q end
ret = ret .. r .. "-" .. s .. "" end if (string.match(seq,"Cer$")) then ret = ret .. "Cer" end print(ret)
|GlcNAcb1-3Manb1-4Glcb1-1Cer}}