epistasis.mapping module

class epistasis.mapping.EpistasisMap(sites, order=1, values=None, model_type='global')

Bases: object

DataFrame for epistatic interactions.

get_orders(*orders)

Get epistasis of a given order.

index

Get the interaction index in interaction matrix.

map(attr1, attr2)

Dictionary that maps attr1 to attr2.

model_type

Type of epistasis model used to get coefficients.

n

Return the number of Interactions.

order

Get order of epistasis in system.

classmethod read_dataframe(df, model_type='global')

Create an epistasis model from dataframe

sites

Get the interaction sites, which describe the position of interacting mutations in the genotypes. (type==list of lists, see self._build_interaction_sites)

to_csv(filename)

Write data to a csv file.

to_dict()

Get data as dictionary.

to_excel(filename)

Write data to excel file.

values

Get the values of the interaction in the system

class epistasis.mapping.Orders(epistasismap, orders)

Bases: map

An object that provides API for easily calling epistasis of a given order in an epistasis map.

__call__()

return a dictionary

df

Dataframe for orders object.

index

Get indices of epistasis from this order.

sites

Get epistatic sites

values

Get values of epistasis for this order.

epistasis.mapping.assert_epistasis(method)

Assert that an epistasis map has been attached to the object.

epistasis.mapping.genotype_coeffs(genotype, order=None)

List the possible epistatic coefficients (as label form) for a binary genotype up to a given order.

epistasis.mapping.key_to_site(key)

Convert an interaction key to label.

epistasis.mapping.mutations_to_sites(order, mutations, start_order=0)

Build interaction sites up to nth order given a mutation alphabet.

Parameters:
  • order (int) – order of interactions
  • mutations (dict) – mutations = { site_number : [“mutation-1”, “mutation-2”] }. If the site alphabet is note included, the model will assume binary between wildtype and derived.

Example

mutations = {
    0: ["A", "V"],
    1: ["A", "V"],
    ...
}
Returns:sites – list of all interaction sites for system with sequences of a given length and epistasis with given order.
Return type:list
epistasis.mapping.site_to_key(site, state='')

Convert site to key. state is added to end of key.