Fraglets
PyCellChemistry documentation index
source code: src/Fraglets.py

#---------------------------------------------------------------------------
#
# Fraglets.py: a python implementation of Fraglets, a chemically-inspired
# programming language for computer networks
#
# Reference:
#
# C. Tschudin. Fraglets: A metabolistic execution model for communication
# protocols. Proc. 2nd Annual Symposium on Autonomous Intelligent Networks
# and Systems (AINS), July 2003.
#
# python implementation by Lidia Yamamoto, Belgium, October 2013
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Copyright (C) 2015 Lidia A. R. Yamamoto
# Contact: http://www.artificial-chemistries.org/
#
# This file is part of PyCellChemistry.
#
# PyCellChemistry is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 3, as published by the Free Software Foundation.
#
# PyCellChemistry is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PyCellChemistry, see file COPYING. If not, see
# http://www.gnu.org/licenses/
#


Modules
numpy
sys


Classes
Fraglets


class Fraglets
Methods defined here:
__init__(self, nid='')
create a Fraglets interpreter and reaction vessel with node id
'nid'
add_cnx(self, dst, addr)
add a link between this vessel and another vessel: 'dst' is the
tag that identifies the link; 'addr' is the reference to the
Fraglets object corresponding to the destination vessel
del_cnx(self, dst)
delete a link given its tag id 'dst'
getmethod(self, mol)
get method that implements the instruction at the head
(first symbol) of fraglet 'mol'
getname(self, op)
get human-friendly name for an instruction in character-encoded
format
inert(self)
true if reactor is inert: there are no more reactions to fire
inject(self, mol, mult=1)
inject 'mult' copies of fraglet 'mol' in the reactor
inject_list(self, mlist)
inject the list of fraglets 'mlist' in the reactor
interpret(self, fname='')
interpret a file containing fraglet code for a single vessel
isbimol(self, mol)
true if fraglet 'mol' starts with a bimolecular reaction rule
ismatchp(self, mol)
true if fraglet 'mol' starts with a matchp instruction
ispassive(self, mol)
true if fraglet 'mol' does not start with a reaction rule
isunimol(self, mol)
true if fraglet 'mol' starts with a unimolecular reaction rule
iterate(self)
one iteration of fraglets for single-vessel configuration
mol2fraglet(self, mol, mult=1)
convert a 'character-encoded' molecule into a human-readable
fraglet
parse(self, frag)
parse fraglet, converting it to a condensed 'character-encoded'
string with one character per symbol
propensity(self)
calculate all propensities of bimolecular reactions
r_dup(self, mol)
fire a 'dup' fraglet: duplicate 3rd symbol
r_exch(self, mol)
fire an 'exch' fraglet: exchange symbols n. 3 and 4
r_fork(self, mol)
fire a 'fork' fraglet that duplicates its tail
r_match(self, mol1, mol2)
fire a 'match' fraglet: merge 2 fraglets
r_matchp(self, mol1, mol2)
fire a 'matchp' fraglet: merge 2 fraglets, while keeping a
copy of the original matchp fraglet
r_nop(self, mol)
fire a 'nop' fraglet: consume 'nop' symbol
r_nul(self, mol)
fire a 'nul' fraglet: delete the fraglet
r_pop(self, mol)
fire a 'pop' fraglet: consume 'nop' symbol plus 3rd symbol
r_send(self, mol)
fire a 'send' fraglet by consuming the header symbols and
injecting the remaining tail in the destination vessel
r_split(self, mol)
fire a 'split' fraglet: split at the first occurrence of a '*'
symbol
react(self, w)
perform the selected reaction pointed to by the dice position w
(typically involked from the hierarchical Gillespie SSA
implementation in Cell.py)
react1(self, mol)
fire unimolecular reaction involving molecule 'mol'
react2(self, mol1, mol2)
fire bimolecular reaction between mol1 and mol2
run(self, niter)
run for 'niter' iterations, or until the reactor is inert
run_bimol(self)
pick one bimolecular reaction using Gillespie's SSA;
assumes propensities are up to date;
for single reactor only:
if more than one reactor, use react() within Cell instead
run_unimol(self)
run all unimolecular transformations at once
set_nodeid(self, tag)
assign nodeid 'tag' to this vessel
trace(self)
print all fraglets in the vessel, in human-readable format
trace_all_msets(self)
print all fraglets in the vessel, in 'compiled' character-code
format (for debugging purposes)
trace_mlist(self, mlist)
print a list of fraglets
trace_mol(self, mol, mult=1)
print a given fraglet, in human-readable format
trace_reaction(self, mlist1, mlist2)
print reaction in the form [frag1], [frag2] --> [frag3]
(doesn't work for the send reaction)


Functions
codegrowth()
elongating fraglets
quine()
quine: a self-replicating fraglet
rndsoup()
generate a random soup of fraglets and run it for a few iterations
test_interpreter(filename)
read fraglets program from a file and run it for a few iterations


Generated automatically by pydoc, July 10, 2015


Generated automatically by pydoc, July 10, 2015