decoupler.translate_net

decoupler.translate_net(net: DataFrame, columns: str | Iterable[str] = ('source', 'target', 'genesymbol'), source_organism: str | int = 'human', target_organism: str | int = 'mouse', id_type: str | tuple[str, str] = 'genesymbol', unique_by: Iterable[str] | None = ('source', 'target'), **kwargs: dict[str, str]) DataFrame

Translate networks between species by orthology.

This function downloads orthology databases from omnipath and converts genes between species. The first time you run this function will take a while (~15 minutes) but then it stores all the information in cache for quick reusability.

In case you need to reset the cache, you can do it by doing: rm -r ~/.pypath/cache/.

With its default parameters, this function translates almost any network or annotation data frame acquired by the functions in this module from human to mouse. For the PROGENy resource you should pass columns = "target", as here the source column contains pathways, not identifers.

Parameters:
netDataFrame

Network in long format.

columnsstr | list[str] | dict[str, str] | None

One or more columns to be translated. These columns must contain identifiers of the source organism. It can be a single column name, a list of column names, or a dict with column names as keys and the type of identifiers in these columns as values.

source_organism: int | str

Name or NCBI Taxonomy ID of the organism to translate from.

target_organismint | str

Name or NCBI Taxonomy ID of the organism to translate to.

id_type: str | tuple[str, str]

Shortcut to provide a single identifier type if all columns should be translated from and to the same ID type. If a tuple of two provided, the translation happens from the first ID type and the orthologs returned in the second ID type.

kwargs: str | tuple[str, str]

Alternative way to pass columns. The only limitation is that column names can not match any of the existing arguments of this function.

Returns:
hom_netDataFrame

Network in long format with translated genes.