Module:Infobox gene: Difference between revisions

Content deleted Content added
per edit request on talk page - include gene expression calls via "expressed in" statements from Wikidata / Bgee database
Tag: Reverted
m Undid revision 1051488468 by Paine Ellsworth (talk) srv - there are "expressed in" links to disambiguation pages
Line 146:
--a list variables of all the data in the info box
local name = check_values(p.getLabel,{entity})
local expressed_in_tissues = check_values(p.getValue, {entity, "P5572", localNotApplicableStr, localSeparatorStr}) --P5572: expressed in
local entrez_gene = check_values(p.getValue, {entity, "P351", localNotApplicableStr} )
local entrez_gene_mm = check_values(p.getValue, {entity_mouse, "P351", localNotApplicableStr})
Line 211 ⟶ 210:
p.renderGeneLocation(frame, chr, gstart, gend, db, cytoband, ensembl, chr_mm, gstart_mm, gend_mm, db_mm, cytoband_mm, ensembl_mm, name)
end
if expression_images ~= "" or expressed_in_tissues ~= localNotApplicableStr then
p.renderRNAexpression(expression_images, entrez_gene, ensembl, p.renderBgeeExpression(expressed_in_tissues))
end
if (mol_funct ~= "" and cell_comp ~= "" and bio_process ~= "") then
Line 1,103 ⟶ 1,102:
end
 
p.renderRNAexpression = function(expression_images, entrez_gene)
--Get the render elements title, collapse option, collapsed anatomic entities,
--and anatomic entity list for the Bgee gene expression rendering.
p.renderBgeeExpression = function(expressed_in_tissues)
--create list of expressed in anatomic entities
local bgee_title = "Bgee"
bgee_title = "[https://bgee.org/ " .. bgee_title .. "]"
local bgee_links = localNotApplicableStr
local bgee_collapse = "none"
local bgee_default = "Top expressed in"
local split_bgee = mw.text.split(expressed_in_tissues, localSeparatorStr)
local bgee_link_list = {}
local results
for k,v in ipairs(split_bgee) do
if string.match(v, '%w+') and v ~= localNotApplicableStr then
bgee_link_list[#bgee_link_list+1] = "\n* [["..v.."]]"
end
end
--if less than 11 don't create collapsible list
if table.getn(bgee_link_list) < 11 then
if bgee_default == nil and table.getn(bgee_link_list) == 0 then bgee_links = localNotApplicableStr end
else
bgee_collapse = "collapsible collapsed"
bgee_default = bgee_default .. '<br>' .. table.remove(bgee_link_list, 1) .. '<br>' .. table.remove(bgee_link_list, 1) .. '<br>' ..table.remove(bgee_link_list, 1) .. '<br>' .. table.remove(bgee_link_list, 1) .. '<br>' .. table.remove(bgee_link_list, 1) .. '<br>'--get first 5 elements in table and use for display
end
if bgee_link_list[#bgee_link_list] then
bgee_links = table.concat(bgee_link_list, "<br>")
end
results = {bgee_title, bgee_collapse, bgee_default, bgee_links}
return results
end
 
p.renderRNAexpression = function(expression_images, entrez_gene, ensembl, bgee_expression)
local title = "[[Gene expression|RNA expression]] pattern" --**lclz**
local biogps_link = "[http://biogps.org/gene/"..entrez_gene.."/ More reference expression data]" --**lclz**
local biogps_title = "BioGPS"
biogps_title = "[http://biogps.org/ " .. biogps_title .. "]"
-- If no expression image exist in BioGPS, the N/A is displayed
if expression_images ~= "" then
biogps_link = "[http://biogps.org/gene/"..entrez_gene.."/ More reference expression data]" --**lclz**
else
expression_images = localNotApplicableStr
end
local bgee_title = bgee_expression[1]
local bgee_collapse = bgee_expression[2]
local bgee_default = bgee_expression[3]
local bgee_links = bgee_expression[4]
local bgee_more_link = ""
local ensembl_id = string.gsub(ensembl, "%s", "")
if bgee_links ~= localNotApplicableStr then
bgee_more_link = "[https://bgee.org/?page=gene&gene_id="..ensembl_id.." More reference expression data]" --**lclz**
bgee_default = "[https://bgee.org/?page=gene&gene_id="..ensembl_id.." '''"..bgee_default.."'''] " --**lclz**
else
bgee_default = ""
end
root
:tag('tr')
Line 1,179 ⟶ 1,127:
:done() --end tr
:tag('tr')
:tag('thtd')
:attr('scopecolspan', 'row4')
:css('backgroundtext-coloralign', sideTitleBGcolor'center')
:css('background-color', rowBGcolor)
:wikitext(bgee_title)
:wikitext(expression_images)
:done() --end th
:tagdone(') --end td')
:tag('table')
:attr('class', bgee_collapse)
:css('padding', '0')
:css('border', 'none')
:css('margin', '0')
:css('width', '100%')
:css('text-align', 'left')
:tag('tr')
:tag('td')
:attr('colspan', '1')
:tag('span')
:attr('class', 'plainlinks')
:wikitext(bgee_default)
:done() --end span
:done() --end td
:done() --end tr
:tag('tr')
:tag('td')
:attr('colspan', '1')
:tag('div')
:attr('class', 'plainlinks')
:wikitext(bgee_links)
:done() --end div
:done() --end td
:done() --end tr
:tag('tr')
:tag('td')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext(bgee_more_link)
:done() --end span
:done() --end td
:done() --end tr
:done() --end table
:done() --end td
:done() --end tr
:tag('tr')
:tag('th')
:attr('scope', 'row')
:css('background-color', sideTitleBGcolor)
:wikitext(biogps_title)
:done() --end th
:tag('td')
:tagattr('tablecolspan', '4')
:attrcss('classtext-align', bgee_collapse'center')
:css('paddingbackground-color', '0'rowBGcolor)
:csstag('border', 'nonespan')
:cssattr('marginclass', '0plainlinks')
:wikitext(biogps_link)
:css('width', '100%')
:cssdone('text) -align',-end 'left')span
:tag('tr')
:tag('td')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:wikitext(expression_images)
:done() --end td
:done() --end tr
:tag('tr')
:tag('td')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext(biogps_link)
:done() --end span
:done() --end td
:done() --end tr
:done() --end table
:done() --end td
:done() --end tr
Line 1,296 ⟶ 1,181:
:done() --end tr
:tag('tr')
:tag('tdth')
:css('background-color', sideTitleBGcolor)
:css('font-weight', 'bold')
:wikitext(mol_funct_title)
:done() --end tdth
:tag('td')
:css('background-color', rowBGcolor)
:tag('divspan')
:attr('class', 'plainlinks')
:wikitext(mol_funct)
:wikitextdone( '\n' ) --end newline before ending div tag, to ensure next section formats properlyspan
:done() --end div
:done() --end td
:done() --end tr
:tag('tr')
:tag('tdth')
:css('background-color', sideTitleBGcolor)
:css('font-weight', 'bold')
:wikitext(cell_comp_title)
:done() --end tdth
:tag('td')
:css('background-color', rowBGcolor)
:tag('divspan')
:attr('class', 'plainlinks')
:wikitext(cell_comp)
:wikitextdone( '\n' ) --end newline before ending div tag, to ensure next section formats properlyspan
:done() --end div
:done() --end td
:done() --end tr
:tag('tr')
:tag('tdth')
:css('background-color', sideTitleBGcolor)
:css('font-weight', 'bold')
:wikitext(bio_process_title)
:done() --end tdth
:tag('td')
:css('background-color', rowBGcolor)
:tag('divspan')
:attr('class', 'plainlinks')
:wikitext(bio_process)
:wikitextdone( '\n' ) --end newline before ending div tag, to ensure next section formats properlyspan
:done() --end div
:done() --end td
:done() --end tr
Line 2,264 ⟶ 2,143:
 
--general function to get value given an entity and property
p.getValue = function(entity, propertyID, return_val, sep)
 
local claims
if return_val == nil then return_val = "" end
iflocal sep == nil" then" sep--could =ad "as "input parameter if need endbe
if entity and entity.claims then
claims = entity.claims[propertyID]
Line 2,756 ⟶ 2,635:
local wiki_link = ""
if sitelink and result_GOID ~= nil then
wiki_link = "\n*<big>•</big> [" .. sitelink .. result_GOID .. " " .. label .."]<br>"
else
wiki_link = "\n*<big>•</big> [[:d:Q" .. v.mainsnak.datavalue.value["numeric-id"] .. "|" .. label .. "]]<br>"
end
overall_results[#overall_results+1] = wiki_link