liana.resource.translate_column

liana.resource.translate_column#

liana.resource.translate_column(resource, map_df, column, replace=True, one_to_many=1)#

Generate orthologs for a given column in a DataFrame.

Parameters:
  • resource (DataFrame) – Input DataFrame.

  • map_df (DataFrame) – DataFrame with orthology mappings, where the first column is the source and the second column is the target for mapping.

  • column (str) – Column name to translate.

  • replace (bool (default: True)) – Whether to replace the original column with the translated values. Default is True. If False, it will create a new column with the prefix “orthology_”.

  • one_to_many (int (default: 1)) – Maximum number of orthologs allowed per gene. Default is 1.

  • Details

  • -------

  • DataFrame. (This function generates orthologs for a given column in a)

  • orthologs. (It handles complex names by splitting them into subunits and generating all possible combinations of)

  • ("_"). (It assumes that subunits are separated by an underscore)

Return type:

DataFrame

Returns:

Resulting DataFrame with translated column.

Raises:

ValueError – If the mapping_df does not contain ‘source’ and ‘target’ columns or one_to_many is not an integer