convert_to_directed¶
- besca.tl.sig.convert_to_directed(signature_dict, direction='UP')[source]¶
Convert a simple dictionary into one with direction compatible with combined_signature_score
- Parameters:
signature_dict (str | default = None) – gmt file location containing the geneset
direction (str | default = “UP”) – str suffix indicating that the suffix indicating the signature direction. Expected UP or DN
- Return type:
a dictionnary containing the signature names as key. Value are a subdictionnary where key are direction(UP or DN).
Example
>>> import os >>> import besca as bc >>> bescapath = os.path.split(os.path.dirname(bc.__file__))[0] >>> gmt_file= bescapath + '/besca/datasets/genesets/Immune.gmt' >>> mymarkers = bc.tl.sig.read_GMT_sign(gmt_file,directed=False) >>> bc.tl.sig.convert_to_directed( mymarkers, 'UP') {'lymphocyte': {'UP': ['PTPRC']}, 'myeloid': {'UP': ['S100A8', 'S100A9', 'CST3']}, 'Bcell': {'UP': ['CD19', 'CD79A', 'MS4A1']}, 'Tcells': {'UP': ['CD3E', 'CD3G', 'CD3D']}, 'CD4': {'UP': ['CD4']}, 'CD8': {'UP': ['CD8A', 'CD8B']}, 'NKcell': {'UP': ['NKG7', 'GNLY', 'NCAM1']}, 'monocyte': {'UP': ['CST3', 'CSF1R', 'ITGAM', 'CD14', 'FCGR3A', 'FCGR3B']}, 'macrophage': {'UP': ['CD14', 'IL1B', 'LYZ', 'CD163', 'ITGAX', 'CD68', 'CSF1R', 'FCGR3A']}}