User:Was a bee/Infobox gene/doc

This is the Infobox gene template. The data in the infobox is sourced from wikidata. The lua implementation of this template is located at Module:Infobox_gene

Usage on a gene page
Append to the top of a gene page. The infobox is populated via the Wikidata item of the page it resides on. To view which wikidata item is linked to a page, follow the "Wikidata items" link from the "Tools" menu to the left of the article.

Usage on a protein page
Append to the top of a protein page. The infobox is populated by using the Wikidata item of the protein to find the encoded gene item and then uses the gene item to populate the infobox.

Usage on other pages
Any page can display the infobox even if it does not have a gene or protein interwiki link. The Wikidata item must be explicitly added as a parameter and the underlying module is invoked. For instance, appending to the top of any page will create an infobox for the gene RELN. QID is the wikidata gene item used to populate the infobox. Substitute the wikidata item id (QID) of interest as the QID parameter.

Error message
"An Error has occurred retrieving Wikidata item for infobox" Indicates a non gene/protein Wikidata item or an incomplete Wikidata item.

Categories
Including this template will automatically result in the addition of relevant categories based on the properties of the gene. These include Category:Human proteins and categories that correspond to the chromosome where the gene is located, such as Category:Genes on human chromosome 19. Other categories added manually to the article apart from the template will work as usual.

Data structure
Data structure of gene and protein data in Wikidata is a bit complex. Even if there is only one gene/protein article in Wikipedia, there are many data pages in Wikidata.

Basically Wikidata has distinct pages for gene and protein each, for respective species (See the table below). And pages are interconnected based on following rules.
 * Wikipedia articles are connected to Wikidata's gene data page or protein data page  through d:Help:Sitelinks. In most cases, articles are connected to gene data page.
 * Gene and protein pages are interconnected through "encodes (d:P:P688)" and "encoded by (d:P:P702)" property claims (horizontal arrows "→", "←" in the table).
 * Gene pages from different species are interconnected through "ortholog (d:P:P684)" property claims (vertical arrows "↑", "↓" in the table).

The data which infobox_gene shows to readers are collected from somewhere of this interconnected Wikidata pages. Foe example, and so on.
 * data is from "Human gene page"
 * data is from "Mouse protein page"

To get QID of each pages, User:Was a bee/Infobox gene/sub is used.

Case A
In most cases, Wikipedia article page is connected to Human gene data page. For example, Sonic hedgehog.

Case B
In some cases, Wikipedia article page is connected to Human protein data page. For example, Reelin.

Data location
The followings are list of data which are used in this template. Showing the code example and data location in the case of Sonic hedgehog.

Installation
This section explains how to install this template into your language edition. If this works properly, that's all.
 * 1) Copy Template:infobox gene to your language project.
 * 2) Then localize texts into your language (you can find corresponding texts easily by searching " " with  )
 * 3) Copy Template:infobox gene/sub to sub page of copied template. No localization needed on this page.

If you got error(s), checking following points.
 * 1) Check whether Template:Wikidata and Module:wd are installed in your wiki. If not, copy-and-paste that to your wiki.
 * 2) If installed, check the version of the module. Older version (before Sep. 2017) doesn't have some functionalities used in this template. If version is old, copy-and-paste the latest version to your wiki.
 * 3) Many other templates and modules are used.

On categories (under development)
 * 1) If you make categories like Category:Genes on human chromosome 1 in your language edition
 * 2) and create d:Help:Sitelinks,
 * 3) this template detect that and automatically categorize each pages into corresponding categories.

Similar templates

 * Template:Infobox protein
 * Template:Infobox enzyme
 * Template:Infobox protein family
 * Template:Infobox nonhuman protein
 * Template:GNF Protein box - historical?