"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/plugins/sam_seq.lua" (12 May 2020, 1386 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 Description="Generate coloured bio sequences in Sequence Alignment Maps"
    2 
    3 -- optional parameter: syntax description
    4 function syntaxUpdate(desc)
    5 
    6   t = {}
    7   t["A"] = "144;238;144" --144, 238, 144
    8   t["T"] = "240;128;128" --240, 128, 128
    9   t["C"] = "173;216;230" --173, 216, 230
   10   t["G"] = "255;160;122" --255, 160, 122
   11 
   12   function Decorate(token, state, kwclass)
   13 
   14     if ( (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML or HL_OUTPUT == HL_FORMAT_TRUECOLOR)
   15         and #token > 63 and state == HL_KEYWORD and not string.match(token,"[^ATCG]") ) then
   16 
   17       retVal = ""
   18       for c in token:gmatch"." do
   19         if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
   20           retVal = retVal .. "<span class='elem_".. c .. "'>".. c .. "</span>"
   21         elseif (HL_OUTPUT == HL_FORMAT_TRUECOLOR) then
   22           retVal = retVal .. "\27[48;2;".. t[c] .. "m".. c .. "\27m"
   23         end
   24       end
   25       return retVal
   26     end
   27   end
   28 end
   29 
   30 function themeUpdate(desc)
   31   if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
   32 
   33     Injections[#Injections+1]=[[
   34 span.elem_A {
   35   background-color: lightgreen;
   36 }
   37 span.elem_T {
   38   background-color: lightcoral;
   39 }
   40 span.elem_C {
   41   background-color: lightblue;
   42 }
   43 span.elem_G {
   44   background-color: lightsalmon;
   45 }
   46 ]]
   47   end
   48 end
   49 
   50 Plugins={
   51   { Type="lang", Chunk=syntaxUpdate },
   52   { Type="theme", Chunk=themeUpdate }
   53 }