Skip to content

Instantly share code, notes, and snippets.

View mwatts15's full-sized avatar
🏠
Working from home

Mark Watts mwatts15

🏠
Working from home
View GitHub Profile
import logging
import rdflib
from rdflib.term import URIRef
from rdflib import RDF, plugin
from rdflib.graph import Graph
from rdflib.store import Store
from movementmetadata import MovementMetadata
import tempfile
import os
from os.path import join as p
diff --git a/PyOpenWorm/context_store.py b/PyOpenWorm/context_store.py
index c278af9..c753eed 100644
--- a/PyOpenWorm/context_store.py
+++ b/PyOpenWorm/context_store.py
@@ -151,7 +151,15 @@ class RDFContextStore(Store):
self.__init_contexts()
for t in self.__store.triples(pattern, context):
contexts = set(getattr(c, 'identifier', c) for c in t[1])
- inter = self.__context_transitive_imports & contexts
+ if self.__context_transitive_imports:
@mwatts15
mwatts15 / c302-issues.txt
Last active June 24, 2018 19:06
c302 issues to write
- Pass in reader objects rather than names of readers for for data_reader
arguments
Allows to configure readers in any way that's needed prior to use (e.g.,
the spreadsheet location, PyOW context). There doesn't seem to be any
reason that users of the data reader either need to initialize or resolve
the readers differently for a given name, so it's better not to expect them
to.
- Remove assumptions of spreadsheet reader being used
@mwatts15
mwatts15 / addo_notes.txt
Created November 21, 2017 03:08
ADDO '17 notes
Mark Watts' notes on All Day DevOps.
====================================
The talks I viewed and the notes I took reflect my personal interests and
issues which I though would be worthwile to my employer, but there were many
useful talks.
One of the business-side advantages of DevOps is that it's supposed to *save
time and money* by reducing overhead due, principally, to dysfunctional
patterns of behavior within the organization. Many talks in ADDO describe tools
import csv
class WormbaseIonChannelCSVTranslator(DataTranslator):
input_type = WormbaseIonChannelCSVDataSource
output_type = DataObjectContextDataSource
def translate(self, data_source):
res = set([])
try:
with open(data_source.csv_file_name, 'r') as csvfile:
@mwatts15
mwatts15 / git_author_remove.sh
Last active February 19, 2017 14:43
A script for removing author names and email addresses from git commit history
#!/bin/sh
# A script for removing authors from git history and file contents
REPLACE_DOMAIN=${REPLACE_DOMAIN:-example.com}
TEMPDIR=
interactive=
restore_ref () {
if [ -f orig-ref ] ; then
@mwatts15
mwatts15 / diff-tree-to-gephi.py
Created May 21, 2016 15:23
Script for translating edges
from __future__ import print_function
import xlrd
wb = xlrd.open_workbook(
'./Differentiation Tree Dataset/differentiation-tree-all-variables.1.xlsx')
sheet = wb.sheet_by_name('RelativeSize')
# Column indices
PARENT = 1
CHILDA = 2
@mwatts15
mwatts15 / issue-90.py
Created February 20, 2016 20:40
See openworm/PyOpenWorm issue #90
import PyOpenWorm as P
import numpy
import six
from time import time
def all_neuron_connection():
n = P.Neuron(name="AVAL")
list(n.connection.get())
list(n.connection.get())
@mwatts15
mwatts15 / diff.py
Last active November 22, 2015 05:07
Experiment with showing object differences in YAROM
from __future__ import print_function
try:
import cStringIO as io
except:
from io import StringIO as io
import sys
import rdflib
from rdflib.graph import ConjunctiveGraph
from uuid import uuid4
import random
from __future__ import print_function
from socket import error as SocketError
import errno
import traceback
import rdflib
import time
import os
import signal
from urllib2 import URLError
from rdflib.plugins.stores.sparqlstore import SPARQLUpdateStore