|
|
(12 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| {{#lua: | | {{#invoke:LBS|FormatSugar||{{{1|GlcNAca/b1-3Xyla-4Galb1-3GalNAca1-4(NeuAc?1-2NeuGc4Mea1-3)GalNAcb1-4(EtnP-6)GlcNAcb1-3Manb1-4Glcb1-1Cer}}}}} |
| local seq = stdin:match("[%S()%[%]]+");
| |
| local ret = "";
| |
| for o,p,q,r,s,t in string.gmatch(seq, "([%[%(]?)(%a+)([?ab%-])([1-9]?)%-?([1-9])([%]%)]?)") do
| |
| ---Process ( ---
| |
| if (o) then ret = ret .. o end
| |
| ---Process sugar name---
| |
| if (string.match(p, "^Glc")) then
| |
| ret = ret .. '<span style="color:blue"><b>' .. p .. "</b></span>"
| |
| elseif (string.match(p, "^Gal")) then
| |
| ret = ret .. '<span style="color:gold"><b>' .. p .. "</b></span>"
| |
| elseif (string.match(p, "^Man")) then
| |
| ret = ret .. '<span style="color:green"><b>' .. p .. "</b></span>"
| |
| elseif (string.match(p, "^Fuc")) then
| |
| ret = ret .. '<span style="color:red"><b>' .. p .. "</b></span>"
| |
| elseif (string.match(p, "^Neu")) then
| |
| ret = ret .. '<span style="color:pink"><b>' .. p .. "</b></span>"
| |
| else
| |
| ret = ret .. '<b>' .. p .. '</b>'
| |
| end
| |
| ---Process alpha or beta---
| |
| if (q == "a") then ret = ret .. "<sub>α"
| |
| elseif (q == "b") then ret = ret .. "<sub>β"
| |
| elseif (q == "-") then ret = ret .. "<sub>*"
| |
| else ret = ret .. "<sub>" .. q end
| |
| ---Process bond position---
| |
| ret = ret .. r .. "-" .. s .. "</sub>"
| |
| if (t) then ret = ret .. t end
| |
| end
| |
| if (string.match(seq,"Cer$")) then
| |
| ret = ret .. "<b>Cer</b>"
| |
| end
| |
| print(ret)
| |
| |{{{1|GlcNAcb1-3Galb1-3GalNAca1-4GalNAcb1-4(EtnP-6)GlcNAcb1-3Manb1-4Glcb1-1Cer}}}}}
| |