Skip to content

Instantly share code, notes, and snippets.

View egonw's full-sized avatar
💭
I want peace and climate action

Egon Willighagen egonw

💭
I want peace and climate action
View GitHub Profile
@egonw
egonw / createBridgeDbMappings.groovy
Created March 13, 2024 20:35
Code for the new WikiPathways website to convert datanodes.tsv into WikiPathways RDF triples
@Grab(group='org.bridgedb', module='org.bridgedb.bio', version='3.1.1')
import java.util.ArrayList
import java.util.List
import java.util.Map
import java.util.HashMap
import java.nio.file.Path
import java.nio.file.Files
@egonw
egonw / falseStatements.rq
Created December 29, 2023 18:14
Wikidata statements with a retracted article as reference
SELECT DISTINCT ?entity ?entityLabel ?propertyLabel ?valueLabel ?retracted ?retractedLabel WITH {
SELECT DISTINCT ?entity ?p ?statement ?retracted WHERE {
?retracted wdt:P31 wd:Q45182324 .
?entity ?p ?statement .
?statement prov:wasDerivedFrom / pr:P248 ?retracted .
}
} AS %STATEMENTS WHERE {
INCLUDE %STATEMENTS
?p ^wikibase:claim ?property .
?statement ?ps ?value .
@egonw
egonw / output.txt
Created September 30, 2023 11:39
Pathways without tags
Pathways without any tag: 74. Details:
http://classic.wikipathways.org/instance/WP3104_r118203 'Mevalonate pathway (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3029_r118242 'Vitamin E biosynthesis (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3113_r118262 'Gibberellin biosynthesis III (early C-13 hydroxylation) (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3024_r116502 'Formation of ternary complex, then 43S complex (Oryza sativa)'
http://classic.wikipathways.org/instance/WP3066_r118243 'Glutamine biosynthesis I (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3083_r118610 'Gamma-glutamyl cycle (Zea mays)'
http://classic.wikipathways.org/instance/WP3003_r118295 'Cap-dependent translation initiation (Oryza sativa)'
http://classic.wikipathways.org/instance/WP3087_r118265 'GDP-L-fucose biosynthesis I from GDP-D-mannose (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3035_r118280 'IAA biosynthesis VI via i
@egonw
egonw / listReferences.rq
Created August 26, 2023 12:34
List all references for an item
PREFIX target: <http://www.wikidata.org/entity/Q76>
SELECT DISTINCT ?source ?sourceLabel WHERE {
VALUES ?refType { pr:P248 pr:P854 }
target: ?propp ?statement .
?statement prov:wasDerivedFrom ?reference .
?reference ?refType ?source .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
@egonw
egonw / query.rq
Created August 10, 2023 06:47
This is the query behind https://w.wiki/5bpq
SELECT DISTINCT ?np ?chembl WHERE {
?np wdt:P703 [] ; wdt:P592 ?chembl .
}
@egonw
egonw / README.md
Last active September 14, 2024 08:22
2023 stuff for CiTO annotations, related to https://scholia.toolforge.org/work/Q117357537

2023 stuff for CiTO annotations

Some files related to some data curation I did yesterday to add some 200~ish CiTO annotations to Wikidata. The data is CCZero, from https://doi.org/10.5281/zenodo.6885109

There are two files here:

  • cits_cleaned.csv derived from the cits.csv from the Zenodo data
  • quickstatements.groovy that takes cits_cleaned.csv as input and creates QuickStatements
{
"@context": "https://schema.org/",
"@type": "CreativeWork",
"name": "PC_DUSTINESS Template",
"description": "The Dustiness with small drum data entry template is published at 10.2787/505397 under CC BY-SA 4.0 license.",
"license": "https://creativecommons.org/licenses/by-sa/4.0/",
"keywords": "dustiness, NM-110, NM-200",
"url": "https://search.data.enanomapper.net/projects/enanomapper/datatemplates/pchem/index.html?template=PC_DUSTINESS",
"archivedAt": "http://dx.doi.org/10.2787/505397",
"provider": {
@egonw
egonw / alternative.rq
Last active February 18, 2023 10:32
Citation history of the 20 most cited articles for the target author
#defaultView:BarChart
SELECT ?year (count(distinct ?citing_work) as ?count) ?workLabel WITH {
SELECT (count(distinct ?citing_work) as ?totalCount) ?work WHERE {
?work wdt:P50 / wdt:P496 "0000-0001-7542-0286" .
?citing_work wdt:P2860 ?work .
} group by ?work
order by DESC(?totalCount)
limit 10
} AS %PAPERS WHERE {
INCLUDE %PAPERS
@egonw
egonw / chemical-class.rq
Created February 12, 2023 15:09
note to self #Scholia #chemistry
# tool: scholia
#defaultView:Graph
PREFIX target: <http://www.wikidata.org/entity/Q211171>
SELECT ?class ?classLabel ?otherclass ?otherclassLabel ?rgb WITH {
SELECT DISTINCT ?class ?otherclass ?rgb WHERE {
{ VALUES ?class_ { target: }
{ ?otherclass_ wdt:P279 ?class_ . BIND( "3182BD" AS ?rgb) BIND(?class_ AS ?class) BIND(?otherclass_ AS ?otherclass) }
UNION
{ ?otherclass_ wdt:P31 ?class_ . BIND( "E6550D" AS ?rgb) BIND(?class_ AS ?class) BIND(?otherclass_ AS ?otherclass) }
@egonw
egonw / findProblems.rq
Created January 17, 2023 19:42
clean up some import error
SELECT (SUBSTR(STR(?wikidata),32) AS ?qid)
(CONCAT("\"\"\"", ?inchikey_, "\"\"\"") AS ?inchikey)
(CONCAT("\"\"\"", ?inchi_, "\"\"\"") AS ?inchi)
(CONCAT("\"\"\"", ?chemform_, "\"\"\"") AS ?chemform)
(CONCAT("\"\"\"", ?smiles_, "\"\"\"") AS ?smiles)
(CONCAT(str(?mass_), "U483261") AS ?mass)
WHERE {
VALUES ?inchikey_ { "WSYNAKWAAXYNMW-DEOSSOPVSA-N" "PTCHLTYDAIWNSD-SSDOTTSWSA-N" "GAZIIOYXDWTTMC-GFCCVEGCSA-N" "CIUYPOUJRYWLDF-QFIPXVFZSA-N" "HAGZRCCJXLGJTR-BDAKNGLRSA-N" }
?wikidata wdt:P235 ?inchikey_ ;
wdt:P234 ?inchi_ ;