Skip to content

Instantly share code, notes, and snippets.

View egonw's full-sized avatar
💭
I don't want a status.

Egon Willighagen egonw

💭
I don't want a status.
View GitHub Profile
@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_ ;

Project 26 notes BioHackathon Europe 22

Potentially interesting metabolomics datasets:

These datasets have been found in the Metabolights repository (annotated with ChEBI, (class)name, SMILES*, InChI*) and Metabolomics workbench(annotated with PubChem*, Kegg*), through the search term 'toxic' (the term 'UVCB' gave 0 results). *If available?

ID Species Chemical(s) Comment(s) Technique Annotated IDs Unannotated peaks
MTBLS275 mouse (Mus musculus) chlorpyrifos; chlorpyrifos-methyl metabolite(3,5,6-trichloro-2-pyridinol) oral exposure NMR 52 2+?
MTBLS48 mouse (Mus musculus) Municipal wastewater effluents (MWWE) transcriptomic data also available NMR 47 1+?
@egonw
egonw / option 1: fully searchable.md
Created November 5, 2022 16:27
Conference Tooting Community Standard (CC-BY 4.0 International, the authors)

Conference Tooting Community Standard

Conference tooting is the Mastodon equivalent of tweeting at and about conferences, particularly scientific content of those meetings, where commonly a meeting conference hashtag is is used. This creates an online discussion sphere where the topic of the meeting can be discussed. Normally, participants of the meeting only use the hashtag.

Because the 'local timeline' of can get crowded quickyl, the Mastodon platform has various mechanisms to reduce the flood of that timeline, putting focus on seeds. This has implications how we tweet conferences. This Mastodon server expects the following behavior:

@egonw
egonw / firstAuthorLocations.rq
Created October 22, 2022 07:23
Show the geo locations of employers/affiliations of first authors of Nature articles
#defaultView:Map
PREFIX venue: <http://www.wikidata.org/entity/Q180445>
SELECT DISTINCT ?author ?geo
WITH {
SELECT DISTINCT ?author_ ?author WHERE {
{
?target p:P50 ?author_statement ; wdt:P1433 venue: .
?author_statement ps:P50 ?author_ .
?author_ rdfs:label ?author .
Parsed CCCC\C=C/CCCCCCCC(=O)OC[C@@]([H])(O)COP([O-])(=O)OCC[N+](C)(C)C into CDKMolecule:C22H44NO7P
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
InChIKey match: http://www.wikidata.org/entity/Q27144114
====================
C₂₂H₄₄NO₇P is already in Wikidata as http://www.wikidata.org/entity/Q27144114
Full stereochemistry is defined
====================
Parsed [H][C@@](O)(COC(=O)CCCCCCCCCCCCCC)COP([O-])(=O)OCC[N+](C)(C)C into CDKMolecule:C23H48NO7P
# (C) 2019 Andra Waagmeester
# 2019 Egon Willighagen
#
# MIT License
from wikidataintegrator import wdi_core, wdi_login, wdi_helpers
import os
import sys
if "WDUSER" in os.environ and "WDPASS" in os.environ:
# tool: scholia
#defaultView:Table
PREFIX target: <http://www.wikidata.org/entity/Q7160367>
SELECT
(MIN(?dates) AS ?date)
?work ?workLabel
(GROUP_CONCAT(DISTINCT ?type_label; separator=", ") AS ?type)
(GROUP_CONCAT(DISTINCT ?winner_label; separator=", ") AS ?winners)
WHERE {
Parsed C(=O)(C(C(C(C(C(F)(F)F)(F)F)(F)F)(F)F)(F)F)O into CDKMolecule:C6HF11O2
InChIKey match: http://www.wikidata.org/entity/Q27156874
PubChem CID match: http://www.wikidata.org/entity/Q27156874
====================
C₆HF₁₁O₂ is already in Wikidata as http://www.wikidata.org/entity/Q27156874
Full stereochemistry is defined
====================
Parsed C(=O)(C(C(C(C(C(C(F)(F)F)(F)F)(F)F)(F)F)(F)F)(F)F)O into CDKMolecule:C7HF13O2
InChIKey match: http://www.wikidata.org/entity/Q27116513
PubChem CID match: http://www.wikidata.org/entity/Q27116513