Module:Infobox gene: Difference between revisions

Created page with "local p = {} local localSeparatorStr = "," -- **lclz** Correct it if your wiki has different setting, like zhwiki uses "、" for now local localNotApplicableStr = "n/a" -- **lclz** local root --define Global Color Scheme local rowBGcolor = '#eee' local titleBGcolor = '#ddd' local sideTitleBGcolor = '#c3fdb8' -- wrapped "protected call", return "value error" with error info on error local function check_values(f,args) --local u= table.upack(args) local exist, val = p..."
 
No edit summary
 
Line 23: Line 23:


--texts relevant to localization are tagged with --**lclz** and/or *lclz*
--texts relevant to localization are tagged with --**lclz** and/or *lclz*
--on a page {{#invoke:Sandbox/genewiki/alllua|getTemplateData|QID=Q14865053}}
--on a page {{#invoke:Sandbox/genewiki/alllua|getTemplateData|QID=Q21442}}
--in debug window
--in debug window
--frame = mw.getCurrentFrame()
--frame = mw.getCurrentFrame()
--frame.args = {QID="Q14865053"} Q18031325
--frame.args = {QID="Q21442"} Q21443
--print(p.getTemplateData(frame))
--print(p.getTemplateData(frame))
function p.getTemplateData(frame)
function p.getTemplateData(frame)
Line 42: Line 42:
local checkOrtholog = "" --flag used to see if mouse data avaliable
local checkOrtholog = "" --flag used to see if mouse data avaliable


local mouse_propertyID = "P684" --actually ortholog property additional orthologs can exist
local mouse_propertyID = "P954" --actually ortholog property additional orthologs can exist
local protein_propertyID = "P688"
local protein_propertyID = "P955"


--get root gene entity
--get root gene entity
Line 60: Line 60:
local claims
local claims
if entity.claims then
if entity.claims then
claims = entity.claims["P702"] --encoded by
claims = entity.claims["P956"] --encoded by
end
end
if claims then
if claims then
Line 99: Line 99:
claims = entity.claims[mouse_propertyID]
claims = entity.claims[mouse_propertyID]
end
end
local qualifierID = "P703" --found in taxon
local qualifierID = "P268" --found in taxon
local mouse_qual = "Q83310"
local mouse_qual = "Q21448"
if claims then
if claims then
if (claims[1] and claims[1].mainsnak.snaktype == "value" and claims[1].mainsnak.datavalue.type == "wikibase-entityid") then
if (claims[1] and claims[1].mainsnak.snaktype == "value" and claims[1].mainsnak.datavalue.type == "wikibase-entityid") then
Line 111: Line 111:
local quals
local quals
if v.qualifiers then
if v.qualifiers then
quals = v.qualifiers.P703
quals = v.qualifiers.P268
end
end
if quals then
if quals then
Line 149: Line 149:
--a list variables of all the data in the info box
--a list variables of all the data in the info box
local name = check_values(p.getLabel,{entity})
local name = check_values(p.getLabel,{entity})
local bgee_wikidata_id = 'Q54985720'
local bgee_wikidata_id = 'Q21449'
local expressed_in_tissues = check_values(p.getValue, {entity, "P5572", localNotApplicableStr, localSeparatorStr, bgee_wikidata_id}) --P5572: expressed in
local expressed_in_tissues = check_values(p.getValue, {entity, "P957", localNotApplicableStr, localSeparatorStr, bgee_wikidata_id}) --P5572: expressed in
local expressed_in_mouse_tissues = check_values(p.getValue, {entity_mouse, "P5572", localNotApplicableStr, localSeparatorStr, bgee_wikidata_id}) --P5572: expressed in
local expressed_in_mouse_tissues = check_values(p.getValue, {entity_mouse, "P5572", localNotApplicableStr, localSeparatorStr, bgee_wikidata_id}) --P5572: expressed in
local entrez_gene = check_values(p.getValue, {entity, "P351", localNotApplicableStr} )
local entrez_gene = check_values(p.getValue, {entity, "P958", localNotApplicableStr} )
local entrez_gene_mm = check_values(p.getValue, {entity_mouse, "P351", localNotApplicableStr})
local entrez_gene_mm = check_values(p.getValue, {entity_mouse, "P958", localNotApplicableStr})
local image = check_values( p.getImage, {entity, "P18", " ", "250px"}) --need to set size
local image = check_values( p.getImage, {entity, "P3", " ", "250px"}) --need to set size
local uniprotID_hs = check_values(p.getValueProtein, {entity_protein, "P352", localNotApplicableStr})
local uniprotID_hs = check_values(p.getValueProtein, {entity_protein, "P959", localNotApplicableStr})
local uniprotID_mm = check_values(p.getValueProtein, {entity_mouse_protein, "P352", localNotApplicableStr})
local uniprotID_mm = check_values(p.getValueProtein, {entity_mouse_protein, "P959", localNotApplicableStr})
local pdbIDs = check_values(p.getPDB, {entity_protein}) --makes a list with links to RCSB
local pdbIDs = check_values(p.getPDB, {entity_protein}) --makes a list with links to RCSB
local aliases = check_values(p.getAliases, {entity})
local aliases = check_values(p.getAliases, {entity})
local gene_symbol = check_values(p.getValue, {entity, "P353"})
local gene_symbol = check_values(p.getValue, {entity, "P960"}) -- ここまで変更済み
local hgnc_id = check_values(p.getValue, {entity, "P354"})
local hgnc_id = check_values(p.getValue, {entity, "P354"})
local homologene_id = check_values(p.getValue, {entity, "P593"})
local homologene_id = check_values(p.getValue, {entity, "P593"})