pypath.omnipath.export.Export§

class pypath.omnipath.export.Export(network=None, only_sources=None, extra_node_attrs=None, extra_edge_attrs=None, outfile=None, default_vertex_attr_processor=None, default_edge_attr_processor=None, pa=None)[source]§

Bases: Logger

__init__(network=None, only_sources=None, extra_node_attrs=None, extra_edge_attrs=None, outfile=None, default_vertex_attr_processor=None, default_edge_attr_processor=None, pa=None)[source]§

Make this instance a logger.

Parameters:
  • name – The label of this instance that will be prepended to all messages it sends to the logger.

  • module – Send the messages by the logger of this module.

Methods

__init__([network, only_sources, ...])

Make this instance a logger.

add_extra_fields(e, line[, dr])

Takes one table row and using the igraph.Edge object and the direction provided adds the extra node and edge attribute fields as they are defined in extra_node_attrs and extra_edge_attrs.

default_edge_attr_processor(eattr)

default_vertex_attr_processor(vattr)

generic_attr_processor(proc, obj[, dr])

Wraps the attribute processor to handle unknown number of arguments.

get_header([unique_pairs])

Creates a data frame header (list of field names) according to the data frame type and the extra fields.

make_df([unique_pairs, extra_node_attrs, ...])

Creates a data frame from the network.

match_consensus(consensus, nodes[, effect])

process_interaction(ia)

reload()

sources_table(pa[, only_sources, ...])

Creates a data frame which contains a column for each source database with binary values showing presence-absence of interactions across resources.

webservice_interactions_df()

webservice_interactions_df_legacy()

write([outfile])

write_tab([outfile])

Writes the data frame into a tab separated file.

Attributes

default_dtypes_bydirs

default_dtypes_uniquepairs

default_header_bydirs

default_header_uniquepairs

add_extra_fields(e, line, dr=None)[source]§

Takes one table row and using the igraph.Edge object and the direction provided adds the extra node and edge attribute fields as they are defined in extra_node_attrs and extra_edge_attrs.

Returns the row with extra fields added.

:param : One edge. :type : param igraph.Edge e: :param : A table row. :type : param list line: :param : Direction key. A tuple of names (most often UniProt IDs) or

undirected.

:type : param tuple,str dr:

static generic_attr_processor(proc, obj, dr=None)[source]§

Wraps the attribute processor to handle unknown number of arguments.

Not knowing if the attribute processor expects one or two arguments, have no better way than try: if calling with 2 arguments fails with TypeError we call with one argument.

get_header(unique_pairs=True)[source]§

Creates a data frame header (list of field names) according to the data frame type and the extra fields.

make_df(unique_pairs=True, extra_node_attrs=None, extra_edge_attrs=None)[source]§

Creates a data frame from the network.

By default UniProt IDs, Gene Symbols, source databases, literature references, directionality and sign information and interaction type are included.

:paramIf True each line corresponds to a unique pair of molecules,

all directionality and sign information are covered in other columns. If False, order of A and B IDs corresponds to the direction while sign covered in further columns.

:type : param bool unique_pairs: :param : Additional node attributes to be included in the exported table.

Keys are column names used in the header while values are names of vertex attributes. Values also might be methods which then will be called then on each vertex. These should return strings or their result will be converted to string. In the header _A and _B suffixes will be appended to the column names so the values can be assigned to A and B side interaction partners.

:type : param dict extra_node_attrs: :param : Additional edge attributes to be included in the exported table.

Keys are column names used in the header while values are names of edge attributes or callables accepting an edge as single argument.

:type : param dict extra_edge_attrs: :param : Name of the output file. If None a file name

“netrowk-<session id>.tab” is used.

:type : param str outfile:

classmethod sources_table(pa, only_sources=None, unique_pairs=True, extra_edge_attrs=None, extra_node_attrs=None, outfile=None, default_vertex_attr_processor=None, default_edge_attr_processor=None)[source]§

Creates a data frame which contains a column for each source database with binary values showing presence-absence of interactions across resources.

write_tab(outfile=None, **kwargs)[source]§

Writes the data frame into a tab separated file.

:param : Forwarded to make_df(). :type : param **kwargs: