# Programmer’s documentation for influx_s

In this chapter, Application Programming Interface (API) docs are collected. It can be helpful for programmers desiring to extend some features of `influx_s` or to fix some bugs. This chapter can be safely skipped by users aiming at simple usage of `influx_s` for biological research.

## C13_ftbl

- Parse .ftbl
- Analyse ftbl

Restrictions:

  - metabolite name cannot have

    “:”

      it’s a separator in measure id

    “+”

      in measurements it can be metab1+metab2+…

`C13_ftbl.``aglom`(na, ta, loop)

  new matrix A (na), transpose A (ta) are used to aglomerate neigbour mutually influencing nodes in a supernode. Aglomerated noeds are put in the loop dictionnary. Return False if no nodes were aglomerated.

`C13_ftbl.``aglom_loop1`(A)

  Agglomerate nodes of A if they are mutually influence each other i.e.they are in a loop of length 1. Return a new dictionary of influence where entries are those of A aglomerated and glued “by” tab symbol

`C13_ftbl.``allprods`(srcs, prods, isos, metab, isostr)

  Return a set of tuples (cmetab, cisostr, vmetab, visostr) where cmetab and cisostr describe a contex metabolite which combined with metab+isostr produced vmetab+visostr. if metab is alone on its reaction part cmetab and cisostr are set to an empty string (“”). The set covers all combination of metab+isostr and its co-substrates which produce isotopes having at least one labeled carbon from metab+isostr. Co-substrate isotops are in a dictionary isos[cmetab]=list(cisotopes).

`C13_ftbl.``bcumo_decomp`(bcumo)

  bcumo is a string of the form #[01x]+. It has to be decomposed in the linear combination of cumomers #[1x]+. The coefficients of this linear combination are 1 or -1. So it can be represented as sum(cumos_positive)-sum(cumos_negative). The result of this function is a dictionary {“+”: list of icumos, “-“: list of icumos}. icumo is an integer whose binary form indicates 1’s positions in a cumomer.

`C13_ftbl.``conv_mid`(x, y) → z

  convolute two mid vectors (numpy arrays) and return the result as numpy array.

`C13_ftbl.``cumo_infl`(netan, cumo)->list(tuple(in_cumo, fl, imetab, iin_metab))

  return the list of tuples (in_cumo, fl, imetab, iin_metab): input cumomer, flux (fwd.fl or rev.fl), index of metab and index of in_metab generating cumo. cumo is in format “metab:icumo”. Condenstation reaction will give the same flux and icumo but various iin_metab. Convergent point will give multiple fluxes.

`C13_ftbl.``cumo_iw`(w, nlen)

  iterator for a given cumomer weight w in the carbon length nlen

`C13_ftbl.``cumo_path`(starts, A, visited={})

  Enumerate cumomers along reaction pathways. Algo: start from an input, follow chemical pathways till no more neighbours or till only visited metabolite rest in network. Return a list of cumomer pathways. Each pathways is an ordered list.

`C13_ftbl.``dom_cmp`(A, i, j)

  Compares influances of i-th and j-th lements of A. Returns 0 if i and j are mutually influenced, 1 if i in A[j] (i influences j) , -1 if otherwise

`C13_ftbl.``enum_path`(starts, netw, outs, visited={})

  Enumerate metabilites along to reaction pathways. Algo: start from an input, follow chemical pathways till an output or already visited metabolite. Returns a list of metabolite pathways. Each pathways is an ordered list.

`C13_ftbl.``formula2dict`(f, pterm=re.compile('\\W*([+-])\\W*'), pflux=re.compile('(?P<coef>\\d+\\.?\\d*|^)?\\s*\\*?\\s*(?P<var>[a-zA-Z_[\\]()][\\w\\. -\\[\\]]*)\\W*'))

  parse a linear combination sum([+|-][a_i][*]f_i) where a_i is a positive number and f_i is a string starting by non-digit and not white character (# is allowed). Output is a dict f_i:[+-]a_i

`C13_ftbl.``frag_prod`(metab, frag, s, cmetab, cfrag, cs, prods)

  Get fragments from labeled substrates

`C13_ftbl.``ftbl_netan`(ftbl, netan, emu_framework=False, fullsys=False, case_i=False)

  analyse ftbl dictionary to find

  > - network inputs (input)
  > - network outputs (output)
  > - substrates (subs)
  > - products (prods)
  > - metabolites (metabs)
  > - reactions (reacs)
  > - not reversible reactions (subset of reacs) (notrev) all above items are in named sets
  > - stocheometric matrix (sto_r_m)
  > - stocheometric matrix (sto_m_r)
  > - fwd-rev flux matrix (flux_m_r)
  > - cumomer balances (cumo_m_r_m)
  > - carbon length (Clen)
  > - reaction formula (formula)
  > - metabolite network (metab_netw)
  > - carbon transitions (carbotrans)
  > - free fluxes (flux_free)
  > - constrained fluxes (flux_constr)
  > - measured fluxes (flux_measured)
  > - variable growth fluxes (flux_vgrowth)
  > - input isotopomers (iso_input)
  > - input cumomers (cumo_input)
  > - input reduced cumomers (rcumo_input)
  > - flux inequalities (flux_ineqal)
  > - flux equalities (flux_eqal)
  > - label measurements, H1 (label_meas)
  > - peak measurements, C13 (peak_meas)
  > - mass measurements (mass_meas)
  > - cumomer ordered lists (vcumo)
  > - unknown fluxes ordered lists (vflux)
  > - linear problem on fluxes (Afl, bfl)
  > - free fluxes ordered lists (vflux_free)
  > - fw-rv fluxes ordered lists (vflux_fwrv)
  > - row names ordered lists for Afl (vrowAfl)
  > - in-out fluxes (flux_in, flux_out)
  > - measured concentrations (metab_measured)

`C13_ftbl.``ftbl_parse`(f) → dict

  read and parse .ftbl file. The only input parameter f is a stream pointer with read permission or a file name. This function parses the input and returns a dictionnary with items corresponding to sections in .ftbl. One section is added. “TRANS” correponds to carbon transitions.

`C13_ftbl.``infl`(metab, netan)->set(fluxes)

  List incoming fluxes for this metabolite (fwd.reac, rev.reac, …)

`C13_ftbl.``iso2cumo`(netan, strin, in_cumo, icumo, in_metab)

  calculate cumomer fraction from isotopomer ones

`C13_ftbl.``iso2emu`(netan, inmetab, mask, mpi, e)

  calculate emu fraction from isotopomer dict iso_input. The fraction corresponds to a fragment defined by a mask and the mass component mpi. Return a real number in [0; 1] interval.

`C13_ftbl.``label_meas2matrix_vec_dev`(netan)

  use netan[“label_meas”] list to construct a corresponding list of measure matrix matx_lab such that scale_diag*metab_pool_diag*matx_lab*(cumos_vector,1) corresponds to label_measurements_vector. matx_lab is defined as list of dict{“scale”:scale_name, “coefs”:dict{icumo:coef}, “metab”: metabolite, “poolid”: metabolite pool id if pooled} where coef is a contribution of cumo in linear combination for given measure. scale_name is of the form “metabs;group”. Group number is to group measurements of the same measurement set. poolid is the index of pool list in pooled where each list regroups 0-based indexes rows in returned matrix for what has to be pooled together. vec is a list of measurements (values in .ftbl) dev is a list of deviations. Elements in matx_lab, vec and dev are ordered in the same way. The returned result is a dict (mat,vec,dev)

`C13_ftbl.``labprods`(prods, metab, isostr, strs)

  Return a set of tuples (vmetab,visostr) which receive at least one labeled carbon from (metab, isostr)

`C13_ftbl.``lowtri`(A)

  Try low triangular ordering of matrix A entries

`C13_ftbl.``mass_meas2matrix_vec_dev`(netan)

  use netan[“mass_meas”] list to construct a corresponding list of measure matrix matx_mass such that scale_diag*matx_mass*cumos_vector corresponds to mass_measures_vector. matx_mass is defined as matx_lab in label_meas2matrix_vec_dev() Elements in matx_mass, vec and dev are ordered in the same way. scale name is defined as “metab;fragment_mask” The returned result is a dict (mat,vec,dev)

`C13_ftbl.``mat2graph`(A, fp)

  write digraph file on file pointer fp representing links in matrix A given as bi-level dictionnary. A key of first level (row index) is influenced by keys of second level (column indicies).

`C13_ftbl.``mat2pbm`(A, v, fp)

  Write an image map of non-zero entries of matrix A to file pointer fp. Matrix A is a dictionnary, v is a list ordering keys of A.

`C13_ftbl.``mecoparse`(terms, pmeco=re.compile('\\s*((?P<coef>\\d+\\.?\\d*|^)\\s*\\*\\s*)?(?P<metab>[^*+ ]*)\\s*$'))

  Parse a string term from a list (or a sing string) of chemical equation entries. The general form of each term is ‘coef*metab’. coef (if present) must be separated from metab by ‘*’ and be convertible to float. metab can start with a number (e.g. ‘6PG’) so the presence of ‘*’ is mandatory to separate coef from metab.If coef is absent, it is considered to be 1. Return a list of (or a single for str) tuples (metab (str), coef (real)).

`C13_ftbl.``ms_frag_gath`(netan)

  gather metabolite fragments necessary to obtain a given set of data observed in MS measurements. The fragment mask is encoded in the same way as cumomers, Met:7 <=> Met#(0)111

`C13_ftbl.``ntimes`(n)

  Return charcater string ‘once’ for n=1, ‘twice’ for n=2 and ‘n times’ for other n

`C13_ftbl.``peak_meas2matrix_vec_dev`(netan, dmask={'D+': 3, 'D-': 6, 'DD': 7, 'S': 2, 'T': 7})

  use netan[“peak_meas”] list to construct a corresponding list of measure matrix matx_peak such that scale_diag*matx_peak*cumos_vector corresponds to peak_measures_vector. dmask is a dictionary with 3 carbon labeling pattern mask for various peak types. The middle bit corresponds to the targeted carbon, lower bit corresponds to the next neighbour (D+) and higher bit corresponds to previous carbon (D-). matx_peak is defined as matx_lab in label_meas2matrix_vec_dev() Elements in matx_peak, vec and dev are ordered in the same way. scale name is defined as “metab;c_no;irow” The returned result is a dict (mat,vec,dev)

`C13_ftbl.``proc_kinopt`(ftbl, netan)

  Proceed label kinetics options from OPTIONS section: file_labcin, dt, tmax, nsubdiv_dt

`C13_ftbl.``proc_label_input`(ftbl, netan)

  Proceed LABEL_INPUT section in ftbl and add result to the list netan[“iso_input”] List item is a dict {}metab;{isotop_int_index:fraction}}

`C13_ftbl.``proc_label_meas`(ftbl, netan)

  Proceed LABEL_MEASUREMENT section of ftbl file, add the result to a list of dicts

`C13_ftbl.``proc_mass_meas`(ftbl, netan)

  Proceed PEAK_MEASUREMENT section of ftbl file, add the result to a list of dicts

`C13_ftbl.``proc_peak_meas`(ftbl, netan)

  Proceed PEAK_MEASUREMENT section of ftbl file, add the result to a list of dicts

`C13_ftbl.``prod`(metab, iso, s, cmetab, ciso, cs, prods)->set()

  get isotops from labeled substrates

`C13_ftbl.``rcumo_sys`(netan, emu=False)

  Calculate reduced cumomers or EMU systems A*x=b we start with observed cumomers (emus) of max weight and we include only needed involved cumomers (emus) A list of cumomer (emu) lists (by weight) is stored in netan[“vrcumo”] (netan[“vemu”])

`C13_ftbl.``src_ind`(substrate, product, iprod)

  For a given substrate and product carbon strings (e.g. “abc”, “ab”) calculate substrate index corresponding to product index. Return None if no source found. Return 0 if iprod==0 and intersection of product and substrate strings is not empty

`C13_ftbl.``t_iso2cumo`(n)

  t_iso2cumo(n) return transition matrix from isotopomers fractions to cumomer vector n - carbon number return numpy array of size (2**n,2**n)

`C13_ftbl.``t_iso2m`(n)

  t_iso2m(n) return transition matrix from isotopomers fractions to MID vector n - carbon number return numpy array of size (n+1,2**n)

`C13_ftbl.``t_iso2pos`(n)

  t_iso2pos(n) return transition matrix from isotopomers fractions to positional labelling vector (cumomers of weight 1) n - carbon number return numpy array of size (n,2**n)

`C13_ftbl.``topo_order`(A, tA)

  Try to sort keys of A in topological order. tA is just a transpose of A

`C13_ftbl.``transpose`(A)

  Transpose a matrix defined as a dict.

`C13_ftbl.``werr`()

  Write string to stream. Returns the number of characters written (which is always equal to the length of the string).

`C13_ftbl.``wout`()

  Write string to stream. Returns the number of characters written (which is always equal to the length of the string).

## ftbl2code

Module for translation of .ftbl file to R code

`ftbl2code.``netan2Abcumo_spr`(varname, Al, bl, vcumol, minput, f, fwrv2i, incu2i_b1)

  Transform cumomer linear sytems collection (from ftbl file) to a R code calculating sparse matrix A and vector b in A*x+b=0 for a given weight of fragment iw (index in resulting list) Flux vector fl of all fwd. and rev. fluxes are known at R runtime.

  Resulting code is a list sprAb indexed by cumomer weight (cf. generated R comments for details on sprAb) cumomer vector incu=c(1, xi, xl), xi - input cumomers, xl - lighter cumomers.

  incu2i_b1 gives i in incu from cumomer name. i=1 corresponds to the constant 1.

`ftbl2code.``netan2R_cumo`(netan, org, f) → dict

  generate data structures for full cumomer matrices

`ftbl2code.``netan2R_fl`(netan, org, f)

  generate R code for flux and pool part for more details cf. netan2Rinit()

`ftbl2code.``netan2R_ineq`(netan, org, f)

  generate inequality code

`ftbl2code.``netan2R_meas`(netan, org, f)

  generate code for measure treatment

`ftbl2code.``netan2Rinit`(netan, org, f, fullsys, emu=False, ropts=[])

  Write R code for initialization of all variables before cumomer system resolution by khi2 minimization. :param netan: a collection of parsed ftbl information :param f: R code output pointer :param fullsys (logical): write a code for the full or only reduced cumomer system :param emu (logical): write equations in EMU framework or cumomer (default) :param ropts: list of items “param=value” to be written as is in R file.

  Returns: | a dictionnary with some python variables: * “measures”: measures, * “o_mcumos”: o_mcumos, * “cumo2i”: cumo2i, * …

## ftbl2netan

Parse ftbl file from stdin or from first parameter and write netan in kvh format on stdout usage: ftbl2netan.py network[.ftbl] [> network.netan]

## ftbl2optR

Transform an ftbl to R code which will solve an optimization of flux analysis problem \(\arg \min_{\Theta} S\), where \(S=||\mathrm{Predicted}-\mathrm{Observed}||^{2}_{\Sigma}\) and \(\Theta\) is a vector of parameters to fit: free fluxes (net+xch), scaling parameters and metabolite concentrations pools. Two variants of R code can be generated: “s” and “i” for stationary and isotopically nonstationary labeling. Predicted vector is obtained from cumomer or emu vector x (calculated from free fluxes and divided in chunks according to the cumo weight) by multiplying it by the measurement matrices, weighted by metabolite pools (in case of pooling) and scale factor (for stationary case only), boths coming from ftbl file. Observed values vector xo is extracted from ftbl file for “s” case and from special text file for “i” case. It is composed of flux, label measurements and metabolite pools. \(\Sigma^2\), covariance diagonal matrices sigma[flux|mass|label|peak|metab.pool] is orginated from the ftbl file.

usage: ./ftbl2optR.py [opts] organism where organism is the ftbl informative part of file name (before .ftbl), e.g. organism.ftbl after execution a file organism.R will be created. If it already exists, it will be silently overwritten. The system Afl*flnx=bfl is created from the ftbl file.

Important python variables:
  - case_i - if True, the case is “i” otherwise it is the “s” case
Collections:
  - netan - (dict) ftbl structured content
  - tfallnx - (3-tuple[reac,[“d”|”f”|”c”], [“net”|”xch”]] list)- total flux collection
  - measures - (dict) exp data
  - rAb - (list) reduced linear systems A*x_cumo=b (a system by weight)
  - scale - unique scale names
  - nrow - counts scale names
  - o_sc - ordered scale names
  - o_meas - ordered measurement types
File names (str):
  - n_ftbl (descriptor f_ftbl)
  - n_R (R code) (f)
  - n_fort (fortran code) (ff)
Counts:
  - nb_fln, nb_flx, nb_fl (dependent fluxes: net, xch, total), nb_ffn, nb_ffx (free fluxes)
Index translators:
  - fwrv2i - flux names to index in R:fwrv
  - cumo2i - cumomer names to index in R:x
  - ir2isc - mapping measurement rows indexes on scale index isc[meas]=ir2isc[meas][ir]
Vector names:
  - cumos (list) - names of R:x
  - o_mcumos - cumomers involved in measurements

Important R variables:

Scalars:
  - nb_w, nb_cumos, nb_fln, nb_flx, nb_fl (dependent or unknown fluxes),
  - nb_ffn, nb_ffx, nb_ff (free fluxes),
  - nb_fcn, nb_fcx, nb_fc (constrained fluxes),
  - nb_ineq, nb_param, nb_fmn
Name vectors:
  - nm_cumo, nm_fwrv, nm_fallnx, nm_fln, nm_flx, nm_fl, nm_par,
  - nm_ffn, nm_ffx,
  - nm_fcn, nm_fcx,
  - nm_mcumo, nm_fmn
Numeric vectors:
  - fwrv - all fluxes (fwd+rev)
  - x - all cumomers (weight1+weight2+…)
  - param - free flux net, free flux xch, scale label, scale mass, scale peak, metabolite concentrations
  - fcn, fcx, fc - constrained fluxes
  - bp - helps to construct the rhs of flux system
  - xi -cumomer input vector
  - fallnx - complete flux vector (constr+net+xch)
  - bc - helps to construct fallnx
  - li - inequality vector (mi%*%fallnx>=li)
  - ir2isc - measure row to scale vector replicator
  - ci - inequalities for param use (ui%*%param-ci>=0)
  - measvec - measurement vector
  - fmn - measured net fluxes
Matrices:
  - Afl, qrAfl, invAfl,
  - p2bfl - helps to construct the rhs of flux system
  - mf, md - help to construct fallnx
  - mi - inequality matrix (ftbl content)
  - ui - inequality matrix (ready for param use)
  - measmat - for measmat*x+memaone=vec of simulated not-yet-scaled measurements
Functions:
  - lab_sim - translate param to flux and cumomer vector (initial approximation)
  - cumo_cost - cost function (khi2)
  - cumo_gradj - implicit derivative gradient

## ftbl2xgmml

read a .ftbl file from a parameter and translate to .xgmml file. The generated xgmml file can be then imported into Cytoscape (www.cytoscape.org). Reactions involving two substrates or two products are represented by an additional almost invisible node while one-to-one reactions are just edges. Node and edge attributes are written in respective xml attributes. Compatibility: cytoscape v2.8.3 and v3.0

usage: ftbl2xgmml.py [-h|–help] mynetwork.ftbl [> mynetwork.xgmml]

OPTIONS -h, –help print this message and exit

param: | mynetwork the base of an ftbl file (mynetwork.ftbl)
returns: | mynetwork.xgmml – file of the network definition suitable for cytoscape

Copyright 2014, INRA, France Author: Serguei Sokol (sokol at insa-toulouse dot fr) License: Gnu Public License (GPL) v3 http://www.gnu.org/licenses/gpl.html

## kvh

`kvh.``dict2kvh`(d, fp=sys.stdout, indent=0)

  Write a nested dictionary on the stream fp (stdout by default).

`kvh.``escape`(s, spch="|&;<>()$`\"' tn*?[#~=%", ech="\")

  escape special characters in s. The special characters are listed in spch. Escaping is done by putting an ech string before them. Default spch and ech corresponds to quoting Shell arguments in accordance with http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html Example: os.system(“ls %s” % escape(file_name_with_all_meta_chars_but_newline)); .. note:

  1. Escaped <newline> is removed by a shell if not put in a single-quotted string (‘ ‘)
  2. A single-quote character even escaped cannot appear in a single-quotted string

`kvh.``kvh2dict`(fp)

  Read a kvh file from fp pointer then translate its tlist structure to a returned hierarchical dictionnary. Repeated keys at the same level of a dictionnary are silently overwritten

`kvh.``kvh2obj`(fp)

  Read a kvh file from fp pointer then translate its tlist structure to a returned object hierarchy. Repeated fields at the same level of an object are silently overwritten

`kvh.``kvh2tlist`(fp, lev=[0], indent=[0])

  Read a kvh file from fp stream descriptor and organize its content in list of tuples [(k1,v1), (k2,[(k2.1, v2.1)])] If fp is a string, it is used in open() operator

`kvh.``kvh_get_matrix`(fp, keys)

  Get matrix or vector whose key suite is in a list keys from a kvh file given in fp (file pointer of file name). For big kvh files, this function can be much faster than kvh2tlist()+kvh_getv_by_k() Return a matrix which is a list of lists (rows). The first item in each row is the row name. In case of matrix (i.e. “row_col” is present in kvh file), the very first row contain column names.

`kvh.``kvh_getv_by_k`(kvt, kl) → None|String|kvh tlist

  get value from kvt (kvh tlist) according to the key hierarchy defined in the list of keys kl. Return None if no key is found

`kvh.``kvh_read_key`(fp)
  Read a string from the current position till the first unescaped ,
    or the end of stream fp.

  Returns: | tuple (key, sep), sep=None at the end of the stream

`kvh.``kvh_read_val`(fp)

  > Read a string from current position till the first unescaped

  or the end of file.
    Return the read string.

`kvh.``kvh_tlist2dict`(tlist)

  Translate a tlist structure read from a kvh file to a hierarchical dictionnary. Repeated keys at the same level of a dictionnary are silently overwritten

`kvh.``kvh_tlist2obj`(tlist)

  Translate a tlist structure read from a kvh file to a hierarchical dictionnary. Repeated keys at the same level of a dictionnary are silently overwritten

`kvh.``tlist2kvh`(d, fp=sys.stdout, indent=0)

  Write a (hierarchichal) list of 2-tuples on the stream fp (stdout by default).

## tools_ssg

`tools_ssg.``aff`(name, obj, ident=0, f=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)
  print formatted object:
    name=obj

`tools_ssg.``arr2pbm`(A, fp)

  Write an image map of non-zero entries of matrix A to file pointer fp. Matrix A is an array

`tools_ssg.``asort`(d)

  sorts a dictionnary by value preserving key=value association the result is a list of tuples (key,value)

`tools_ssg.``cumsum`(l, tot=0)

  Returns: | an iterable of the length len(l)+1 with cumulated sum of items in l. First element in cumsum is equal to initial value of tot. Result depends on the meaning of “+” operator for l items and of tot type.

      >>> list(cumsum("abc",tot=""))
      ['', 'a', 'ab', 'abc']

      >>> list(cumsum(xrange(1,5)))
      [0, 1, 3, 6, 10]

`tools_ssg.``expandbit`(i, pos)

  copy bits set to 1 in i to the result position given in the list pos. length of pos must be greater or equal to bitlength of i

`tools_ssg.``icumo2iiso`(icumo, size)

  Returns: | iterator on isotopomers composing a given icumo. size is carbon number

`tools_ssg.``isstr`(s)

  Returns: | True if the argument is a string

`tools_ssg.``iterbit`(i, size=0)

  iterator on bits in integer starting from 0-position. The iterator stops at highest non-zero bit

`tools_ssg.``iternumbit`(i, size=0)

  iterator on bits and its number in integer starting from 0-position. The iterator yields tuples (n,bit). If optional size is zero then it stops at highest non-zero bit. If not, it will stop at bit number size-1.

`tools_ssg.``join`(c, l, p='', s='', a='')

  join the items of the list (or iterator) l separated by c. Each item is prefixed with p and suffixed with s. If the join result is empty for any reason, an alternative a is returned. p, s and a are optional

`tools_ssg.``joint`(c, l, p='', s='', a='')

  join “true” items of the list (or iterator) l separated by c. Each item is prefixed with p and suffixed with s. If the join result is empty for any reason, an alternative a is returned. p, s and a are optional

`tools_ssg.``list2count`(l, incr=1)

  count values in a (short) list l incrementing the counter by optional incr.

  Returns: | a dictionary {item:count}

`tools_ssg.``read_table`(f) → dict(mat, col_names) read a plain text file f in a numpy mat. If some columns are not numerical, they are replaced by np.nan. If header=True, number of column names in the first row after skip must be the same as the number of values in each following row.

`tools_ssg.``reverse`(it)

  reverse order of an iterable

`tools_ssg.``rstrbit`(i, size=0)

  Returns: | the integer as reversed string binary representation. The lowest bit is on the left side

`tools_ssg.``setbit32`(i, nb)

  set a bit number nb (0 based) in an integer i

`tools_ssg.``setcharbit`(s, ch, i)

  set character ch in a string s everywhere a corresponding bit of i is set

`tools_ssg.``ssign`(i, sp='+', sm='-')

  Returns: | a string of i sign: sp (i>=0) or sm (i<0).

`tools_ssg.``strbit`(i, size=0)

  Returns: | the lowest part of integer as string binary representation

`tools_ssg.``strbit2int`(s)

  translate a string of 0’s and 1’s interpreted as bits to an integer all characters different from 0,1 are silently ignored

`tools_ssg.``strbit32`(i)

  Returns: | a string of 0-1s (in chunk of 4) in an 32 bit integer

`tools_ssg.``sumbit`(i)

  Returns: | sum of bits in an integer

`tools_ssg.``trd`(l, d, p='', s='', a='')

  translate items in an iterable l by a dictionary d, prefixing translated items by optional p and suffixing them by optional s. If an item is not found in the dictionnary alternative string a is used. If a==None, the item is left unchanged. No prefix or suffix are applied in both case.

  Returns: | iterator

`tools_ssg.``ulong`(i) → workarounded ulong

`tools_ssg.``valval`(o, keepNone=True)

  Returns: | an iterator over values of values, i.e. collapsing values of fisrt two nested lists in one list, for example.

`tools_ssg.``wxlay2py`(kvt, parent=[None])

  Returns: | a string with python code generating wxWindow widget layout described in kvh tlist sturcture