Skip to content

Instantly share code, notes, and snippets.

Avatar

sebotic

  • The Scripps Research Institute
  • La Jolla, CA
View GitHub Profile
View wd_query_issue.py
import requests
query = '''
select distinct ?p1 where {
VALUES ?pd {
<http://www.wikidata.org/entity/Q423026>
<http://www.wikidata.org/entity/Q616005>
<http://www.wikidata.org/entity/Q7644128>
<http://www.wikidata.org/entity/Q898273>
<http://www.wikidata.org/entity/Q898362>
@sebotic
sebotic / wikidata_mygene_wrapper.py
Created Mar 18, 2016
a script to retrieve a mapping from entrez id to Wikidata QID and English Wikipedia pages
View wikidata_mygene_wrapper.py
import requests
import urllib
import json
__author__ = 'Sebastian Burgstaller'
__license__ = 'AGPLv3'
prefix = '''
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
@sebotic
sebotic / gene_ontology_evidence_codes.py
Created Mar 18, 2016
Gene Ontology evidence codes to determine how a certain annotation came into existance
View gene_ontology_evidence_codes.py
# instance of Gene Ontology Evidence code (Q23173209)
go_evidence_codes = {
'EXP': 'Q23173789',
'IDA': 'Q23174122',
'IPI': 'Q23174389',
'IMP': 'Q23174671',
'IGI': 'Q23174952',
'IEP': 'Q23175251',
'ISS': 'Q23175558',
'ISO': 'Q23190637',
@sebotic
sebotic / latest_rev.py
Created Feb 18, 2016
Retrieves the latest revision for all Wikidata items which are retrieved by a SPARQL query
View latest_rev.py
import requests
import PBB_login
import sys
import pprint
__author__ = 'Sebastian Burgstaller-Muehlbacher'
__license__ = 'AGPLv3'
def exec_wd_query(y):
rev_id_block = [x[1] for x in y]
@sebotic
sebotic / WD_WP_disease_mapping.py
Created Jul 25, 2015
maps the labels of Wikidata QIDs to the appropriate Wikipedia pages
View WD_WP_disease_mapping.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Sebastian Burgstaller'
__licence__ = 'GPLv3'
import PBB_Core
import pandas as pd
import requests
import os
View test.py
eferences = { 'P279': [ { 'ref_properties': ['P248', 'P143', 'TIMESTAMP'],
'ref_values': ['Q17939676', 'Q20641742', 'TIMESTAMP']}],
'P351': [ { 'ref_properties': ['P248', 'P143', 'TIMESTAMP'],
'ref_values': ['Q17939676', 'Q20641742', 'TIMESTAMP']}],
'P353': [ { 'ref_properties': ['P248', 'P143', 'TIMESTAMP'],
'ref_values': ['Q17939676', 'Q20641742', 'TIMESTAMP']}],
'P703': [ { 'ref_properties': ['P248', 'P143
9;, 'TIMESTAMP'],
'ref_values': ['Q17939676', 'Q20641742', 'TIMESTAMP']}]}
View wd_write_test2.py
__author__ = 'Sebastian Burgstaller'
__licence__ = 'GPLv3'
"""
Test retrieval and construction of a WD json representation
"""
import PBB_Core
import pprint
import time
from PBB_login import WDLogin
View wikidata_write_test.py
__author__ = 'Sebastian Burgstaller'
from PBB_login import WDLogin
import requests
import json
import pprint
user = ''
pwd = ''
View WikiData_to_Wikipedia.py
__author__ = 'sebastian'
__license__ = 'GPLv3'
import pywikibot
import pywikibot.login
gene_list = ['BRCA1', 'REELIN', 'MYL2', 'TP53', 'INS']
hgid = ['Q1232', 'Q1235', 'Q1236', 'Q1234', 'Q1233']
mgid = ['Q1238', 'Q1239', 'Q1240', 'Q1237', 'Q1241']
pages = ['Template:PBB/672', 'Template:PBB/5649', 'Template:PBB/4633', 'Template:PBB/7157', 'Template:PBB/3630']