local p = { }
local errorflag = 0
local navbar = require('Module:Navbar')._navbar
local infobox = require('Module:Infobox3cols').infobox
local infoboxImage = require('Module:InfoboxImage').InfoboxImage
if entity then --only require the main gene entity
--a list variables of all the data in the info box
local name = p.getLabel(entity)
--check every function call to avoid lua page errors better way to execute this??
local nameentrez_gene = ''p.getValue(entity, "P351")
local entrez_gene_mm = p.getValue(entity_mouse, "P351", "n/a")
if p.getLabel(entity) then name = p.getLabel(entity) else errorflag = 1 end
local image = p.getImage(entity, "P18", " ", "250px") --need to set size
local entrez_gene = ''
local uniprotID_hs = p.getValueProtein(entity_protein, "P352", "n/a")
if p.getValue(entity, "P351") then entrez_gene = p.getValue(entity, "P351") else errorflag = 1 end
local uniprotID_mm = p.getValueProtein(entity_mouse_protein, "P352", "n/a")
local entrez_gene_mm = ''
local pdbIDs = p.getPDB(entity_protein) --makes a list with links to RCSB
if p.getValue(entity_mouse, "P351", "n/a") then entrez_gene_mm = p.getValue(entity_mouse, "P351", "n/a") else errorflag = 1 end
local aliases = p.getAliases(entity)
local image = '' --need to set size
local gene_symbol = p.getValue(entity, "P353")
if p.getImage(entity, "P18", " ", "250px") then image = p.getImage(entity, "P18", " ", "250px") else errorflag = 1 end
local hgnc_id = p.getValue(entity, "P354")
local uniprotID_hs = ''
local homologene_id = p.getValue(entity, "P593")
if p.getValueProtein(entity_protein, "P352", "n/a") then uniprotID_hs = p.getValueProtein(entity_protein, "P352", "n/a") else errorflag = 1 end
local uniprotID_mmomim_id = ''p.getValue(entity, "P492")
local mgi_id = p.getValue(entity_mouse, "P671")
if p.getValueProtein(entity_mouse_protein, "P352", "n/a") then uniprotID_mm = p.getValueProtein(entity_mouse_protein, "P352", "n/a") else errorflag = 1 end
local ChEMBL_id = p.getValue(entity_protein, "P592")
local pdbIDs = '' --makes a list with links to RCSB
iflocal p.getPDB(entity_protein) then pdbIDsIUPHAR_id = p.getPDBgetValue(entity_protein, "P595") else errorflag = 1 end
local aliasesec_no = ''p.getValueProtein(entity_protein, "P591")
local mol_funct = p.getGO(entity_protein, "P680")
if p.getAliases(entity) then aliases = p.getAliases(entity) else errorflag = 1 end
local gene_symbolcell_comp = ''p.getGO(entity_protein, "P681")
local bio_process = p.getGO(entity_protein, "P682")
if p.getValue(entity, "P353") then gene_symbol = p.getValue(entity, "P353") else errorflag = 1 end
local expression_images = p.getImage(entity,"P692","<br><br>","250px")
local hgnc_id = ''
iflocal ensembl = p.getValue(entity, "P354P594") then hgnc_id = p.getValue(entity, "P354n/a") else errorflag = 1 end
local homologene_idensembl_mm = ''p.getValue(entity_mouse, "P594", "n/a")
local refseq_mRNA = p.getRefseq_mRNA(entity, "P639", "n/a")
if p.getValue(entity, "P593") then homologene_id = p.getValue(entity, "P593") else errorflag = 1 end
local refseq_mRNA_mm = p.getRefseq_mRNA(entity_mouse, "P639", "n/a")
local omim_id = ''
local refseq_prot = p.getRefseq_protein(entity_protein, "P637", "n/a")
if p.getValue(entity, "P492") then omim_id = p.getValue(entity, "P492") else errorflag = 1 end
local refseq_prot_mm = p.getRefseq_protein(entity_mouse_protein, "P637", "n/a")
local mgi_id = ''
local gstart = p.getChromosomeLoc(entity, "P644", "hg")
if p.getValue(entity_mouse, "P671") then mgi_id = p.getValue(entity_mouse, "P671") else errorflag = 1 end
local gend = p.getChromosomeLoc(entity, "P645", "hg")
local ChEMBL_id = ''
local chr = p.trimChromosome(entity)
if p.getValue(entity_protein, "P592") then ChEMBL_id = p.getValue(entity_protein, "P592") else errorflag = 1 end
local db = p.getAliasFromGenomeAssembly(entity,"hg")
local IUPHAR_id = ''
local gstart_mm = p.getChromosomeLoc(entity_mouse, "P644", "mm")
if p.getValue(entity_protein, "P595") then IUPHAR_id = p.getValue(entity_protein, "P595") else errorflag = 1 end
local gend_mm = p.getChromosomeLoc(entity_mouse, "P645", "mm")
local ec_no = ''
local db_mm = p.getAliasFromGenomeAssembly(entity_mouse,"mm")
if p.getValueProtein(entity_protein, "P591") then ec_no = p.getValueProtein(entity_protein, "P591") else errorflag = 1 end
local chr_mm = p.trimChromosome(entity_mouse)
local mol_funct = ''
local disease, dis_ref = p.getDisease(entity, "P2293")
if p.getGO(entity_protein, "P680") then mol_funct = p.getGO(entity_protein, "P680") else errorflag = 1 end
local drug = p.getDrug(entity_protein, "P129")
local cell_comp = ''
if p.getGO(entity_protein, "P681") then cell_comp = p.getGO(entity_protein, "P681") else errorflag = 1 end
local bio_process = ''
if p.getGO(entity_protein, "P682") then bio_process = p.getGO(entity_protein, "P682") else errorflag = 1 end
local expression_images = ''
if p.getImage(entity,"P692","<br><br>","250px") then expression_images = p.getImage(entity,"P692","<br><br>","250px") else errorflag = 1 end
local ensembl = ''
if p.getValue(entity, "P594", "n/a") then ensembl = p.getValue(entity, "P594", "n/a") else errorflag = 1 end
local ensembl_mm = ''
if p.getValue(entity_mouse, "P594", "n/a") then ensembl_mm = p.getValue(entity_mouse, "P594", "n/a") else errorflag = 1 end
local refseq_mRNA = ''
if p.getRefseq_mRNA(entity, "P639", "n/a") then refseq_mRNA = p.getRefseq_mRNA(entity, "P639", "n/a") else errorflag = 1 end
local refseq_mRNA_mm = ''
if p.getRefseq_mRNA(entity_mouse, "P639", "n/a") then refseq_mRNA_mm = p.getRefseq_mRNA(entity_mouse, "P639", "n/a") else errorflag = 1 end
local refseq_prot = ''
if p.getRefseq_protein(entity_protein, "P637", "n/a") then refseq_prot = p.getRefseq_protein(entity_protein, "P637", "n/a") else errorflag = 1 end
local refseq_prot_mm = ''
if p.getRefseq_protein(entity_mouse_protein, "P637", "n/a") then refseq_prot_mm = p.getRefseq_protein(entity_mouse_protein, "P637", "n/a") else errorflag = 1 end
local gstart = ''
if p.getChromosomeLoc(entity, "P644", "hg") then gstart = p.getChromosomeLoc(entity, "P644", "hg") else errorflag = 1 end
local gend = ''
if p.getChromosomeLoc(entity, "P645", "hg") then gend = p.getChromosomeLoc(entity, "P645", "hg") else errorflag = 1 end
local chr = ''
if p.trimChromosome(entity) then chr = p.trimChromosome(entity) else errorflag = 1 end
local db = ''
if p.getAliasFromGenomeAssembly(entity,"hg") then db = p.getAliasFromGenomeAssembly(entity,"hg") else errorflag = 1 end
local gstart_mm = ''
if p.getChromosomeLoc(entity_mouse, "P644", "mm") then gstart_mm = p.getChromosomeLoc(entity_mouse, "P644", "mm") else errorflag = 1 end
local gend_mm = ''
if p.getChromosomeLoc(entity_mouse, "P645", "mm") then gend_mm = p.getChromosomeLoc(entity_mouse, "P645", "mm") else errorflag = 1 end
local db_mm = ''
if p.getAliasFromGenomeAssembly(entity_mouse,"mm") then db_mm = p.getAliasFromGenomeAssembly(entity_mouse,"mm") else errorflag = 1 end
local chr_mm = ''
if p.trimChromosome(entity_mouse) then chr_mm= p.trimChromosome(entity_mouse) else errorflag = 1 end
local disease, dis_ref = ''
if p.getDisease(entity, "P2293") then disease, dis_ref = p.getDisease(entity, "P2293") else errorflag = 1 end
local drug = ''
if p.getDrug(entity_protein, "P129") then drug = p.getDrug(entity_protein, "P129") else errorflag = 1 end
--define Global Color Scheme
rowBGcolor = '#eee'
sideTitleBGcolor = '#c3fdb8'
p.createTable()
p.renderUpperTitle(name)
if errorflag == 1 then
--p.renderCaption()
return("DISPLAY ERROR: Infobox Gene cannot be displayed as one of the values is generating an error")
p.renderImage(image)
else
p.renderAvailableStructures(uniprotID_hs, uniprotID_mm, checkOrtholog, pdbIDs) --PDB info
p.createTable()
p.renderIdentifiers(aliases, hgnc_id, gene_symbol, homologene_id, omim_id, mgi_id, ChEMBL_id, IUPHAR_id, ec_no, entrez_gene)
p.renderUpperTitle(name)
if (disease ~= "" and dis_ref ~= "") then --removes section from those items without disease info
--p.renderCaption()
p.renderDiseases(disease, dis_ref)
p.renderImage(image)
end
p.renderAvailableStructures(uniprotID_hs, uniprotID_mm, checkOrtholog, pdbIDs) --PDB info
p.renderIdentifiers(aliases, hgnc_id, gene_symbol, homologene_id, omim_id, mgi_id, ChEMBL_id, IUPHAR_id, ec_no, entrez_gene)
if (disease ~= "" and dis_ref ~= "") then --removes section from those items without disease info
p.renderDiseases(disease, dis_ref)
end
if (drug ~= "" ) then --removes section from those items without drug info
p.renderDrug(drug)
end
if (mol_funct ~= "" and cell_comp ~= "" and bio_process ~= "") then
p.renderGeneOntology(mol_funct, cell_comp, bio_process, uniprotID_hs)
end
if expression_images ~= "" then
p.renderRNAexpression(expression_images, entrez_gene)
end
p.renderOrthologs(entrez_gene, entrez_gene_mm, ensembl, ensembl_mm, uniprotID_hs, uniprotID_mm, refseq_mRNA, refseq_mRNA_mm, refseq_prot, refseq_prot_mm, db, chr, gstart, gend, db_mm, chr_mm, gstart_mm, gend_mm)
p.renderFooter(root_qid, mm_qid)
p.renderFooter(root_qid, mm_qid)
return tostring(root)
return tostring(root)
else return "An Error has occurred retrieving Wikidata item for infobox"
end
end
else return "An Error has occurred retrieving Wikidata item for infobox" end
end
out = "M"
end
return out
end
|