https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AImportProtein%2Fsandbox Module:ImportProtein/sandbox - Revision history 2025-05-30T15:22:33Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.3 https://en.wikipedia.org/w/index.php?title=Module:ImportProtein/sandbox&diff=1149530642&oldid=prev Lemondoge: Simplifications, and a use of assert instead of a custom error message 2023-04-12T20:13:54Z <p>Simplifications, and a use of assert instead of a custom error message</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 20:13, 12 April 2023</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 24:</td> <td colspan="2" class="diff-lineno">Line 24:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ---- include is nil to include everything. If it exists then only what is in it is used.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ---- include is nil to include everything. If it exists then only what is in it is used.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ---- format is "I want only this" (any junk) "and this" etc. Note weakness - a stray quote would foul up the whole template.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ---- format is "I want only this" (any junk) "and this" etc. Note weakness - a stray quote would foul up the whole template.</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> local include=args.include or pargs.include or <del style="font-weight: bold; text-decoration: none;">"all"</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> local include=args.include or pargs.include or <ins style="font-weight: bold; text-decoration: none;">nil</ins></div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if include == "all" then include = nil end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if include == "all" then include = nil end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local tinclude={}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local tinclude={}</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 72:</td> <td colspan="2" class="diff-lineno">Line 72:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ---- Check there is a protein sequence file and figure out where the CDS in it starts and ends</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ---- Check there is a protein sequence file and figure out where the CDS in it starts and ends</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local file=args.file or pargs.file</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local file=args.file or pargs.file</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;">if not</del>(file<del style="font-weight: bold; text-decoration: none;">) then return</del> "<del style="font-weight: bold; text-decoration: none;">error: </del>use 'file=some cut-and-pasted NCBI protein sequence' to input a protein to be diagrammed"<del style="font-weight: bold; text-decoration: none;"> end</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">assert</ins>(file<ins style="font-weight: bold; text-decoration: none;">,</ins> "use 'file=some cut-and-pasted NCBI protein sequence' to input a protein to be diagrammed"<ins style="font-weight: bold; text-decoration: none;">)</ins></div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local cdsstart, cdsend = mw.ustring.match(file,"Protein%s-(%d+)%.%.(%d+)")</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local cdsstart, cdsend = mw.ustring.match(file,"Protein%s-(%d+)%.%.(%d+)")</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> cdsstart=tonumber(cdsstart);cdsend=tonumber(cdsend)</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> cdsstart=tonumber(cdsstart);cdsend=tonumber(cdsend)</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 142:</td> <td colspan="2" class="diff-lineno">Line 142:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if s&lt;cdsstart then s=cdsstart end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if s&lt;cdsstart then s=cdsstart end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if e&gt;cdsend then e=cdsend end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if e&gt;cdsend then e=cdsend end</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> if s==cdsstart and e==cdsend<del style="font-weight: bold; text-decoration: none;"> then showthismotif=nil end</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if s==cdsstart and e==cdsend</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;">if</del> include and not tinclude[n]<del style="font-weight: bold; text-decoration: none;"> then showthismotif=nil end -- if include is set, and n isn't in it, don't add to table or graphic</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">or</ins> <ins style="font-weight: bold; text-decoration: none;">(</ins>include and not tinclude[n]<ins style="font-weight: bold; text-decoration: none;">)</ins></div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;">if</del> exclude and texclude[n]<del style="font-weight: bold; text-decoration: none;"> then showthismotif=nil end -- if exclude is set and n is in it don't add</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">or</ins> <ins style="font-weight: bold; text-decoration: none;">(</ins>exclude and texclude[n]<ins style="font-weight: bold; text-decoration: none;">)</ins></div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_9_0_lhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_6_0_rhs"></a> <ins style="font-weight: bold; text-decoration: none;">then</ins> </div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> showthismotif=nil </div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if showthismotif then</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if showthismotif then</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ---- update the table output for the legend</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> ---- update the table output for the legend</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 162:</td> <td colspan="2" class="diff-lineno">Line 165:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if newcolor then tlegend=tlegend..[[&lt;span style="background-color:]] .. c .. [[;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt; ]] .. nkey .. "\n" end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if newcolor then tlegend=tlegend..[[&lt;span style="background-color:]] .. c .. [[;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt; ]] .. nkey .. "\n" end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> nkey=""</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> nkey=""</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;">else</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">elseif large then</ins></div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;">if large then</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">vertical=tostring(height-toprowheight)</ins></div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;"> </del> vertical=tostring(<del style="font-weight: bold; text-decoration: none;">height-</del>toprowheight)</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">if</ins> <ins style="font-weight: bold; text-decoration: none;">toprow</ins> <ins style="font-weight: bold; text-decoration: none;">then</ins> vertical=<ins style="font-weight: bold; text-decoration: none;">vertical .. "px;top:" .. </ins>tostring(toprowheight)<ins style="font-weight: bold; text-decoration: none;"> end</ins></div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;"> if toprow then vertical</del>=<del style="font-weight: bold; text-decoration: none;">vertical</del> .. <del style="font-weight: bold; text-decoration: none;">"px;top:"</del> ..<del style="font-weight: bold; text-decoration: none;"> tostring(toprowheight) end</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">annot</ins>=<ins style="font-weight: bold; text-decoration: none;">"'''"</ins> .. <ins style="font-weight: bold; text-decoration: none;">nkey</ins> ..<ins style="font-weight: bold; text-decoration: none;">"'''"</ins></div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;"> annot</del>="<del style="font-weight: bold; text-decoration: none;">'''</del>" <del style="font-weight: bold; text-decoration: none;">..</del> <del style="font-weight: bold; text-decoration: none;">nkey</del> <del style="font-weight: bold; text-decoration: none;">.."'''"</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">nkey</ins>="" <ins style="font-weight: bold; text-decoration: none;">--</ins> <ins style="font-weight: bold; text-decoration: none;">no</ins> <ins style="font-weight: bold; text-decoration: none;">vertical text display</ins></div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;"> nkey="" -- no vertical text display</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">else</ins> </div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> <del style="font-weight: bold; text-decoration: none;"> else </del>vertical=tostring(math.floor(height) - toprowheight - largeonlyregion) .. "px;top:" .. tostring(toprowheight + largeonlyregion)</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;"> </ins>vertical=tostring(math.floor(height) - toprowheight - largeonlyregion) .. "px;top:" .. tostring(toprowheight + largeonlyregion)</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"> </del> nkey=mw.ustring.gsub(nkey,"(.)","%1&lt;br /&gt;") -- verticalize the text </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> nkey=mw.ustring.gsub(nkey,"(.)","%1&lt;br /&gt;") -- verticalize the text </div></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_6_0_rhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_9_0_lhs"></a> <del style="font-weight: bold; text-decoration: none;"> end</del></div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local z=10000-1*boxwidth --- smaller elements in front of larger ones</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local z=10000-1*boxwidth --- smaller elements in front of larger ones</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 178:</td> <td colspan="2" class="diff-lineno">Line 180:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- draw annotations vertically below it</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- draw annotations vertically below it</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- don't do at all if no text (nkey=="", such as on the top row)</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- don't do at all if no text (nkey=="", such as on the top row)</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> if<del style="font-weight: bold; text-decoration: none;"> not</del> (nkey<del style="font-weight: bold; text-decoration: none;">=</del>="") then</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if (nkey<ins style="font-weight: bold; text-decoration: none;">~</ins>="") then</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- first decide if in a replaceregion - if so, don't draw</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> -- first decide if in a replaceregion - if so, don't draw</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local toreplace;local ri=1</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> local toreplace;local ri=1</div></td> </tr> </table> Lemondoge https://en.wikipedia.org/w/index.php?title=Module:ImportProtein/sandbox&diff=1149529993&oldid=prev Lemondoge: Create sandbox version of Module:ImportProtein 2023-04-12T20:08:51Z <p>Create sandbox version of <a href="/wiki/Module:ImportProtein" title="Module:ImportProtein">Module:ImportProtein</a></p> <p><b>New page</b></p><div>local p = {}<br /> <br /> function p.main (frame)<br /> ---- Set up the initial frame parameters<br /> local debuglog=&quot;|}|}&quot;<br /> local args=frame.args<br /> local parent=frame.getParent(frame)<br /> local pargs={}<br /> if parent then pargs=parent.args end<br /> local height=args.height or pargs.height or &quot;50&quot;<br /> local width=args.width or pargs.width or &quot;600&quot;<br /> local background=args.background or pargs.background or &quot;#333333&quot;<br /> local vtext=args.vtext or pargs.vtext or 25 -- characters of legend text to display vertically down from motifs<br /> local largeonlyregion=args.largeonlyregion or pargs.largeonlyregion or 20<br /> local vtext=tonumber(vtext) -- no meaning except as a number<br /> local tableoutput=args.tableoutput or pargs.tableoutput or &quot;mw-collapsed&quot; -- I&#039;ve decided to use the table as the legend much of the time after all, I think. (previously defaulted to &quot;nil&quot; to suppress)<br /> if tableoutput==&quot;no&quot; then tableoutput=nil end<br /> local vwidth=args.vwidth or pargs.vwidth or 4 -- number of PIXELS to tag as not overwriteable with vertical text.<br /> local vclaim={} --- if vclaim[pixel] is true, that pixel is taken<br /> local vprotest=&#039;&#039; --- list of positions not shown separated by spaces<br /> local nowiki=args.nowiki or pargs.nowiki<br /> <br /> ---- These parameters send text that needs to be processed into tables<br /> ---- include is nil to include everything. If it exists then only what is in it is used.<br /> ---- format is &quot;I want only this&quot; (any junk) &quot;and this&quot; etc. Note weakness - a stray quote would foul up the whole template.<br /> local include=args.include or pargs.include or &quot;all&quot;<br /> if include == &quot;all&quot; then include = nil end<br /> local tinclude={}<br /> if include then<br /> for i in mw.ustring.gmatch(include,[[%&quot;(.-)%&quot;]]) do<br /> tinclude[i]=1<br /> end<br /> end<br /> ---- replaceregion defines a section with too many features to note individually.<br /> ---- Instead you group them with a new text.<br /> ---- The format is xx..yy:&quot;Use this text&quot;<br /> local replaceregion=args.replaceregion or pargs.replaceregion or &quot;&quot;<br /> local treplaceregion={}<br /> treplaceregion.s={};treplaceregion.e={};treplaceregion.t={}<br /> for i,j,k in mw.ustring.gmatch(replaceregion,[[(%d+)%.%.(%d+):%&quot;(.-)%&quot;]]) do<br /> table.insert(treplaceregion.s,tonumber(i));table.insert(treplaceregion.e,tonumber(j));table.insert(treplaceregion.t,tostring(k))<br /> end<br /> ---- exclude &quot;Forget about this&quot; (junk between ignored).<br /> ---- this prevents things from showing up even in the table and all motifs of this kind<br /> local exclude=args.exclude or pargs.exclude or &quot;&quot; -- for these empty arrays will be ignored later.<br /> local texclude={}<br /> for i in mw.ustring.gmatch(exclude,[[%&quot;(.-)%&quot;]]) do<br /> texclude[i]=1<br /> end<br /> ---- usenotes &quot;This is a crummy motif name&quot; (junk between ignored). Uses /note entries instead<br /> local usenotes=args.usenotes or pargs.usenotes or &quot;&quot;<br /> local tusenotes={}<br /> for i in mw.ustring.gmatch(usenotes,[[%&quot;(.-)%&quot;]]) do<br /> tusenotes[i]=1<br /> end<br /> ---- substitute &quot;Don&#039;t like this wording&quot;:&quot;That&#039;s what I want&quot; (anything between these ignored)<br /> local substitute=args.substitute or pargs.substitute or &quot;&quot;<br /> local tsubstitute={}<br /> for i,j in mw.ustring.gmatch(substitute,[[%&quot;(.-)%&quot;:%&quot;(.-)%&quot;]]) do<br /> tsubstitute[i]=j<br /> end<br /> ---- toprow &quot;Put this motif in the top row, no vertical annotation&quot;<br /> ---- If present, defines an upper part of the graphic to mark certain features by color only - most likely, helices and sheets and turns<br /> local toprowtext=args.toprow or pargs.toprow or &quot;&quot;<br /> local ttoprow={}<br /> local toprowheight=0 -- no height unless one exists<br /> local toprow -- boolean to mark if anything is actually on the top row<br /> for i in mw.ustring.gmatch(toprowtext,[[%&quot;(.-)%&quot;]]) do<br /> ttoprow[i]=1;toprow=true<br /> end<br /> if toprow then toprowheight=args.toprowheight or pargs.toprowheight or 10 end<br /> ---- Check there is a protein sequence file and figure out where the CDS in it starts and ends<br /> local file=args.file or pargs.file<br /> if not(file) then return &quot;error: use &#039;file=some cut-and-pasted NCBI protein sequence&#039; to input a protein to be diagrammed&quot; end<br /> local cdsstart, cdsend = mw.ustring.match(file,&quot;Protein%s-(%d+)%.%.(%d+)&quot;)<br /> cdsstart=tonumber(cdsstart);cdsend=tonumber(cdsend)<br /> if ((cdsstart&lt;1) or (cdsend&lt;1)) then return [[error: the module expected a line &quot;Protein: &#039;&#039;start amino acid&#039;&#039;..&#039;&#039;end amino acid&#039;&#039;&quot; to define the CDS.]] end<br /> local cdswidth=cdsend-cdsstart<br /> ---- Find and replace Site and Region to create unique separators<br /> ---- so that every one of these sections can be individually processed in the main loop<br /> file = mw.ustring.gsub(file,&quot;Site%s+&quot;,&quot;|##|S&quot;) -- there are no pipe characters in the input or it would have choked<br /> file = mw.ustring.gsub(file,&quot;Region%s+&quot;,&quot;|##|R&quot;)<br /> file = mw.ustring.gsub(file,&quot;$&quot;,&quot;|##|&quot;) --- close last feature at the EOF<br /> ---- Load a set of colors to use for the different motifs.<br /> ---- Any unicode separator changes them. No format expectations.<br /> local colorpage=mw.title.new(&quot;Template:ImportProtein/DefaultColors&quot;)<br /> local content<br /> local color={}<br /> if colorpage then<br /> content=colorpage.getContent(colorpage)<br /> if content then<br /> for x in mw.ustring.gmatch(content,&quot;(%S+)&quot;) do<br /> table.insert(color,x)<br /> end<br /> end<br /> end<br /> if #color&lt;1 then color={&quot;#000055&quot;,&quot;#000099&quot;,&quot;#0000CC&quot;,&quot;#0000FF&quot;,&quot;#550055&quot;,&quot;#550099&quot;,&quot;#5500CC&quot;,&quot;#5500FF&quot;,&quot;#990055&quot;,&quot;#990099&quot;,&quot;#9900CC&quot;,&quot;#9900FF&quot;,&quot;#CC0055&quot;,&quot;#CC0099&quot;,&quot;#CC00CC&quot;,&quot;#CC00FF&quot;,&quot;#FF0000&quot;,&quot;#FF0055&quot;,&quot;#FF0099&quot;,&quot;#FF00CC&quot;,&quot;#FF00FF&quot;,&quot;#005555&quot;,&quot;#005599&quot;,&quot;#0055CC&quot;,&quot;#0055FF&quot;,&quot;#55555&quot;,&quot;#555599&quot;,&quot;#5555CC&quot;,&quot;#5555FF&quot;,&quot;#995555&quot;,&quot;#995599&quot;,&quot;#9955CC&quot;,&quot;#9955FF&quot;,&quot;#CC5555&quot;,&quot;#CC5599&quot;,&quot;#CC55CC&quot;,&quot;#CC55FF&quot;,&quot;#FF5500&quot;,&quot;#FF5555&quot;,&quot;#FF5599&quot;,&quot;#FF55CC&quot;,&quot;#FF55FF&quot;} end<br /> local claim={};local nextcolor=1 -- keeps track of the colors assigned to specific nkeys throughout the loop<br /> ---- Begin the output and graphics files<br /> local output<br /> local tlegend=&quot;&quot; -- legend for top row entries only, shown above table<br /> if tableoutput == &quot;collapsed&quot; then <br /> output=[[{| class=&quot;wikitable mw-collapsible mw-collapsed&quot; style=&quot;width:]].. width .. [[px;&quot;]] .. &quot;\n&quot; .. [[!colspan=4|List of protein features]] .. &quot;\n&quot; .. [[|-]] <br /> elseif tableoutput==&quot;collapsible&quot; then <br /> output=[[{| class=&quot;wikitable collapsible&quot; style=&quot;width:]].. width .. [[px;&quot;]] .. &quot;\n&quot; .. [[!colspan=4|List of protein features]] .. &quot;\n&quot; .. [[|-]] <br /> else <br /> output=[[{| class=&quot;wikitable&quot;]] <br /> end<br /> local graphics=[[&lt;div style=&quot;position:relative;background-color:]].. background .. [[;width:]] .. width .. [[px;height:]] .. height .. [[px;&quot;&gt;]]<br /> ---- MAIN LOOP ----<br /> ---- this goes through features one by one and marks them down in &quot;output&quot; (legend/table) and &quot;graphics&quot; (protein box and vertical annotation)<br /> ---- Note that this does NOT create an array of features to sort, but is purely once through.<br /> ---- This means, for example, that there is no easy way to reposition adjacent motifs left and right to fit automatically.<br /> ---- You could, of course, array the output and retroactively process it ... maybe even turn this into a sortable array of function tail calls??? (My head hurts)<br /> for feature, range in mw.ustring.gmatch(file,&quot;#|(.-)|#&quot;) do<br /> local t=mw.ustring.match(feature,&quot;^(%a)&quot;) -- S or R placed in previous find/replace<br /> local s=mw.ustring.match(feature,&quot;(%d+)&quot;) -- first number is the beginning of site or region<br /> local e=mw.ustring.match(feature,&quot;^.%s-%d+%.%.(%d+)&quot;) or s -- second number in xx..yy range ; this needs updating!<br /> <br /> if s then<br /> ---- decide on the name to be used for the motif and annotation<br /> local n,c<br /> if t==&quot;R&quot; then n=mw.ustring.match(feature,[[/region_name=%&quot;(.-)%&quot;]]) end<br /> if t==&quot;S&quot; then n=mw.ustring.match(feature,[[/site_type=%&quot;(.-)%&quot;]]) end<br /> n=tostring(n)<br /> if tusenotes[n] then n=mw.ustring.match(feature,[[/note=%&quot;(.-)%&quot;]]) or n end<br /> n=tostring(n)<br /> n=mw.ustring.match(n,&quot;^%s+(.+)%s+$&quot;) or n -- kill white space<br /> n=mw.ustring.gsub(n,&quot;\n&quot;,&quot; &quot;) or n -- remove line feeds<br /> n=tostring(n) -- am I paranoid?<br /> if tsubstitute[n] then n=tostring(tsubstitute[n]) end<br /> n = mw.ustring.match(n,&quot;(.+)%.&quot;) or n -- Don&#039;t need the ubiquitous final periods<br /> ---- from the name (n) pull out an nkey that excludes parenthesized stuff<br /> ---- each unique nkey can claim its own color to use from here on out<br /> local nkey=mw.ustring.match(n,&quot;(.+)[%.;,%(%[]&quot;) or n<br /> local newcolor=false; -- is this a new color (if so, then if it is toprow, then add to legend for those)<br /> if claim[nkey] then c=claim[nkey] else c=color[nextcolor];claim[nkey]=c;nextcolor=nextcolor+1;newcolor=true end<br /> local cstyle=[[style=&quot;color:]] .. c .. [[;&quot;|]]<br /> ---- decide whether to show the motif, and crop it to the CDS<br /> local showthismotif=true<br /> s=tonumber(s);e=tonumber(e)<br /> if s&lt;cdsstart then s=cdsstart end<br /> if e&gt;cdsend then e=cdsend end<br /> if s==cdsstart and e==cdsend then showthismotif=nil end<br /> if include and not tinclude[n] then showthismotif=nil end -- if include is set, and n isn&#039;t in it, don&#039;t add to table or graphic<br /> if exclude and texclude[n] then showthismotif=nil end -- if exclude is set and n is in it don&#039;t add<br /> if showthismotif then<br /> ---- update the table output for the legend<br /> if tostring(t)==&quot;R&quot; then output = output .. &quot;\n|&quot; .. cstyle .. &quot;region\n|&quot; else output = output .. &quot;\n|&quot; .. cstyle .. &quot;site\n|&quot; end<br /> output = output .. cstyle .. tostring(s) .. &quot;\n|&quot; .. cstyle .. tostring(e) .. &quot;\n|&quot; .. cstyle .. n .. &quot;\n|-&quot;<br /> ---- update the graphic display: first determine if the block is large to be displayed full height and annotated inside itself<br /> nkey=mw.ustring.sub(nkey,1,vtext) -- for graphics purposes, truncate the string (default 25 characters)<br /> local large<br /> local boxleft=math.floor(width*tonumber(s)/cdswidth)<br /> local boxwidth=math.floor(width*tonumber(e)/cdswidth)-boxleft<br /> if boxwidth&gt;8*tonumber(mw.ustring.len(nkey)) then large=true else large=nil end<br /> ---- then work out the horizontal or vertical display<br /> local vertical -- height substring of the drawn block<br /> local annot=&quot;&quot; -- text contents of a large block<br /> if ttoprow[n] then<br /> vertical=tostring(toprowheight)<br /> if newcolor then tlegend=tlegend..[[&lt;span style=&quot;background-color:]] .. c .. [[;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt; ]] .. nkey .. &quot;\n&quot; end<br /> nkey=&quot;&quot;<br /> else<br /> if large then<br /> vertical=tostring(height-toprowheight)<br /> if toprow then vertical=vertical .. &quot;px;top:&quot; .. tostring(toprowheight) end<br /> annot=&quot;&#039;&#039;&#039;&quot; .. nkey ..&quot;&#039;&#039;&#039;&quot;<br /> nkey=&quot;&quot; -- no vertical text display<br /> else vertical=tostring(math.floor(height) - toprowheight - largeonlyregion) .. &quot;px;top:&quot; .. tostring(toprowheight + largeonlyregion)<br /> nkey=mw.ustring.gsub(nkey,&quot;(.)&quot;,&quot;%1&lt;br /&gt;&quot;) -- verticalize the text <br /> end<br /> end<br /> local z=10000-1*boxwidth --- smaller elements in front of larger ones<br /> if not(large) then z=z+10000 end --- large elements reliably to the back<br /> -- draw graphics within the protein rectangle<br /> graphics = graphics .. [[&lt;div style=&quot;position:absolute;overflow:hidden;z-index:]] .. z .. [[;left:]] .. boxleft .. [[px;border-top:0px;border-bottom:0px;border-left:1px;border-right:1px;border-style:solid;border-color:]].. c .. [[;background-color:]].. c .. [[;width:]] .. boxwidth .. [[px;height:]] .. vertical .. [[px;text-align:center;&quot;&gt;]] .. annot .. [[&lt;/div&gt;]]<br /> -- draw annotations vertically below it<br /> -- don&#039;t do at all if no text (nkey==&quot;&quot;, such as on the top row)<br /> if not (nkey==&quot;&quot;) then<br /> -- first decide if in a replaceregion - if so, don&#039;t draw<br /> local toreplace;local ri=1<br /> while treplaceregion.s[ri] do<br /> local rs=treplaceregion.s[ri]<br /> local re=treplaceregion.e[ri]<br /> if s&gt;=rs and e&lt;=re then toreplace=true;break end<br /> ri=ri+1<br /> end <br /> if not toreplace and not large then <br /> --- center vt in the feature; then claim pixels one by one around it.<br /> --- Don&#039;t draw in a claimed pixel, but file a protest at bottom.<br /> local vt=math.floor(boxleft+boxwidth/2 - 2) -- vertical text&#039;s horizontal position<br /> if not vclaim[vt] then<br /> for i = vt-vwidth,vt+vwidth,1 do<br /> vclaim[i]=true<br /> end<br /> graphics = graphics .. [[&lt;span style=&quot;position:absolute;text-align:center;line-height:90%;font-size:85%;overflow:visible;z-index:100;left:]] .. vt .. [[px;top:]] .. math.floor(height+5) .. [[px;&quot;&gt;]] .. nkey .. [[&lt;/span&gt;]]<br /> else vprotest=vprotest .. s .. &quot;-&quot; .. e .. &quot; &quot;<br /> end -- (if not ttoprow[n])<br /> end -- (if not vclaim)<br /> end -- (if not toreplace)<br /> end -- (if showthismotif)<br /> end -- (if s)<br /> end -- for feature, range<br /> --- we&#039;re out of the loop - now draw annotations for the chosen replace regions based on user text<br /> local ri=1<br /> while treplaceregion.s[ri] do<br /> local rs=treplaceregion.s[ri]<br /> local re=treplaceregion.e[ri]<br /> local rt=mw.ustring.gsub(mw.ustring.sub(treplaceregion.t[ri],1,vtext),&quot;(.)&quot;,&quot;%1&lt;br /&gt;&quot;) -- verticalize the text<br /> local boxleft=math.floor(width*tonumber(rs)/cdswidth)<br /> local boxwidth=math.floor(width*tonumber(re)/cdswidth)-boxleft<br /> local vt = math.floor(boxleft+boxwidth/2 -2) -- this formula should be synchronized with above, but defining constants seems silly.<br /> -- this ignores vclaim - it&#039;s a user input, therefore repositionable field<br /> graphics = graphics .. [[&lt;span style=&quot;position:absolute;text-align:center;line-height:90%;font-size:85%;overflow:visible;z-index:100;left:]] .. vt .. [[px;top:]] .. math.floor(height+5) .. [[px;&quot;&gt;]] .. rt .. [[&lt;/span&gt;]]<br /> ri=ri+1<br /> end<br /> if not(tableoutput) then output = &quot;&quot; end<br /> if tlegend ~= &quot;&quot; then tlegend = [[&lt;div style=&quot;width:]]..width..[[;&quot;&gt;]] .. [[&#039;&#039;Top row:&#039;&#039; ]] .. tlegend .. [[&lt;/div&gt;]] end<br /> if vprotest ~= &quot;&quot; then vprotest = &quot;&#039;&#039;Overlapping vertical annotations not shown above: &quot; .. vprotest .. &quot;&#039;&#039;&quot; end<br /> if debuglog == &quot;|}|}&quot; then debuglog=&quot;&quot; else debuglog = debuglog .. &quot;\n&quot; end<br /> if vtext&gt;2 then vtext=vtext-2 end -- make up for extra return required to start a table at the end there.<br /> local output = [=[{| style=&quot;width:]=]..width..[[px;&quot;]] .. &quot;\n|&quot;.. graphics .. [[&lt;/div&gt;&lt;div style=&quot;line-height:90%;font-size:85%;&quot;&gt;]] .. mw.ustring.rep(&quot;\n&quot;,vtext) .. &quot;&lt;/div&gt;&quot; .. tlegend .. vprotest .. &quot;\n&quot; .. output .. &quot;\n|}\n&quot; .. debuglog .. &quot;|}\n&quot;<br /> if nowiki then output = frame.preprocess(frame,&quot;&lt;pre&gt;&lt;nowiki&gt;&quot;..output..&quot;&lt;/nowiki&gt;&lt;/pre&gt;&quot;) end<br /> return output<br /> end<br /> <br /> return p</div> Lemondoge