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= | --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=" | --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 = " | local mouse_propertyID = "P954" --actually ortholog property additional orthologs can exist | ||
local protein_propertyID = " | 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[" | 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 = " | local qualifierID = "P268" --found in taxon | ||
local mouse_qual = " | 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. | 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 = ' | local bgee_wikidata_id = 'Q21449' | ||
local expressed_in_tissues = check_values(p.getValue, {entity, " | 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, " | local entrez_gene = check_values(p.getValue, {entity, "P958", localNotApplicableStr} ) | ||
local entrez_gene_mm = check_values(p.getValue, {entity_mouse, " | local entrez_gene_mm = check_values(p.getValue, {entity_mouse, "P958", localNotApplicableStr}) | ||
local image = check_values( p.getImage, {entity, " | local image = check_values( p.getImage, {entity, "P3", " ", "250px"}) --need to set size | ||
local uniprotID_hs = check_values(p.getValueProtein, {entity_protein, " | local uniprotID_hs = check_values(p.getValueProtein, {entity_protein, "P959", localNotApplicableStr}) | ||
local uniprotID_mm = check_values(p.getValueProtein, {entity_mouse_protein, " | 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, " | 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"}) |