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
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
# tool: scholia
# / defaultView:Graph
PREFIX target: <http://www.wikidata.org/entity/Q30149558>
SELECT
?citing_work ?citing_workLabel ?grey ?padded_grey ?rgb
?cited_work ?cited_workLabel
WITH {
SELECT (COUNT(*) AS ?count) ?citing_work WHERE {
SELECT ?smiles
WHERE {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "www.wikidata.org";
wikibase:api "Search";
mwapi:srsearch "haswbstatement:P235 -haswbstatement:P274";
mwapi:srlimit "max".
?cmp wikibase:apiOutputItem mwapi:title.
}
OPTIONAL { ?cmp wdt:P2017 ?isoSmi }
SELECT DISTINCT ?doi WITH {
SELECT DISTINCT ?pub ?doi ?date WHERE {
SERVICE bd:sample { ?pub wdt:P356 ?doi . bd:serviceParam bd:sample.limit 75000 }
?pub wdt:P577 ?date .
MINUS { ?pub wdt:P2860 [] }
FILTER (year(?date) < 1900)
}
} AS %RANDOM WHERE {
SELECT DISTINCT ?pub ?doi ?date WHERE {
INCLUDE %RANDOM
SELECT DISTINCT ?smiles WITH {
SELECT DISTINCT ?cmp ?inchikey WHERE {
SERVICE bd:sample { ?cmp wdt:P235 ?inchikey . bd:serviceParam bd:sample.limit 200000 }
MINUS { ?cmp wdt:P274 [] }
FILTER (STRENDS(STR(?inchikey), "-N"))
}
} AS %RANDOM WHERE {
SELECT DISTINCT ?smiles WHERE {
INCLUDE %RANDOM
OPTIONAL { ?cmp wdt:P233 ?canSmi }
@egonw
egonw / calculating-nano-inchis-in-python-with-the-help-of-java-bacting-and-scyjava.ipynb
Last active September 4, 2022 12:09
Calculating Nano InChIs in Python (with the help of Java, Bacting, and Scyjava)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?xml version="1.0" encoding="UTF-8"?>
<Pathway xmlns="http://pathvisio.org/GPML/2013a" Name="Lac-Phe pathway" Organism="Homo sapiens">
<Graphics BoardWidth="995.0" BoardHeight="592.0" />
<DataNode TextLabel="(S)-lactate" GraphId="c484a" Type="Metabolite">
<Graphics CenterX="196.0" CenterY="187.0" Width="90.0" Height="25.0" ZOrder="32768" FontSize="12" Valign="Middle" Color="3955e7" />
<Xref Database="ChEBI" ID="16651" />
</DataNode>
<DataNode TextLabel="Lac-Phe" GraphId="fcf48" Type="Metabolite">
<Graphics CenterX="376.0" CenterY="187.0" Width="90.0" Height="25.0" ZOrder="32768" FontSize="12" Valign="Middle" Color="3955e7" />
<Xref Database="ChEBI" ID="167456" />
@egonw
egonw / getBridgeDbDatabases.sh
Created February 23, 2022 19:15
Script to download BridgeDb identifier mapping databases
#!/bin/bash
wget -nc https://bridgedb.github.io/data/gene.json
wget -nc https://bridgedb.github.io/data/corona.json
wget -nc https://bridgedb.github.io/data/other.json
wget -nc https://bridgedb.github.io/data/gene.json.config
wget -nc https://bridgedb.github.io/data/corona.json.config
wget -nc https://bridgedb.github.io/data/other.json.config
@prefix this: <http://purl.org/np/RAMc79WFgK30tHAeWj6PugKxfcqFsgErU2n8pLPJnwNrU> .
@prefix sub: <http://purl.org/np/RAMc79WFgK30tHAeWj6PugKxfcqFsgErU2n8pLPJnwNrU#> .
@prefix has-source: <http://semanticscience.org/resource/SIO_000253> .
@prefix wp: <http://vocabularies.wikipathways.org/wp#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix np: <http://www.nanopub.org/nschema#> .
@prefix wd: <https://www.wikidata.org/entity/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@egonw
egonw / smi_inchikeys.groovy
Created September 4, 2021 10:54
Convert a file with SMILES to InChIKeys
@Grab(group='org.openscience.cdk', module='cdk-bundle', version='2.5')
// Copyright (C) 2021 Egon Willighagen <0000-0001-7542-0286@orcid.org>
//
// MIT license
//
// If you use this script, please cite the CDK 2.0 article:
// https://jcheminf.biomedcentral.com/articles/10.1186/s13321-017-0220-4
import org.openscience.cdk.interfaces.*;