Content deleted Content added
fixed code which doesn't generate Lua error in mtDNA gene pages |
|||
Line 200:
--end
if (
p.renderGeneLocation(frame, chr, gstart, gend, db, ensembl, chr_mm, gstart_mm, gend_mm, db_mm, ensembl_mm, name)
end
if expression_images ~= "" then
p.renderRNAexpression(expression_images, entrez_gene)
end
if (mol_funct ~= "" and cell_comp ~= "" and bio_process ~= "") then
p.renderGeneOntology(mol_funct, cell_comp, bio_process, uniprotID_hs)
end
p.renderOrthologs(frame, 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)
Line 665 ⟶ 668:
end
end
p.renderGeneLocation = function(frame, chr, gstart, gend, db, ensembl, chr_mm, gstart_mm, gend_mm, db_mm, ensembl_mm, name)
local titleHuman = "Gene ___location (Human)" --**lclz**
local titleMouse = "Gene ___location (Mouse)" --**lclz**
local label_chr = "[[Chromosome|Chr.]]" --**lclz**
local label_locus = "[[Locus (genetics)|Band]]" --**lclz**
local label_gstart = "Start" --**lclz**
local label_gend = "End" --**lclz**
local tooltip_arrowSign = "Genomic ___location for "..name --**lclz**
local arrowSign_width = 14
if chr ~= "" and gstart ~= "" and gend ~= "" then
--Chromosome lengths are from GRCh38.p10 https://www.ncbi.nlm.nih.gov/grc/human/data?asm=GRCh38.p10
--This table is used only for calculating "Where should red-rectangle put?"
--Curretly, Aug 2017, it seems all gene data, which are stored in Wikidata, have start/end positions based on GRCh38.
local chrLengthTable = {}
chrLengthTable["1"] = 248956422
chrLengthTable["2"] = 242193529
chrLengthTable["3"] = 198295559
chrLengthTable["4"] = 190214555
chrLengthTable["5"] = 181538259
chrLengthTable["6"] = 170805979
chrLengthTable["7"] = 159345973
chrLengthTable["8"] = 145138636
chrLengthTable["9"] = 138394717
chrLengthTable["10"] = 133797422
chrLengthTable["11"] = 135086622
chrLengthTable["12"] = 133275309
chrLengthTable["13"] = 114364328
chrLengthTable["14"] = 107043718
chrLengthTable["15"] = 101991189
chrLengthTable["16"] = 90338345
chrLengthTable["17"] = 83257441
chrLengthTable["18"] = 80373285
chrLengthTable["19"] = 58617616
chrLengthTable["20"] = 64444167
chrLengthTable["21"] = 46709983
chrLengthTable["22"] = 50818468
chrLengthTable["X"] = 156040895
chrLengthTable["Y"] = 57227415
chrLengthTable["MT"] = 16569
local chrLength = chrLengthTable[chr]
--Different languages have different word order.
local chrTextTable = {}--**lclz**
chrTextTable["1"] = "Chromosome 1 (human)"
chrTextTable["2"] = "Chromosome 2 (human)"
chrTextTable["3"] = "Chromosome 3 (human)"
chrTextTable["4"] = "Chromosome 4 (human)"
chrTextTable["5"] = "Chromosome 5 (human)"
chrTextTable["6"] = "Chromosome 6 (human)"
chrTextTable["7"] = "Chromosome 7 (human)"
chrTextTable["8"] = "Chromosome 8 (human)"
chrTextTable["9"] = "Chromosome 9 (human)"
chrTextTable["10"] = "Chromosome 10 (human)"
chrTextTable["11"] = "Chromosome 11 (human)"
chrTextTable["12"] = "Chromosome 12 (human)"
chrTextTable["13"] = "Chromosome 13 (human)"
chrTextTable["14"] = "Chromosome 14 (human)"
chrTextTable["15"] = "Chromosome 15 (human)"
chrTextTable["16"] = "Chromosome 16 (human)"
chrTextTable["17"] = "Chromosome 17 (human)"
chrTextTable["18"] = "Chromosome 18 (human)"
chrTextTable["19"] = "Chromosome 19 (human)"
chrTextTable["20"] = "Chromosome 20 (human)"
chrTextTable["21"] = "Chromosome 21 (human)"
chrTextTable["22"] = "Chromosome 22 (human)"
chrTextTable["X"] = "X chromosome (human)"
chrTextTable["Y"] = "Y chromosome (human)"
chrTextTable["MT"] = "Mitochondrial DNA (human)"
local chrText = chrTextTable[chr]
--about the calculation below, see https://en.wikipedia.org/wiki/User:Was_a_bee/Gene#3._Calculation_detail
local markerWidth = ((gend - gstart) * 294.133 )/ chrLength
if markerWidth < 2 then
markerWidth = 2
else
markerWidth = math.ceil(markerWidth)
end
local markerLocation = (147.0666 * (gstart + gend) / chrLength ) + 1.6 - (markerWidth / 2)
local arrowSignLocation = markerLocation + (markerWidth / 2) - (arrowSign_width / 2)
markerLocation = math.floor( markerLocation * 10 + 0.5 ) / 10
local source_link_chr = ""
local source_link_gstart = ""
local source_link_gend = ""
if( db == "hg38" ) then
source_link_chr = frame:extensionTag("ref", "[http://May2017.archive.ensembl.org/Homo_sapiens/Gene/Summary?db=core;g="..ensembl.." GRCh38: Ensembl release 89: "..ensembl.."] - [[Ensembl genome database project|Ensembl]], May 2017", {name = "refGRCh38Ensembl"}) --**lclz**
source_link_gstart = frame:extensionTag("ref", "", {name = "refGRCh38Ensembl"})
source_link_gend = frame:extensionTag("ref", "", {name = "refGRCh38Ensembl"})
elseif( db == "hg37") then
source_link_chr = frame:extensionTag("ref", "[http://grch37.ensembl.org/Homo_sapiens/Gene/Summary?db=core;&g="..ensembl.." GRCh37: Ensembl release 89: "..ensembl.."] - [[Ensembl genome database project|Ensembl]], May 2017", {name = "refGRCh37Ensembl"}) --**lclz**
source_link_gstart = frame:extensionTag("ref", "", {name = "refGRCh37Ensembl"})
source_link_gend = frame:extensionTag("ref", "", {name = "refGRCh37Ensembl"})
else
source_link = ""
source_link_gstart = ""
source_link_gend = ""
end
local wikitext_for_ideogram_image = "" --wikitext used for showing gene ___location
if chr == "MT" then -- wikitext for mitochondrial DNA
--wikitext_for_ideogram_image = wikitext_for_ideogram_image.."<div align=\"center\">"
--wikitext_for_ideogram_image = wikitext_for_ideogram_image.."<div style=\"position\: relative\; width\: 300px\;\">"
--wikitext_for_ideogram_image = wikitext_for_ideogram_image.."[[File:Map of the human mitochondrial genome.svg|300px|"..chrText.."]]"
--wikitext_for_ideogram_image = wikitext_for_ideogram_image.."</div>"
--wikitext_for_ideogram_image = wikitext_for_ideogram_image.."</div>"
else -- wikitext for autosome and sex chromosome
wikitext_for_ideogram_image = wikitext_for_ideogram_image.."<div align=\"center\">"
wikitext_for_ideogram_image = wikitext_for_ideogram_image.."<div style=\"position\: relative\; width\: 300px\;\">"
wikitext_for_ideogram_image = wikitext_for_ideogram_image.."[[File:Ideogram of house mouse chromosome "..chr..".svg|300px|"..chrText.."]]"
wikitext_for_ideogram_image = wikitext_for_ideogram_image.."<div style=\"position\: absolute\; left\: "..arrowSignLocation.."px\; top\: 2px\; padding\: 0\;\">"
wikitext_for_ideogram_image = wikitext_for_ideogram_image.."[[File:HSR 1996 II 3.5e.svg|"..arrowSign_width.."px|"..tooltip_arrowSign.."]]</div>"
wikitext_for_ideogram_image = wikitext_for_ideogram_image.."<div style=\"position\: absolute\; left\: "..markerLocation.."px\; top\: 19px\; padding\: 0\;\">[[File:Red rectangle "..markerWidth.."x18.png|"..markerWidth.."px|"..tooltip_arrowSign.."]]</div>"
wikitext_for_ideogram_image = wikitext_for_ideogram_image.."</div>"
wikitext_for_ideogram_image = wikitext_for_ideogram_image.."</div>"
end
root
:tag('tr')
:tag('td')
:attr('colspan', 4)
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:tag('table')
:attr('class', 'collapsible expand')
:css('padding', '0')
:css('border', 'none')
:css('margin', '0')
:css('width', '100%')
:css('text-align', 'left')
:tag('tr')
:tag('th')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', titleBGcolor)
:wikitext(titleHuman)
:done() --end th
:done() --end tr
:tag('tr')
:tag('td')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:wikitext("[[File:Ideogram human chromosome "..chr..".svg|300px|"..chrText.."]]")
:done() --end td
:done() --end tr
:tag('tr')
:tag('th')
:attr('scope', 'row')
:css('background-color', sideTitleBGcolor)
:wikitext(label_chr)
:done() --end th
:tag('td')
:attr('colspan', '3')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext("[["..chrText.."]]"..source_link_chr)
:done() --end span
:done() --end td
:done() --end tr
:tag('tr')
:tag('td')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:wikitext(wikitext_for_ideogram_image)
:done() --end td
:done() --end tr
:tag('tr')
:tag('th')
:attr('scope', 'row')
:attr('rowspan', '2')
:css('background-color', sideTitleBGcolor)
:wikitext(label_locus)
:done() --end th
:tag('td')
:attr('rowspan', '2')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext("No data available")
:done() --end span
:done() --end td
:tag('th')
:attr('scope', 'row')
:css('background-color', sideTitleBGcolor)
:wikitext(label_gstart)
:done() --end th
:tag('td')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext(p.separateWithComma(gstart).." [[Base pair|bp]]"..source_link_gstart)
:done() --end span
:done() --end td
:done() --end tr
:tag('tr')
:tag('th')
:attr('scope', 'row')
:css('background-color', sideTitleBGcolor)
:wikitext(label_gend)
:done() --end th
:tag('td')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext(p.separateWithComma(gend).." [[Base pair|bp]]"..source_link_gend)
:done() --end span
:done() --end td
:done() --end tr
:done() --end table
:done() --end td
:done() --end tr
end
if chr_mm ~= "" and gstart_mm ~= "" and gend_mm ~= "" then
--Chromosome lengths are from GRCm38.p5 https://www.ncbi.nlm.nih.gov/grc/mouse/data?asm=GRCm38.p5
local chrLengthTable_mm = {}
chrLengthTable_mm["1"] = 195471971
chrLengthTable_mm["2"] = 182113224
chrLengthTable_mm["3"] = 160039680
chrLengthTable_mm["4"] = 156508116
chrLengthTable_mm["5"] = 151834684
chrLengthTable_mm["6"] = 149736546
chrLengthTable_mm["7"] = 145441459
chrLengthTable_mm["8"] = 129401213
chrLengthTable_mm["9"] = 124595110
chrLengthTable_mm["10"] = 130694993
chrLengthTable_mm["11"] = 122082543
chrLengthTable_mm["12"] = 120129022
chrLengthTable_mm["13"] = 120421639
chrLengthTable_mm["14"] = 124902244
chrLengthTable_mm["15"] = 104043685
chrLengthTable_mm["16"] = 98207768
chrLengthTable_mm["17"] = 94987271
chrLengthTable_mm["18"] = 90702639
chrLengthTable_mm["19"] = 61431566
chrLengthTable_mm["X"] = 171031299
chrLengthTable_mm["Y"] = 91744698
chrLengthTable_mm["MT"] = 16299
local chrLength_mm = chrLengthTable_mm[chr_mm]
--Different languages have different word order.
local chrTextTable_mm = {}--**lclz**
chrTextTable_mm["1"] = "Chromosome 1 (mouse)"
chrTextTable_mm["2"] = "Chromosome 2 (mouse)"
chrTextTable_mm["3"] = "Chromosome 3 (mouse)"
chrTextTable_mm["4"] = "Chromosome 4 (mouse)"
chrTextTable_mm["5"] = "Chromosome 5 (mouse)"
chrTextTable_mm["6"] = "Chromosome 6 (mouse)"
chrTextTable_mm["7"] = "Chromosome 7 (mouse)"
chrTextTable_mm["8"] = "Chromosome 8 (mouse)"
chrTextTable_mm["9"] = "Chromosome 9 (mouse)"
chrTextTable_mm["10"] = "Chromosome 10 (mouse)"
chrTextTable_mm["11"] = "Chromosome 11 (mouse)"
chrTextTable_mm["12"] = "Chromosome 12 (mouse)"
chrTextTable_mm["13"] = "Chromosome 13 (mouse)"
chrTextTable_mm["14"] = "Chromosome 14 (mouse)"
chrTextTable_mm["15"] = "Chromosome 15 (mouse)"
chrTextTable_mm["16"] = "Chromosome 16 (mouse)"
chrTextTable_mm["17"] = "Chromosome 17 (mouse)"
chrTextTable_mm["18"] = "Chromosome 18 (mouse)"
chrTextTable_mm["19"] = "Chromosome 19 (mouse)"
chrTextTable_mm["X"] = "X chromosome (mouse)"
chrTextTable_mm["Y"] = "Y chromosome (mouse)"
chrTextTable_mm["MT"] = "Mitochondrial DNA (mouse)"
local chrText_mm = chrTextTable_mm[chr_mm]
--about the calculation below, see https://en.wikipedia.org/wiki/User:Was_a_bee/Gene#3._Calculation_detail
local markerWidth_mm = ((gend_mm - gstart_mm) * 294.133 )/ chrLength_mm
if markerWidth_mm < 2 then
markerWidth_mm = 2
else
markerWidth_mm = math.ceil(markerWidth_mm)
end
local markerLocation_mm = (147.0666 * (gstart_mm + gend_mm) / chrLength_mm ) + 1.6 - (markerWidth_mm / 2)
local arrowSignLocation_mm = markerLocation_mm + (markerWidth_mm / 2) - (arrowSign_width / 2)
markerLocation_mm = math.floor( markerLocation_mm * 10 + 0.5 ) / 10
local source_link_chr_mm = ""
local source_link_gstart_mm = ""
local source_link_gend_mm = ""
if( db_mm == "mm10" or db_mm == "mm0") then
--"mm0" happens because of function "getAliasFromGenomeAssembly()" is not prepared for mouse data.
--But as of now, Aug. 2017, it seems that all data which is stored in Wikidata are based on GRCm38/mm10.
--So treating mouse genomic data as GRCm38/mm10 if not specified.
source_link_chr_mm = frame:extensionTag("ref", "[http://May2017.archive.ensembl.org/Mus_musculus/Gene/Summary?db=core;g="..ensembl_mm.." GRCm38: Ensembl release 89: "..ensembl_mm.."] - [[Ensembl genome database project|Ensembl]], May 2017", {name = "refGRCm38Ensembl"}) --**lclz**
source_link_gstart_mm = frame:extensionTag("ref", "", {name = "refGRCm38Ensembl"})
source_link_gend_mm = frame:extensionTag("ref", "", {name = "refGRCm38Ensembl"})
else
source_link_chr_mm = ""
source_link_gstart_mm = ""
source_link_gend_mm = ""
end
local wikitext_for_ideogram_image_mm = "" --wikitext used for showing gene ___location
if chr_mm == "MT" then -- wikitext for mitochondrial DNA
--wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."<div align=\"center\">"
--wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."<div style=\"position\: relative\; width\: 300px\;\">"
--wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."[[File:Map of the human mitochondrial genome.svg|300px|"..chrText_mm.."]]"
--wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."</div>"
--wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."</div>"
else -- wikitext for autosome and sex chromosome
wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."<div align=\"center\">"
wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."<div style=\"position\: relative\; width\: 300px\;\">"
wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."[[File:Ideogram of house mouse chromosome "..chr_mm..".svg|300px|"..chrText_mm.."]]"
wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."<div style=\"position\: absolute\; left\: "..arrowSignLocation_mm.."px\; top\: 2px\; padding\: 0\;\">"
wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."[[File:HSR 1996 II 3.5e.svg|"..arrowSign_width.."px|"..tooltip_arrowSign.."]]</div>"
wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."<div style=\"position\: absolute\; left\: "..markerLocation_mm.."px\; top\: 19px\; padding\: 0\;\">[[File:Red rectangle "..markerWidth_mm.."x18.png|"..markerWidth_mm.."px|"..tooltip_arrowSign.."]]</div>"
wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."</div>"
wikitext_for_ideogram_image_mm = wikitext_for_ideogram_image_mm.."</div>"
end
root
:tag('tr')
:tag('td')
:attr('colspan', 4)
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:tag('table')
:attr('class', 'collapsible collapsed')
:css('padding', '0')
:css('border', 'none')
:css('margin', '0')
:css('width', '100%')
:css('text-align', 'left')
:tag('tr')
:tag('th')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', titleBGcolor)
:wikitext(titleMouse)
:done() --end th
:done() --end tr
:tag('tr')
:tag('td')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:wikitext("[[File:Ideogram house mouse chromosome "..chr_mm..".svg|260px|"..chrText_mm.."]]")
:done() --end td
:done() --end tr
:tag('tr')
:tag('th')
:attr('scope', 'row')
:css('background-color', sideTitleBGcolor)
:wikitext(label_chr)
:done() --end th
:tag('td')
:attr('colspan', '3')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext(chrText_mm..source_link_chr_mm)
:done() --end span
:done() --end td
:done() --end tr
:tag('tr')
:tag('td')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:wikitext(wikitext_for_ideogram_image_mm)
:done() --end td
:done() --end tr
:tag('tr')
:tag('th')
:attr('scope', 'row')
:attr('rowspan', '2')
:css('background-color', sideTitleBGcolor)
:wikitext(label_locus)
:done() --end th
:tag('td')
:attr('rowspan', '2')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext("No data available")
:done() --end span
:done() --end td
:tag('th')
:attr('scope', 'row')
:css('background-color', sideTitleBGcolor)
:wikitext(label_gstart)
:done() --end th
:tag('td')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext(p.separateWithComma(gstart_mm).." [[Base pair|bp]]"..source_link_gstart_mm)
:done() --end span
:done() --end td
:done() --end tr
:tag('tr')
:tag('th')
:attr('scope', 'row')
:css('background-color', sideTitleBGcolor)
:wikitext(label_gend)
:done() --end th
:tag('td')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext(p.separateWithComma(gend_mm).." [[Base pair|bp]]"..source_link_gend_mm)
:done() --end span
:done() --end td
:done() --end tr
:done() --end table
:done() --end td
:done() --end tr
end
end
p.renderRNAexpression = function(expression_images, entrez_gene)
local title = "[[Gene expression|RNA expression]] pattern" --**lclz**
local biogps_link = "[http://biogps.org/gene/"..entrez_gene.."/ More reference expression data]" --**lclz**
root
:tag('tr')
:tag('td')
:attr('colspan', 4)
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:tag('table')
:attr('class', 'collapsible expand')
:css('padding', '0')
:css('border', 'none')
:css('margin', '0')
:css('width', '100%')
:css('text-align', 'left')
:tag('tr')
:tag('th')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', titleBGcolor)
:wikitext(title)
:done() --end th
:done() --end tr
:tag('tr')
:tag('td')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:wikitext(expression_images)
:done() --end td
:done() --end tr
:tag('tr')
:tag('td')
:attr('colspan', '4')
:css('text-align', 'center')
:css('background-color', rowBGcolor)
:tag('span')
:attr('class', 'plainlinks')
:wikitext(biogps_link)
:done() --end span
:done() --end td
:done() --end tr
:done() --end table
:done() --end td
:done() --end tr
end
Line 752 ⟶ 1,218:
:done() --end tr
end
p.renderOrthologs = function(frame, entrez_gene, entrez_gene_mm, ensembl, ensembl_mm, uniprot, uniprot_mm, refseq_mRNA, refseq_mRNA_mm, refseq_prot, refseq_prot_mm, db, chr, gstart, gend, db_mm, chr_mm,gstart_mm, gend_mm)
Line 1,151 ⟶ 1,584:
local chr_loc_link = ""
if (string.match(db, '%w+') and string.match(chr, '%w+') and string.match(gstart, '%w+') and string.match(gend, '%w+') )then
local chr_ucsc
if chr == "MT" then
chr_ucsc = "M" --UCSC uses "M" (not "MT") in URL for mitochondrial DNA
end
chr_loc_link = "[https://genome.ucsc.edu/cgi-bin/hgTracks?org=Human&db="..db.."&position=chr"..chr_ucsc..":"..gstart.."-"..gend.." ".."Chr "..chr_ucsc..": "..gstart_mb.." – "..gend_mb.." Mb]"
else
chr_loc_link = "n/a"
Line 1,159 ⟶ 1,596:
local chr_loc_mm_link = ""
if (string.match(db_mm, '%w+') and string.match(chr_mm, '%w+') and string.match(gstart_mm, '%w+') and string.match(gend_mm, '%w+') )then
local chr_mm_ucsc
if chr_mm == "MT" then
chr_mm_ucsc = "M" --UCSC uses "M" (not "MT") in URL for mitochondrial DNA
end
chr_loc_mm_link = "[https://genome.ucsc.edu/cgi-bin/hgTracks?org=Mouse&db="..db_mm.."&position=chr"..chr_mm_ucsc..":"..gstart_mm.."-"..gend_mm.." ".."Chr "..chr_mm_ucsc..": "..gstart_mm_mb.." – "..gend_mm_mb.." Mb]"
else
end
Line 2,040 ⟶ 2,481:
local sep = " "
local propertyID = "P644" --genomic start used
local qualifierID = "P659" --genomic assembly
local newest_build = "0"
Line 2,060 ⟶ 2,501:
end
--if there are any
--as of Aug. 2017, P659-genomic assembly is stored only in human genomic data. GRCh38 (newer) or GRCh37(older).
--Mouse genomic data doesn't have P659-genomic assembly data. But mouse has only one version. GRCm38/mm10.
if quals then
for qk, qv in pairs(quals) do
Line 2,074 ⟶ 2,517:
alias = value['value']
local build_no = alias:gsub(prefix,"")
--For example, prefix is "hg" (this is set when the function was called),
--alias is "hg38" (which is data stored in Wikidata). Then "build_no" becomes "38".
--report only the most ___location associated with the most recent build
--if there is more than one ___location per build, just give one back as that is not our problem right now.
Line 2,101 ⟶ 2,546:
local string_to_trim = p.getValue(entity, "P1057")
local out = ''
--"mitochondrion" and "chromosome MT" is used for mitochondrial DNA.
--See [[d:Special:WhatLinksHere/Q18694495]]
if string.find(string_to_trim, 'chromosome MT') or string.find(string_to_trim, 'mitochondri') then --match both 'mitochondrio'/'mitochondrial'
out = "MT"
elseif 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
return out
Line 2,317 ⟶ 2,764:
end -- end protein_entities loop
return out, datasource, pqid, pname
end
p.separateWithComma= function(bp)
--Separate number with comma. For example when this function gets "12345678", returns "12,345,678"
local commaSeparated = bp
while true do
commaSeparated, k = string.gsub(commaSeparated, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return commaSeparated
end
|