PyOpenWorm API¶
Basic Classes¶
Worm
¶
-
class
PyOpenWorm.
Worm
(scientific_name=False, **kwargs)[source]¶ Bases:
PyOpenWorm.dataObject.DataObject
A representation of the whole worm.
All worms with the same name are considered to be the same object.
Attributes
neuron_network (ObjectProperty) The neuron network of the worm muscle (ObjectProperty) Muscles of the worm -
add_reference
(g, reference_iri)¶ Add a citation to a set of statements in the database
Parameters: triples – A set of triples to annotate
-
get_neuron_network
()[source]¶ Return the neuron network of the worm.
Example:
# Grabs the representation of the neuronal network >>> net = P.Worm().get_neuron_network() # Grab a specific neuron >>> aval = net.aneuron('AVAL') >>> aval.type() set([u'interneuron']) #show how many connections go out of AVAL >>> aval.connection.count('pre') 77
Returns: An object to work with the network of the worm Return type: PyOpenWorm.Network
-
get_semantic_net
()[source]¶ - Get the underlying semantic network as an RDFLib Graph
Returns: A semantic network containing information about the worm Return type: rdflib.ConjunctiveGraph
-
load
()¶ Load in data from the database. Derived classes should override this for their own data structures.
load()
returns an iterable object which yields DataObjects which have the same class as the object and have, for the Properties set, the same valuesParameters: self – An object which limits the set of objects which can be returned. Should have the configuration necessary to do the query
-
muscles
()[source]¶ Get all Muscle objects attached to the Worm
Returns a set of all muscles:
Example:
>>> muscles = P.Worm().muscles() >>> len(muscles) 96
Returns: A set of all muscles Return type: set
-
retract
()¶ Remove this object from the data store.
-
save
()¶ Write in-memory data to the database. Derived classes should call this to update the store.
-
Network
¶
-
class
PyOpenWorm.
Network
(**kwargs)[source]¶ Bases:
PyOpenWorm.dataObject.DataObject
A network of neurons
Attributes
neuron Representation of neurons in the network synapse Representation of synapses in the network -
add_reference
(g, reference_iri)¶ Add a citation to a set of statements in the database
Parameters: triples – A set of triples to annotate
-
aneuron
(name)[source]¶ Get a neuron by name.
Example:
# Grabs the representation of the neuronal network >>> net = P.Worm().get_neuron_network() # Grab a specific neuron >>> aval = net.aneuron('AVAL') >>> aval.type() set([u'interneuron'])
Parameters: name – Name of a c. elegans neuron Returns: Neuron corresponding to the name given Return type: PyOpenWorm.Neuron
-
interneurons
()[source]¶ Get all interneurons
Returns: A iterable of all interneurons Return type: iter(Neuron)
-
load
()¶ Load in data from the database. Derived classes should override this for their own data structures.
load()
returns an iterable object which yields DataObjects which have the same class as the object and have, for the Properties set, the same valuesParameters: self – An object which limits the set of objects which can be returned. Should have the configuration necessary to do the query
-
neurons
()[source]¶ Gets the complete set of neurons in this network.
Example:
# Grabs the representation of the neuronal network >>> net = P.Worm().get_neuron_network() #NOTE: This is a VERY slow operation right now >>> len(set(net.neurons())) 302 >>> set(net.neurons()) set(['VB4', 'PDEL', 'HSNL', 'SIBDR', ... 'RIAL', 'MCR', 'LUAL'])
-
retract
()¶ Remove this object from the data store.
-
save
()¶ Write in-memory data to the database. Derived classes should call this to update the store.
-
Connection
¶
-
class
PyOpenWorm.
Connection
(pre_cell=None, post_cell=None, number=None, syntype=None, synclass=None, **kwargs)[source]¶ Bases:
PyOpenWorm.relationship.Relationship
Connection between neurons
Parameters: pre_cell : string or Neuron, optional
The pre-synaptic cell
post_cell : string or Neuron, optional
The post-synaptic cell
number : int, optional
The weight of the connection
syntype : {‘gapJunction’, ‘send’}, optional
The kind of synaptic connection. ‘gapJunction’ indicates a gap junction and ‘send’ a chemical synapse
synclass : string, optional
The kind of Neurotransmitter (if any) sent between pre_cell and post_cell
-
add_reference
(g, reference_iri)¶ Add a citation to a set of statements in the database
Parameters: triples – A set of triples to annotate
-
load
()¶ Load in data from the database. Derived classes should override this for their own data structures.
load()
returns an iterable object which yields DataObjects which have the same class as the object and have, for the Properties set, the same valuesParameters: self – An object which limits the set of objects which can be returned. Should have the configuration necessary to do the query
-
retract
()¶ Remove this object from the data store.
-
save
()¶ Write in-memory data to the database. Derived classes should call this to update the store.
-
Cell
¶
-
class
PyOpenWorm.
Cell
(name=False, lineageName=False, **kwargs)[source]¶ Bases:
PyOpenWorm.dataObject.DataObject
A biological cell.
All cells with the same name are considered to be the same object.
Parameters: name : string
The name of the cell
lineageName : string
The lineageName of the cell Example:
>>> c = Cell(name="ADAL") >>> c.lineageName() # Returns ["AB plapaaaapp"]
Attributes
name (DatatypeProperty) The ‘adult’ name of the cell typically used by biologists when discussing C. elegans lineageName (DatatypeProperty) The lineageName of the cell description (DatatypeProperty) A description of the cell divisionVolume (DatatypeProperty) When called with no argument, return the volume of the cell at division during development. When called with an argument, set the volume of the cell at division Example:: >>> v = Quantity(“600”,”(um)^3”) >>> c = Cell(lineageName=”AB plapaaaap”) >>> c.divisionVolume(v) -
add_reference
(g, reference_iri)¶ Add a citation to a set of statements in the database
Parameters: triples – A set of triples to annotate
-
blast
()[source]¶ Return the blast name.
Example:
>>> c = Cell(name="ADAL") >>> c.blast() # Returns "AB"
Note that this isn’t a Property. It returns the blast extracted from the ‘’first’’ lineageName saved.
-
daughterOf
()[source]¶ Return the parent(s) of the cell in terms of developmental lineage.
Example:
>>> c = Cell(lineageName="AB plapaaaap") >>> c.daughterOf() # Returns [Cell(lineageName="AB plapaaaa")]
-
load
()¶ Load in data from the database. Derived classes should override this for their own data structures.
load()
returns an iterable object which yields DataObjects which have the same class as the object and have, for the Properties set, the same valuesParameters: self – An object which limits the set of objects which can be returned. Should have the configuration necessary to do the query
-
parentOf
()[source]¶ Return the direct daughters of the cell in terms of developmental lineage.
Example:
>>> c = Cell(lineageName="AB plapaaaap") >>> c.parentOf() # Returns [Cell(lineageName="AB plapaaaapp"),Cell(lineageName="AB plapaaaapa")]
-
retract
()¶ Remove this object from the data store.
-
save
()¶ Write in-memory data to the database. Derived classes should call this to update the store.
-
Neuron
¶
-
class
PyOpenWorm.
Neuron
(name=False, **kwargs)[source]¶ Bases:
PyOpenWorm.cell.Cell
A neuron.
See what neurons express some neuropeptide
Example:
# Grabs the representation of the neuronal network >>> net = P.Worm().get_neuron_network() # Grab a specific neuron >>> aval = net.aneuron('AVAL') >>> aval.type() set([u'interneuron']) #show how many connections go out of AVAL >>> aval.connection.count('pre') 77 >>> aval.name() u'AVAL' #list all known receptors >>> sorted(aval.receptors()) [u'GGR-3', u'GLR-1', u'GLR-2', u'GLR-4', u'GLR-5', u'NMR-1', u'NMR-2', u'UNC-8'] #show how many chemical synapses go in and out of AVAL >>> aval.Syn_degree() 90
Parameters: name : string
The name of the neuron.
Attributes
type (DatatypeProperty) The neuron type (i.e., sensory, interneuron, motor) receptor (DatatypeProperty) The receptor types associated with this neuron innexin (DatatypeProperty) Innexin types associated with this neuron neurotransmitter (DatatypeProperty) Neurotransmitters associated with this neuron neuropeptide (DatatypeProperty) Name of the gene corresponding to the neuropeptide produced by this neuron neighbor (Property) Get neurons connected to this neuron if called with no arguments, or with arguments, state that neuronName is a neighbor of this Neuron connection (Property) Get a set of Connection objects describing chemical synapses or gap junctions between this neuron and others -
GJ_degree
()[source]¶ Get the degree of this neuron for gap junction edges only
Returns: total number of incoming and outgoing gap junctions Return type: int
-
Syn_degree
()[source]¶ Get the degree of a this neuron for chemical synapse edges only
Returns: total number of incoming and outgoing chemical synapses Return type: int
-
add_reference
(g, reference_iri)¶ Add a citation to a set of statements in the database
Parameters: triples – A set of triples to annotate
-
blast
()¶ Return the blast name.
Example:
>>> c = Cell(name="ADAL") >>> c.blast() # Returns "AB"
Note that this isn’t a Property. It returns the blast extracted from the ‘’first’’ lineageName saved.
-
daughterOf
()¶ Return the parent(s) of the cell in terms of developmental lineage.
Example:
>>> c = Cell(lineageName="AB plapaaaap") >>> c.daughterOf() # Returns [Cell(lineageName="AB plapaaaa")]
-
load
()¶ Load in data from the database. Derived classes should override this for their own data structures.
load()
returns an iterable object which yields DataObjects which have the same class as the object and have, for the Properties set, the same valuesParameters: self – An object which limits the set of objects which can be returned. Should have the configuration necessary to do the query
-
parentOf
()¶ Return the direct daughters of the cell in terms of developmental lineage.
Example:
>>> c = Cell(lineageName="AB plapaaaap") >>> c.parentOf() # Returns [Cell(lineageName="AB plapaaaapp"),Cell(lineageName="AB plapaaaapa")]
-
retract
()¶ Remove this object from the data store.
-
save
()¶ Write in-memory data to the database. Derived classes should call this to update the store.
-
Muscle
¶
-
class
PyOpenWorm.
Muscle
(name=False, **kwargs)[source]¶ Bases:
PyOpenWorm.cell.Cell
A single muscle cell.
See what neurons innervate a muscle:
Example:
>>> mdr21 = P.Muscle('MDR21') >>> innervates_mdr21 = mdr21.innervatedBy() >>> len(innervates_mdr21) 4
Attributes
neurons (ObjectProperty) Neurons synapsing with this muscle receptors (DatatypeProperty) Get a list of receptors for this muscle if called with no arguments, or state that this muscle has the given receptor type if called with an argument -
add_reference
(g, reference_iri)¶ Add a citation to a set of statements in the database
Parameters: triples – A set of triples to annotate
-
blast
()¶ Return the blast name.
Example:
>>> c = Cell(name="ADAL") >>> c.blast() # Returns "AB"
Note that this isn’t a Property. It returns the blast extracted from the ‘’first’’ lineageName saved.
-
daughterOf
()¶ Return the parent(s) of the cell in terms of developmental lineage.
Example:
>>> c = Cell(lineageName="AB plapaaaap") >>> c.daughterOf() # Returns [Cell(lineageName="AB plapaaaa")]
-
load
()¶ Load in data from the database. Derived classes should override this for their own data structures.
load()
returns an iterable object which yields DataObjects which have the same class as the object and have, for the Properties set, the same valuesParameters: self – An object which limits the set of objects which can be returned. Should have the configuration necessary to do the query
-
parentOf
()¶ Return the direct daughters of the cell in terms of developmental lineage.
Example:
>>> c = Cell(lineageName="AB plapaaaap") >>> c.parentOf() # Returns [Cell(lineageName="AB plapaaaapp"),Cell(lineageName="AB plapaaaapa")]
-
retract
()¶ Remove this object from the data store.
-
save
()¶ Write in-memory data to the database. Derived classes should call this to update the store.
-
Channel
¶
-
class
PyOpenWorm.
Channel
(subfamily=False, **kwargs)[source]¶ Bases:
PyOpenWorm.dataObject.DataObject
An ion channel.
Channels are identified by subtype name.
Parameters: subfamily : string
The subfamily to which the ion channel belongs
Attributes
subfamily (DatatypeProperty) The subfamily to which the ion channel belongs Models (Property) Get experimental models of this ion channel -
add_reference
(g, reference_iri)¶ Add a citation to a set of statements in the database
Parameters: triples – A set of triples to annotate
-
load
()¶ Load in data from the database. Derived classes should override this for their own data structures.
load()
returns an iterable object which yields DataObjects which have the same class as the object and have, for the Properties set, the same valuesParameters: self – An object which limits the set of objects which can be returned. Should have the configuration necessary to do the query
-
retract
()¶ Remove this object from the data store.
-
save
()¶ Write in-memory data to the database. Derived classes should call this to update the store.
-
Evidence
¶
-
class
PyOpenWorm.
Evidence
(conf=False, **source)[source]¶ Bases:
PyOpenWorm.dataObject.DataObject
A representation of some document which provides evidence like scholarly references, for other objects.
Possible keys include:
pmid,pubmed: a pubmed id or url (e.g., 24098140) wbid,wormbase: a wormbase id or url (e.g., WBPaper00044287) doi: a Digitial Object id or url (e.g., s00454-010-9273-0)
Parameters: doi : string
A Digital Object Identifier (DOI) that provides evidence, optional
pmid : string
A PubMed ID (PMID) that point to a paper that provides evidence, optional
wormbaseid : string
An ID from WormBase that points to a record that provides evidence, optional
author : string
The author of the evidence
title : string
The title of the evidence
year : string or int
The date (e.g., publication date) of the evidence
uri : string
A URL that points to evidence
Attributes
asserts (ObjectProperty (value_type=DataObject)) When used with an argument, state that this Evidence asserts that the relationship is true. Example:: import bibtex bt = bibtex.parse(“my.bib”) n1 = Neuron(“AVAL”) n2 = Neuron(“DA3”) c = Connection(pre=n1,post=n2,class=”synapse”) e = Evidence(bibtex=bt[‘white86’]) e.asserts(c) Other methods return objects which asserts accepts. Example:: n1 = Neuron(“AVAL”) r = n1.neighbor(“DA3”) e = Evidence(bibtex=bt[‘white86’]) e.asserts(r) When used without arguments, returns a sequence of statements asserted by this evidence Example:: import bibtex bt = bibtex.parse(“my.bib”) n1 = Neuron(“AVAL”) n2 = Neuron(“DA3”) c = Connection(pre=n1,post=n2,class=”synapse”) e = Evidence(bibtex=bt[‘white86’]) e.asserts(c) list(e.asserts()) # Returns a list [..., d, ...] such that d==c doi (DatatypeProperty) A Digital Object Identifier (DOI) that provides evidence, optional pmid (DatatypeProperty) A PubMed ID (PMID) that point to a paper that provides evidence, optional wormbaseid (DatatypeProperty) An ID from WormBase that points to a record that provides evidence, optional author (DatatypeProperty) The author of the evidence title (DatatypeProperty) The title of the evidence year (DatatypeProperty) The date (e.g., publication date) of the evidence uri (DatatypeProperty) A URL that points to evidence -
add_reference
(g, reference_iri)¶ Add a citation to a set of statements in the database
Parameters: triples – A set of triples to annotate
-
load
()¶ Load in data from the database. Derived classes should override this for their own data structures.
load()
returns an iterable object which yields DataObjects which have the same class as the object and have, for the Properties set, the same valuesParameters: self – An object which limits the set of objects which can be returned. Should have the configuration necessary to do the query
-
retract
()¶ Remove this object from the data store.
-
save
()¶ Write in-memory data to the database. Derived classes should call this to update the store.
-