Module:Infobox gene: Difference between revisions

Content deleted Content added
Gene ___location column added (see Module talk:Infobox gene)
avoiding error (some wikidata pages have only chromosome number, but not genomic start/end)
Line 200:
--end
if (chr ~= "" and gstart ~= "" and gend ~= "") or (chr_mm ~= "" and gstart_mm ~= "" and gend_mm ~= "") then
p.renderGeneLocation(frame, chr, gstart, gend, db, ensembl, chr_mm, gstart_mm, gend_mm, db_mm, ensembl_mm, name)
end
Line 677:
local label_gstart = "Start" --**lclz**
local label_gend = "End" --**lclz**
local tooltip_arrowSign = "Genomic ___location for "..name --**lclz**
local arrowSign_width = 14
if chr ~= "" and gstart ~= "" and gend ~= "" then
--Chromosome lengths are from GRCh38.p10 https://www.ncbi.nlm.nih.gov/grc/human/data?asm=GRCh38.p10
--This table is used only for calculating "Where should red-rectangle put?"
Line 709 ⟶ 710:
chrLengthTable["Y"] = 57227415
local chrLength = chrLengthTable[chr]
--Different languages have different word order.
local chrTextTable = {}--**lclz**
chrTextTable["1"] = "Chromosome 1 (human)"
chrTextTable["2"] = "Chromosome 2 (human)"
chrTextTable["3"] = "Chromosome 3 (human)"
chrTextTable["4"] = "Chromosome 4 (human)"
chrTextTable["5"] = "Chromosome 5 (human)"
chrTextTable["6"] = "Chromosome 6 (human)"
chrTextTable["7"] = "Chromosome 7 (human)"
chrTextTable["8"] = "Chromosome 8 (human)"
chrTextTable["9"] = "Chromosome 9 (human)"
chrTextTable["10"] = "Chromosome 10 (human)"
chrTextTable["11"] = "Chromosome 11 (human)"
chrTextTable["12"] = "Chromosome 12 (human)"
chrTextTable["13"] = "Chromosome 13 (human)"
chrTextTable["14"] = "Chromosome 14 (human)"
chrTextTable["15"] = "Chromosome 15 (human)"
chrTextTable["16"] = "Chromosome 16 (human)"
chrTextTable["17"] = "Chromosome 17 (human)"
chrTextTable["18"] = "Chromosome 18 (human)"
chrTextTable["19"] = "Chromosome 19 (human)"
chrTextTable["20"] = "Chromosome 20 (human)"
chrTextTable["21"] = "Chromosome 21 (human)"
chrTextTable["22"] = "Chromosome 22 (human)"
chrTextTable["X"] = "X chromosome (human)"
chrTextTable["Y"] = "Y chromosome (human)"
local chrText = chrTextTable[chr]
--about the calculation below, see https://en.wikipedia.org/wiki/User:Was_a_bee/Gene#3._Calculation_detail
local markerWidth = ((gend - gstart) * 294.133 )/ chrLength
Line 764 ⟶ 794:
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:wikitext("[[File:Ideogram human chromosome "..chr..".svg|300px|Human chromosome "..chrchrText.."]]")
:done() --end td
:done() --end tr
Line 778 ⟶ 808:
:tag('span')
:attr('class', 'plainlinks')
:wikitext("[[Chromosome "..chrchrText.." (human)]]"..source_link_chr)
:done() --end span
:done() --end td
Line 789 ⟶ 819:
:wikitext("<div align=\"center\">")
:wikitext("<div style=\"position\: relative\; width\: 300px\;\">")
:wikitext("[[File:Human chromosome "..chr.." ideogram.svg|300px|Human chromosome "..chrchrText.."]]")
:wikitext("<div style=\"position\: absolute\; left\: "..arrowSignLocation.."px\; top\: 2px\; padding\: 0\;\">[[File:HSR 1996 II 3.5e.svg|"..arrowSign_width.."px|Genomic ___location for "..nametooltip_arrowSign.."]]</div>")
:wikitext("<div style=\"position\: absolute\; left\: "..markerLocation.."px\; top\: 19px\; padding\: 0\;\">[[File:Red rectangle "..markerWidth.."x18.png|"..markerWidth.."px|Genomic ___location for "..nametooltip_arrowSign.."]]</div>")
:wikitext("</div>")
:wikitext("</div>")
Line 843 ⟶ 873:
end
if chr_mm ~= "" and gstart_mm ~= "" and gend_mm ~= "" then
--Chromosome lengths are from GRCm38.p5 https://www.ncbi.nlm.nih.gov/grc/mouse/data?asm=GRCm38.p5
local chrLengthTable_mm = {}
Line 868 ⟶ 898:
chrLengthTable_mm["Y"] = 91744698
local chrLength_mm = chrLengthTable_mm[chr_mm]
--Different languages have different word order.
local chrTextTable_mm = {}--**lclz**
chrTextTable_mm["1"] = "Chromosome 1 (mouse)"
chrTextTable_mm["2"] = "Chromosome 2 (mouse)"
chrTextTable_mm["3"] = "Chromosome 3 (mouse)"
chrTextTable_mm["4"] = "Chromosome 4 (mouse)"
chrTextTable_mm["5"] = "Chromosome 5 (mouse)"
chrTextTable_mm["6"] = "Chromosome 6 (mouse)"
chrTextTable_mm["7"] = "Chromosome 7 (mouse)"
chrTextTable_mm["8"] = "Chromosome 8 (mouse)"
chrTextTable_mm["9"] = "Chromosome 9 (mouse)"
chrTextTable_mm["10"] = "Chromosome 10 (mouse)"
chrTextTable_mm["11"] = "Chromosome 11 (mouse)"
chrTextTable_mm["12"] = "Chromosome 12 (mouse)"
chrTextTable_mm["13"] = "Chromosome 13 (mouse)"
chrTextTable_mm["14"] = "Chromosome 14 (mouse)"
chrTextTable_mm["15"] = "Chromosome 15 (mouse)"
chrTextTable_mm["16"] = "Chromosome 16 (mouse)"
chrTextTable_mm["17"] = "Chromosome 17 (mouse)"
chrTextTable_mm["18"] = "Chromosome 18 (mouse)"
chrTextTable_mm["19"] = "Chromosome 19 (mouse)"
local chrText_mm = chrTextTable_mm[chr_mm]
--about the calculation below, see https://en.wikipedia.org/wiki/User:Was_a_bee/Gene#3._Calculation_detail
local markerWidth_mm = ((gend_mm - gstart_mm) * 294.133 )/ chrLength_mm
Line 919 ⟶ 973:
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:wikitext("[[File:Ideogram house mouse chromosome "..chr_mm..".svg|260px|Mouse chromosome "..chr_mmchrText_mm.."]]")
:done() --end td
:done() --end tr
Line 933 ⟶ 987:
:tag('span')
:attr('class', 'plainlinks')
:wikitext("Chromosome "..chr_mm.." (mouse)"chrText_mm..source_link_chr_mm)
:done() --end span
:done() --end td
Line 944 ⟶ 998:
:wikitext("<div align=\"center\">")
:wikitext("<div style=\"position\: relative\; width\: 300px\;\">")
:wikitext("[[File:Ideogram of house mouse chromosome "..chr_mm..".svg|300px|Mouse chromosome "..chr_mmchrText_mm.."]]")
:wikitext("<div style=\"position\: absolute\; left\: "..arrowSignLocation_mm.."px\; top\: 2px\; padding\: 0\;\">[[File:HSR 1996 II 3.5e.svg|"..arrowSign_width.."px|Genomic ___location for "..nametooltip_arrowSign.."]]</div>")
:wikitext("<div style=\"position\: absolute\; left\: "..markerLocation_mm.."px\; top\: 19px\; padding\: 0\;\">[[File:Red rectangle "..markerWidth_mm.."x18.png|"..markerWidth_mm.."px|Genomic ___location for "..nametooltip_arrowSign.."]]</div>")
:wikitext("</div>")
:wikitext("</div>")