Module talk:Infobox gene/Archive 2

Rendering of bgee_default is broken at SPI1
The rendering of bgee_default is broken at SPI1. Something in the logic is creating a URL link that attempts to wrap around a five-element bulleted list. This problem is also observable at Allograft inflammatory factor 1. – Jonesey95 (talk) 17:42, 11 February 2022 (UTC)
 * This appears to be due to an edit I did for, alias BgeeDB, back in October. Looking at the code, I don't know enough Lua to figure out how to unwrap the Bgee link from around the bulleted list. Hopeful that Tarsmf will be able to fix this.  P.I. Ellsworth &numsp;- ed.  put'r there 14:22, 12 February 2022 (UTC)
 * in addition, there are two Linter errors, apparently identical and caused by Ibox gene, on the two pages you mention above.  P.I. Ellsworth &numsp;- ed.  put'r there 16:36, 12 February 2022 (UTC)
 * Yes, that is why I reported the bug. – Jonesey95 (talk) 19:53, 12 February 2022 (UTC)
 * Okay, the October edits that added Bgee have been removed until editor Tarsmf can test them further. And btw, the Linter errors have disappeared from those two articles.  P.I. Ellsworth &numsp;- ed.  put'r there 22:38, 12 February 2022 (UTC)

Changes to include gene expression calls via "expressed in" statements from Wikidata / Bgee database
The code below adds into the Wikipedia "infobox gene" the "expressed in" assertions of human genes available in Wikidata from the Bgee database (www.bgee.org) to the "RNA expression pattern" section in the infobox. These assertions per gene are at most the top 10 anatomic entities (tissues) where a gene is expressed.

The code is available in the sandbox at https://en.wikipedia.org/wiki/Module:Infobox_gene/sandbox and tested in https://en.wikipedia.org/w/index.php?title=Module_talk:Infobox_gene/testcases infobox gene testcase talk.

Change preview
Let us take as an example the WikidataRELN gene, the code below gets "expressed in" Wikidata property values and assign them to a "Bgee DB" row in the section "RNA expression pattern" of the infobox at Reelin gene.

Change: add line into "if" clause around line 148
Add the code below at line 148, for example.

Change: add "sep" as an argument of getValue function
It also set  as default by replacing line 2149

CHANGE line 2145 TO CHANGE line 2149 TO

Change: lines 212-214, to include Bgee DB conditions and arguments
CHANGE TO

Change: add Bgee database to the RNA expression render function
This function should replace the current one starting at line 1104. CHANGE TO

BgeeDB (talk) 14:13, 13 October 2021 (UTC)
 * ✅.  P.I. Ellsworth &numsp;- ed.  put'r there 20:22, 23 October 2021 (UTC)
 * . Had to revert for now; please see User talk:Paine Ellsworth#Infobox gene, which shows that this edit caused linking to disambiguation pages from mainspace articles, and that's a no-no. So this edit needs to be fixed.  P.I. Ellsworth &numsp;- ed.  put'r there 20:56, 24 October 2021 (UTC)
 * Reping since the user was renamed. * Pppery * it has begun...  21:02, 24 October 2021 (UTC)
 * Curious,, if red links notify, then why wouldn't redirects notify?  P.I. Ellsworth &numsp;- ed.  put'r there 21:07, 24 October 2021 (UTC)
 * Thank you all very much for noticing the ambiguity issue. To avoid any kind of ambiguity I have removed the links to Wikipedia pages. Is it okay for you? Thanks for taking care! Tarsmf (talk) 07:34, 25 October 2021 (UTC)
 * Wish I knew more detail about LUA, but if we have your assurance that the sandbox code has been improved and will not load dab pages with a lot of article links, then yes I'm okay with it. So to be clear, you're saying that the sandbox code is ready to go?  P.I. Ellsworth &numsp;- ed.  put'r there 09:45, 25 October 2021 (UTC)
 * Yes, I have changed the part concerning the wikipedia links of anatomical entities to be all a simple text instead of links. You can see in the example above of the RELN gene, how it is now in the sandbox, also here https://en.wikipedia.org/w/index.php?title=Module_talk:Infobox_gene/testcases . Thanks a lot! Tarsmf (talk) 11:58, 25 October 2021 (UTC)
 * Okay then, and ✅ once again.  P.I. Ellsworth &numsp;- ed.  put'r there 12:52, 25 October 2021 (UTC)

To make it a little easier for editor the October edit request has been included above in the collapsed section.  P.I. Ellsworth &numsp;- ed.  put'r there 22:56, 12 February 2022 (UTC)

the Bgee code has been re-added to Module:Infobox gene/sandbox and the SPI1 & AIF1 infoboxes have been set up as test cases at Module talk:Infobox gene/testcases so you can see what was happening in the "RNA expression pattern" sections of the iboxes.  P.I. Ellsworth &numsp;- ed.  put'r there 05:33, 14 February 2022 (UTC)
 * and Thanks for reporting the issues. I have corrected them, please let me know if there is any other concern. The latest code is available in the sandbox at Module:Infobox gene/sandbox and tested with the reported examples at Module talk:Infobox gene/testcases. Sorry for not being able to correct it promptly, I have just seen this bug report today (I have to check why I am not receiving email notifications from Wikipedia).  Tarsmf (talk) 16:48, 18 February 2022 (UTC)

looks like this has been repaired, so the Bgee edits have been reinstated in this template. Testing should continue so that any future anomalies will be quickly fixed.  P.I. Ellsworth &numsp;- ed.  put'r there 00:47, 20 February 2022 (UTC)

ensembl_id is nil
A few articles (examples: C2orf16, MKKS) are showing: "Lua error in Module:Infobox_gene at line 1153: attempt to concatenate local 'ensembl_id' (a nil value)."

That is because line 1150 is: but the pattern was not found so  was returned. Line 167 set ensembl: That's probably because has no  entry. At any rate, if there is a default ensembl value that would help, it could easily be added by appending  to line 167.

By the way, the module has 18 global variables due to missing "local". I could fix them if wanted as they are undesirable. Johnuniq (talk) 02:57, 20 February 2022 (UTC)
 * thanks for reporting it, this issue is now corrected (latest code at Module:Infobox gene/sandbox) and tested at Module talk:Infobox gene/testcases Tarsmf (talk) 08:09, 20 February 2022 (UTC)
 * I changed your edit because it is much better to use Lua's conventions. Then I couldn't resist cleaning up some whitespace issues: using tabs for indents, omit trailing space. I'll leave the globals for now but they should be fixed. Johnuniq (talk) 08:49, 20 February 2022 (UTC)
 * thanks but now it is producing a new error for AIF1 see Module talk:Infobox gene/testcases "Lua error in Module:Infobox_gene/sandbox at line 753: attempt to perform arithmetic on local 'gend' (a string value)." Tarsmf (talk) 08:52, 20 February 2022 (UTC)
 * I'll have a look at that soon, I hope, but the problem has been there a while. I just edited two old revisions of Module:Infobox gene/sandbox (at 07:55, 20 February 2022 and at 16:31, 18 February 2022) and previewed them with Module talk:Infobox gene/testcases. They both show "Lua error in Module:Infobox_gene/sandbox at line 753: attempt to perform arithmetic on local 'gend' (a string value)". Johnuniq (talk) 09:06, 20 February 2022 (UTC)
 * Wow this is strange, because the latest version at Module talk:Infobox gene based on 16:31, 18 February 2022 does not show this error. Moreover, the variable "gend" was never edited by me Tarsmf (talk) 09:17, 20 February 2022 (UTC)
 * I don't follow that. Your permalink is the same as mine and I just tried it again. It gives the gend error for the testcases. Johnuniq (talk) 09:29, 20 February 2022 (UTC)
 * Sorry, what I was trying to say is that the deployed version for the Module:Infobox_gene 00:41, 20 February 2022 seems to be based on 16:31, 18 February 2022 and it is not showing the "gend" error for the Wikipedia gene page AIF1. Tarsmf (talk) 09:42, 20 February 2022 (UTC)
 * The reason gend is giving an error is that its value is a non-numeric string, namely "VALUE_ERROR (too many expensive function calls)". There might be some inefficiency in the module, or more likely, there are too many calls on the testcases page and it is blowing up. I noticed check_values and wondered if it mightn't be better to raise an error to make it clear there is a problem. Regarding gstart and gend, what should happen is that they get converted to numbers with an error displayed if that fails. Currently the code relies on Lua's quirk of silently converting numeric strings to numbers when asked to do arithmetic. That's fine, but it leads to weird error messages like this one. Johnuniq (talk) 09:47, 20 February 2022 (UTC)

The sandbox works better at the two articles cited, C2orf16 & MKKS. Question is, what might be broken elsewhere? Sandbox seems to be okay at the AIF1 article as well, which is curious as to why it gives the Lua error on the test cases page, but not in the article?  P.I. Ellsworth &numsp;- ed.  put'r there 09:55, 20 February 2022 (UTC)
 * As figured out by Johnuniq, the arithmetic issue happens because of too many calls in the test cases page, therefore this issue will not happen in the wikipedia articles (just one call). Then, in my opinion, we can deploy the latest version edited by Johnuniq at Module:Infobox gene/sandbox, mainly to solve the issue "ensembl_id is nil". Thanks!  Tarsmf (talk) 10:29, 20 February 2022 (UTC)
 * Then let's give it a good shot. Looks so much better at C2orf16 & MKKS! noties to & . The AIF1 test case has been split off to Module talk:Infobox gene/testcases 2.  P.I. Ellsworth &numsp;-  ed.  put'r there 19:32, 20 February 2022 (UTC)

Global variables
I've done some more cleaning in Module:Infobox gene/sandbox. Please let me know if anyone really likes how it was before but I think the whitespace changes accord with how most modules are written.

I mentioned that global variables are a problem. As an example, search to find: That has a typo (double underscore) which means the line effectively does nothing. I'm not sure if the line should be deleted or if the typo should be fixed.

I fixed a couple of easy globals but there are several others that require knowledge of the logic of the module. For example, see  which uses the undefined. Presumably that should be a function parameter?

Another problem is in  which has the line where  is undefined.

There are a few variables which appear to be intended as global to the module. For example,  and. I assume that no other module needs access to these globals, so there should be some lines at the top (before any functions) with (or put them on separate lines with a comment on each indicating its purpose). Johnuniq (talk) 02:42, 21 February 2022 (UTC)
 * I have finished cleaning Module:Infobox gene/sandbox and there are no longer any global variables. The behavior of the module should be unchanged but the testcases are very hard to check in detail—they look ok. I'll leave this for a short while but will return to copy the changes to Module:Infobox gene because that's the only real test. Johnuniq (talk) 06:36, 23 February 2022 (UTC)
 * For me it sounds quite good! I think it is ready for deployment too, I did a quick inspection and I did not notice any change in the code logic/behaviour. Tarsmf (talk) 08:37, 23 February 2022 (UTC)
 * Agree. Well, editor wrote of several issues with this module plus a lot of hard work, and I know I appreciate what you've done here, ! Appears to be ready to go.  P.I. Ellsworth &numsp;-  ed.  put'r there 14:01, 23 February 2022 (UTC)
 * Thanks for checking. I have updated the module from the sandbox. Johnuniq (talk) 00:31, 24 February 2022 (UTC)

Including mouse gene expression and updating Bgee links
The code available at Module:Infobox_gene/sandbox includes gene expression data into the "RNA expression pattern section" for the orthologous gene in Mouse of a given Human gene.

At the code level, mainly the following functions in the code had changes:

Tests were successfully performed according to the use cases at Module_talk:Infobox_gene/testcases.

All changes comparing the sandbox and the deployed Wikipedia gene article pages can be visualised at https://en.wikipedia.org/w/index.php?title=Module%3AInfobox_gene%2Fsandbox&type=revision&diff=1088153740&oldid=1074398347 Tarsmf (talk) 13:48, 16 May 2022 (UTC)


 * Hi @Paine Ellsworth, since I did not get any reply, I am directly contacting you for help to see if there is any chance for this update to be considered. In summary there are two main aspects:
 * - Update Bgee links (that will be broken by next year)
 * - Provide gene expression information of the corresponding Mouse gene (model organism for human). Note that the orthologous gene (corresponding gene) in Mouse is already provided in the infobox "Orthologs section" and with this update we also provide the gene expression for the corresponding mouse gene.
 * Thanks for your help! Tarsmf (talk) 15:40, 19 July 2022 (UTC)
 * .  P.I. Ellsworth &thinsp;, ed.  put'r there 16:35, 19 July 2022 (UTC)
 * Okay, editor, the sandbox has been ✅ to the live template. Since the changes were involved, let's be vigilant and hope that no other editors find problems with the edits. If there is any update needed to the template documentation, please see to that also.  P.I. Ellsworth &thinsp;,  ed.  put'r there 21:35, 19 July 2022 (UTC)
 * Thank you very much for the prompt reply! Tarsmf (talk) 08:06, 20 July 2022 (UTC)
 * my pleasure!  Paine  15:51, 20 July 2022 (UTC)

Template-protected edit request on 21 July 2022
Change Line 2833 from

to

This should fix an issue where items with depreciated GOIDs listed in Wikidata generate non-functional links with unexpected display text, such as what is visible on Lactoferrin. WelpThatWorked (talk) 15:17, 21 July 2022 (UTC)
 * You say "should fix an issue..." This module is used on thousands of pages. Has this been tested?  P.I. Ellsworth &thinsp;, ed.  put'r there 22:01, 21 July 2022 (UTC)
 * I've tested the change with the sandbox console to generate infoboxes for several pages that currently use it, and it has generated the output I expected each time, with the only change being that entities with depreciated GOID entries display correctly, linking to the "normal" ranked GOID, rather than generating a broken link. It relies on the GOID rankings on wikidata being set properly, but they're already set correctly for every entity I've checked so far, and if there are any that aren't, the resulting output would not be more broken than it already is. Is there any other testing I should do? WelpThatWorked (talk) 23:57, 21 July 2022 (UTC)
 * That should do it, hopefully, and ✅.  P.I. Ellsworth &thinsp;, ed.  put'r there 05:09, 22 July 2022 (UTC)

Request to uncollapse ""Orthologs" data
Thanks for including the mouse gene expression and updating Bgee links. A side effect of these edits is that the "RNA expression pattern" is displayed uncollapsed and the "Orthologs" data is displayed collapsed. In my opinion, the "RNA expression pattern" data, while useful is probably of lower importance than the external links to Entrez, UniProt, etc. contained in the "Orthologs" table. Furthermore, the "Orthologs" data in the past has never been collapsed. I have been able to collapse the "RNA expression pattern" table in this edit. But I cannot figure out how to uncollapse the "Orthologs" table. (Your edits did not seem to involve this table, so I am really puzzled why this table is now collapsed). I would appreciate if you could restore the "Orthologs" data to its default uncollapsed state. Thanks. Boghog (talk) 09:24, 24 July 2022 (UTC)


 * Opps! Never mind. I figured it out and implemented in this edit. Boghog (talk) 09:35, 24 July 2022 (UTC)
 * ✅.  P.I. Ellsworth &thinsp;, ed.  put'r there 09:46, 24 July 2022 (UTC)

Request to add Expression Atlas links
Initial disclaimer: I am the Lead Developer of Expression Atlas and Single Cell Expression Atlas web applications (https://www.ebi.ac.uk/people/person/alfonso-munoz-pomer-fuentes/).

A couple of years ago a proposal to add Expression Atlas to the infobox was briefly discussed. I’d like to bring the topic back, and gauge how much interest there is in the community. I’ve been hacking around the Lua code and I got to add three useful links for a given gene: bulk baseline expression (e.g. mRNA-seq experiments), bulk differential expression (e.g. microarray experiments) and single-cell expression (single cell RNA-seq).

See an example below. Feel free to offer any suggestions. I’m not very knowledgeable in Lua, but I tried to follow the conventions I saw in the module.

File:Infobox gene (sandbox) with Expression Atlas links.png – Alfonso Muñoz-Pomer Fuentes (talk) 16:44, 4 August 2022 (UTC)

Template-protected edit request on 2 March 2023
Error: [778:86] invalid escape sequence near '\:' مهدی بهرامی مطلق (talk) 16:29, 2 March 2023 (UTC)


 * Not sure where you saw this error, but I believe \: and \; are not required, please check diff &mdash; Martin (MSGJ · talk) 21:51, 3 March 2023 (UTC)
 * That was a massive and very productive edit! I didn't check all the details but it looked good and fixed the reported problem. Johnuniq (talk) 01:10, 4 March 2023 (UTC)
 * Had my Lua-challenged mind puzzled! Seems that the error is found in the [edit screen] . Click on the red x-box at the bottom of the edit screen to actually see the error. That does not appear in the sandbox's edit screen.  P.I. Ellsworth &thinsp;, ed.  put'er there 07:42, 4 March 2023 (UTC)
 * ✅ * Pppery * it has begun... 22:14, 4 March 2023 (UTC)