soprano.analyse.phylogen.genes#

Definitions for the various genes used by PhylogenCluster

Functions

load_genefile(gfile)

Load a gene file and return the (validated) list of genes contained within.

parsegene_bond_order(c[, s1, s2, channels, ...])

parsegene_coord_histogram(c[, s1, s2, max_coord])

parsegene_defect_asymmetric_fdist(c[, ...])

parsegene_defect_asymmetric_fpos(c[, index, ...])

parsegene_energy(c)

parsegene_hbonds_angle(c)

parsegene_hbonds_fprint(c)

parsegene_hbonds_length(c)

parsegene_hbonds_site_compare(c)

parsegene_hbonds_site_reference(c[, ref])

parsegene_hbonds_totn(c)

parsegene_latt_abc(c)

parsegene_latt_ang(c)

parsegene_latt_cart(c)

parsegene_linkage_list(c[, size])

parsegene_mol_com(c[, Z])

parsegene_mol_m(c[, Z])

parsegene_mol_num(c)

parsegene_mol_rot(c[, Z, twist_axis, ...])

Classes

Gene(name[, weight, params, parser, pair])

A description of a property, a 'gene', characterizing a structure, to be used with a PhylogenCluster.

GeneDictionary()

Container class holding gene definitions

Exceptions

class soprano.analyse.phylogen.genes.Gene(name, weight=1.0, params={}, parser=None, pair=False)[source]#

Bases: object

A description of a property, a ‘gene’, characterizing a structure, to be used with a PhylogenCluster. A number of default genes is provided, but custom ones can be created as well by passing a parser. Only default genes can be used in a .genefile with the phylogen.py script though.

Args:
name (str): name of the gene. Must be one of the existing ones or a
custom one (in which case a parser must be provided as
well). Custom names can’t conflict with existing ones
weight (float): weight of the gene to be applied, default is 1.0
params (dict): additional parameters to be passed to the gene parser
function; when not specified, defaults will be used
parser (function<AtomsCollection, **kwargs>
=> np.array): parser function to be used when defining custom
genes. Must return a two-dimensional Numpy array
(axis 0 for the elements of the collection,
axis 1 for the values of the gene)
is_pair (bool): False if the gene returns a multi dimensional point
for each structure, True if it only returns pair
distances. Default is False
evaluate(c)[source]#

Evaluate the gene on a given AtomsCollection

property is_pair#

Whether the gene can only compare a pair of structures or can also give an absolute value for each structure individually (required for k-means clustering)

class soprano.analyse.phylogen.genes.GeneDictionary[source]#

Bases: object

Container class holding gene definitions

classmethod get_gene(g)[source]#

Get the definition for a given gene

classmethod help(g=None)[source]#

Get an help string for a given gene

exception soprano.analyse.phylogen.genes.GeneError[source]#

Bases: Exception

add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

soprano.analyse.phylogen.genes.load_genefile(gfile)[source]#

Load a gene file and return the (validated) list of genes contained within.

Args:
gfile (file or str): file to parse
Returns:
genelist: a list of genes parsed from the given file, ready to be
passed to a PhylogenCluster