Skip to content

Instantly share code, notes, and snippets.

@jvsoest
jvsoest / bio2rdf_trial_locations.sparql
Last active May 17, 2017 09:33
bio2rdf_location.sparql
prefix dcterm: <http://purl.org/dc/terms/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix ctvoc: <http://bio2rdf.org/clinicaltrials_vocabulary:>
prefix ctres: <http://bio2rdf.org/clinicaltrials_resource:>
prefix ct: <http://bio2rdf.org/clinicaltrials:>
select ?trial ?location ?cityName ?countryName
where {
BIND(ct:NCT00005636 AS ?trial).
@jvsoest
jvsoest / blazegraph.properties
Created May 18, 2017 07:36
Blazegraph properties for Windows
com.bigdata.rwstore.RWStore.readBlobsAsync=false
com.bigdata.journal.AbstractJournal.file=blazegraph.jnl
# The persistence engine. Use 'Disk' for the WORM or 'DiskRW' for the RWStore.
com.bigdata.journal.AbstractJournal.bufferMode=DiskRW
# Setup for the RWStore recycler rather than session protection.
com.bigdata.service.AbstractTransactionService.minReleaseAge=1
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix icd: <http://purl.bioontology.org/ontology/ICD10/>
prefix uo: <http://purl.obolibrary.org/obo/UO_>
prefix sedi: <http://semantic-dicom.org/dcm#>
prefix seq: <http://semantic-dicom.org/seq#>
SELECT ?dicom_series ?institute ?machine ?anatomicRegionSeq
WHERE {
?patient sedi:hasStudy ?dicom_study.
@jvsoest
jvsoest / xnat.py
Created July 24, 2017 13:12
XNAT python
###### login to XNAT and search/get files ########
import xnat
session = xnat.connect('https://xnat.bmia.nl', user='bla')
session.projects
project = session.projects['STW_STRATEGY_HN_VELLORE']
subject = project.subjects['BMIAXNAT_S08453']
experiment = subject.experiments['BMIAXNAT_E28844']
@jvsoest
jvsoest / patient_protocol_trial_publications.sparql
Last active October 15, 2017 16:42
One query to retrieve patient information, disease and treatment characteristics, trials matching the treatment characteristics, and the link to publications linked to these trials. Hence, we can find publications related to the disease and treatment of specific patients (via the treatment protocols and clinical trials).
prefix roo: <http://www.cancerdata.org/roo/>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix icd: <http://purl.bioontology.org/ontology/ICD10/>
prefix uo: <http://purl.obolibrary.org/obo/UO_>
prefix dcterm: <http://purl.org/dc/terms/>
prefix ctvoc: <http://bio2rdf.org/clinicaltrials_vocabulary:>
prefix ctres: <http://bio2rdf.org/clinicaltrials_resource:>
prefix ct: <http://bio2rdf.org/clinicaltrials:>
@jvsoest
jvsoest / fhir_dlra_query.sparql
Last active November 20, 2017 07:11
FHIR query DLRA
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix fhir: <http://hl7.org/fhir/>
SELECT ?subject ?givenName ?prefixName ?familyName ?procedure ?codeValue ?systemValue ?uriTerm ?uriLabel ?superTerm ?superLabel
WHERE {
#get the procedure
?procedure rdf:type fhir:Procedure;
fhir:Procedure.code ?pCode;
fhir:Procedure.subject ?bnode_subject.
@jvsoest
jvsoest / example_sparql.sparql
Last active December 4, 2017 13:34
example_sparql
prefix roo: <http://www.cancerdata.org/roo/>
prefix ncit: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix icd: <http://purl.bioontology.org/ontology/ICD10/>
prefix uo: <http://purl.obolibrary.org/obo/UO_>
SELECT *
WHERE {
?patient rdf:type ncit:C16960.
@jvsoest
jvsoest / service.py
Created January 17, 2018 20:08
Python image service
from flask import Flask, render_template, request, url_for
import os
if not os.path.exists("static"):
os.makedirs("static")
app = Flask('ImageShow', template_folder='')
@app.route('/', methods=['GET', 'POST'])
def index():
@jvsoest
jvsoest / doiRetrieve.sh
Created December 28, 2019 16:02
DOI metadata retrieval
# retrieve as reference text
curl -LH "Accept: text/bibliography" http://dx.doi.org/10.1016/j.radonc.2014.04.008
# retrieve as bibtex
curl -LH "Accept: text/bibliography; style=bibtex" http://dx.doi.org/10.1016/j.radonc.2014.04.008
# retrieve as bibtex (url-safe)
curl -LH "Accept: application/x-bibtex" http://dx.doi.org/10.1016/j.radonc.2014.04.008
@jvsoest
jvsoest / ct_rtstruct_retrieval.sparql
Last active January 7, 2020 15:41
SEDI retrieval of CT and RTStruct information
PREFIX sedi: <http://semantic-dicom.org/dcm#>
PREFIX seq: <http://semantic-dicom.org/seq#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
select DISTINCT ?patientID ?studyUID ?seriesUID ?modality ?manufacturer ?model ?softwareVersion ?sopInstanceUID ?sliceThickness ?contourName ?refSeriesUID
where {
# Get patient & ID
?patient rdf:type sedi:Patient.