def __init__(self, conf=False): Configure.__init__(self) Configureable.__init__(self,conf) # We copy over all of the configuration that we were given self.copy(self.conf) self.namespace = Namespace("http://openworm.org/entities/") self.molecule_namespace = Namespace("http://openworm.org/entities/molecules/") self['nx'] = _B(self._init_networkX) self['rdf.namespace'] = self.namespace self['molecule_name'] = self._molecule_hash self['new_graph_uri'] = self._molecule_hash self._init_rdf_graph()
def __init__(self, conf=False): Configure.__init__(self) Configureable.__init__(self, conf) # We copy over all of the configuration that we were given self.copy(self.conf) self.namespace = Namespace("http://openworm.org/entities/") self.molecule_namespace = Namespace( "http://openworm.org/entities/molecules/") self['nx'] = _B(self._init_networkX) self['rdf.namespace'] = self.namespace self['molecule_name'] = self._molecule_hash self['new_graph_uri'] = self._molecule_hash self._init_rdf_graph()
def setUp(self): PyOpenWorm.connect(conf=Configure( **{ 'rdf.store_conf': 'tests/test.db', 'rdf.source': 'ZODB' })) self.g = PyOpenWorm.config("rdf.graph")
def main(): c = Configure() c['neuronscsv'] = 'https://raw.github.com/openworm/data-viz/master/HivePlots/neurons.csv' c['connectomecsv'] = 'https://raw.github.com/openworm/data-viz/master/HivePlots/connectome.csv' c['sqldb'] = '/home/markw/work/openworm/PyOpenWorm/db/celegans.db' c = Data(c) net = PyOpenWorm.Network(c) nml_doc = NeuroMLDocument(id="IafNet") ns = net.neurons() nml_net = neuroml.Network(id="IafNet") nml_doc.networks.append(nml_net) for n in [net.aneuron_nocheck(n) for n in ns]: s(nml_doc, nml_net, n) syn0 = ExpOneSynapse(id="syn0", gbase="65nS", erev="0mV", tau_decay="3ms") for k in net.synapses(): n1 = net.aneuron_nocheck(k[0]) n2 = net.aneuron_nocheck(k[1]) connect(nml_net, n1, n2, 'syn0') f = "test.nml" writers.NeuroMLWriter.write(nml_doc, f) v(f)
def test_init_config_no_Data(self): """ Should fail if given a non-Data configuration """ # XXX: This test touches some machinery in # PyOpenWorm/__init__.py. Feel like it's a bad test tmp = Configureable.conf Configureable.conf = Configure() with self.assertRaises(BadConf): DataUser() Configureable.conf = tmp
def setUp(self): # Set do_logging to True if you like walls of text self.TestConfig = Configure.open(TEST_CONFIG) td = '__tempdir__' z = self.TestConfig['rdf.store_conf'] if z.startswith(td): x = z[len(td):] h = tempfile.mkdtemp() self.TestConfig['rdf.store_conf'] = h + x self.delete_dir() PyOpenWorm.connect(conf=self.TestConfig, do_logging=False)
def setUpClass(cls): import csv PyOpenWorm.connect(conf=Configure( **{ 'rdf.store_conf': 'tests/test.db', 'rdf.source': 'ZODB' })) PyOpenWorm.loadData(skipIfNewer=False) PyOpenWorm.disconnect() # grab the list of the names of the 302 neurons csvfile = open('OpenWormData/aux_data/neurons.csv', 'r') reader = csv.reader(csvfile, delimiter=';', quotechar='|') # array that holds the names of the 302 neurons at class-level scope cls.neurons = [] for row in reader: if len(row[0]) > 0: # Only saves valid neuron names cls.neurons.append(row[0])
def open(cls,file_name): """ Open a file storing configuration in a JSON format """ Configureable.conf = Configure.open(file_name) return cls()
def open(cls, file_name): """ Open a file storing configuration in a JSON format """ Configureable.conf = Configure.open(file_name) return cls()