convert_siggenes

besca.tl.sig.convert_siggenes(signature_dict, conversion)[source]

Convert signature genes with a ortholog conversion Series

Parameters:
  • signature_dict (dict) – a dictionary of signatures. Keys signature names, and values can come in two variants: * Variant 1: values are a list of gene names as strings. An example: {‘gs1’: [‘A’, ‘B’], ‘gs2’:[‘B’, ‘C’]}; * Variant 2: Values are a dict with keys, for instance directions (UP/DN), and genes names in values. An example: {‘gs1’: {‘UP’: ‘A’, ‘DN’: ‘B’}, ‘gs2’: {‘UP’: [‘C’, ‘D’], ‘DN’: [‘E’, ‘A’]}}.

  • conversion (class:~pandas.Series) – An Series object, with gene symbols in other species in index and human gene symbol as values

Returns:

a dictionary of signatures in the same format as the input, with ortholog genes

Return type:

signature_dict dict

Example

>>> import pandas as pd
>>> sigs = {'GeneSet1': {'UP':['JUNB', 'ALAD'],
...                      'DN':['ZNF559', 'NoSuchAGene']},
...         'GeneSet2': {'UP': ['ITGA1', 'CTCF'],
...                      'DN': ['CAPN10', 'UnknownGene']}}
>>> conversion = pd.Series(['JUNB', 'ALAD', 'ZNF559', 'NoSuchAGene',
...                         'ITGA1', 'CTCF', 'UnknownGene'],
...                         index=['Junb', 'Alad', 'Znf559', 'Nosuchasagene',
...                         'Itga1', 'Ctcf','Unknowngene'])
>>> conv_sigs = convert_siggenes(sigs, conversion)
>>> conv_sigs
{'GeneSet1': {'UP': ['Junb', 'Alad'], 'DN': ['Znf559', 'Nosuchasagene']}, 'GeneSet2': {'UP': ['Itga1', 'Ctcf'], 'DN': ['Unknowngene']}}