Template:LBS/FormatSugar: Difference between revisions

mNo edit summary
(Replaced content with "{{#invoke:LBS|FormatSugar||{{{1|GlcNAca/b1-3Xyla-4Galb1-3GalNAca1-4(NeuAc?1-2NeuGc4Mea1-3)GalNAcb1-4(EtnP-6)GlcNAcb1-3Manb1-4Glcb1-1Cer}}}}}")
Tag: Replaced
 
(15 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
    if (o) then ret = ret .. o end
    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
 
    if (q == "a") then ret = ret .. "<sub>&alpha;"
    elseif (q == "b") then ret = ret .. "<sub>&beta;"
    else ret = ret .. "<sub>" .. q end
 
    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}}}}}
<!---- GlcNAc([1-6]Me)?|GalNAc([1-6]Me)?|GlcN|GalN|NeuAc([1-9]Me)?|NeuNH|NeuGc([1-9]Me)?|GlcA|GalA|Fuc([1-6]Me)?|Ara|Xyl([1-6]Me)?|Rha|KDN|Glc|Gal([1-6]Me)?|Man|Ins- --->

Latest revision as of 07:28, 1 February 2023

GlcNAcα/β1-3Xylα-4Galβ1-3GalNAcα1-4(NeuAc?1-2NeuGc4Meα1-3)GalNAcβ1-4(EtnP-6)GlcNAcβ1-3Manβ1-4Glcβ1-1Cer