liana.resource.filter_reassemble_complexes

liana.resource.filter_reassemble_complexes#

liana.resource.filter_reassemble_complexes(lr_res, _key_cols, complex_cols, expr_prop, return_all_lrs=False, complex_policy='min')#

Reassemble complexes from exploded long-format pandas Dataframe.

Parameters:
  • lr_res (DataFrame) – long-format pandas dataframe with exploded complex subunits

  • _key_cols (list[str]) – primary key for lr_res, typically a list with the following elements - [‘source’, ‘target’, ‘ligand_complex’, ‘receptor_complex’]

  • complex_cols (list[str]) – method/complex-relevant columns

  • expr_prop (float) – Minimum expression proportion for the ligands and receptors (+ their subunits) in the corresponding cell identities. Set to 0 to return unfiltered results.

  • return_all_lrs (bool (default: False)) – Bool whether to return all ligand-receptor pairs, or only those that surpass the expr_prop threshold. Ligand-receptor pairs that do not pass the expr_prop threshold will be assigned to the worst score of the ones that do. False by default.

  • complex_policy (str (default: 'min')) – approach by which the complexes are reassembled

Return type:

DataFrame

Returns:

lr_res: a reduced long-format pandas dataframe