跳转到内容

模組討論:Infobox gene

页面内容不支持其他语言。
维基百科,自由的百科全书

这是本页的一个历史版本,由Jimmy-bot留言 | 贡献2017年2月5日 (日) 08:42 (机器人: 1个讨论已存档)编辑。这可能和当前版本存在着巨大的差异。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)

Jimmy-bot在话题“Module:Infobox gene”中的最新留言:8年前

Module:Infobox gene

有個功能是自動幫條目加上[[分類:位於XX號人類染色體的基因]],但把模組移來zhwiki以後就抓不到號碼了。

例子請參考d:Q14865372en:Dopamine_transporter多巴胺轉運體

用來抓染色體號的code:

p.trimChromosome = function(entity)
	local string_to_trim = p.getValue(entity, "P1057")
	local out = ''
	if string.find(string_to_trim, 'chromosome') then
		out = string.match(string_to_trim, "%d+")--extract number from string
		if out == nil then
			out = string.match(string_to_trim, "X") or string.match(string_to_trim, "Y")
		end
	end
	if string.find(string_to_trim, 'mitochondrial') then
		out = "M"
	end
	return out	
end

—以上未簽名的留言由Panintelize對話貢獻)於2017-01-26T04:29‎Z加入。

用RELN(Q414043)的例子的话,其染色体(P1057)值为Q657319(#7),getValue 好像是会给个链接。在本来的英语代码中是:
如果存在“chromosome”,则寻找数字或X、Y;否则尝试寻找“mitochondrial”。
我们在中文维基百科测试一下吧:
{{#invoke:Wikidata|getValueFromID|Q414043|P1057|FETCH_WIKIDATA}}
[[7號染色體|7號染色體]]
也许改成找“染色體”或“染色体”就好了?——Artoria2e5 保持讨论完整直接ping我回复 2017年1月26日 (四) 06:04 (UTC)回复
完成 Special:Diff/42962820 ——Artoria2e5 保持讨论完整直接ping我回复 2017年1月26日 (四) 06:09 (UTC)回复