combined_signature_score¶
- besca.tl.sig.combined_signature_score(adata, GMT_file=None, signature_dict=None, UP_suffix='_UP', DN_suffix='_DN', method='scanpy', overwrite=False, verbose=False, use_raw=None, conversion=None)[source]¶
Super Wrapper function to compute combined signature score for UP and DN scores. This function combines genesets (signatures) scores compose of UP and DN. Results are stored in adata.obs with the key: “score_”+ signature_name+”_” + method . The scanpy method is the score_gene method from the scanpy python package. Combination of the scores is done substracting UP and DN (scanpy = UP - DN).
If you do not have a signature dictionary composed with direction; please see bc.tl.sig.convert_to_directed
- Parameters:
adata (class:~anndata.AnnData) – An AnnData object (from scanpy). Following besca convention, var names (gene) are HGNC symbol and should match the signatures values.
GMT_file (str | default = None) – gmt file location containing the geneset
signature_dict (str | default = None) – pre-loaded signature dictionnary using read_GMT_sign or get_GEMS_sign
UP_suffix (str` | default = "_UP") – str suffix indicating that the suffix indicating the signature in a UP direction (end of the signature). Can be replaced by “None” (quoted) or any kind of unexpected string to avoid combination.
DN_suffix (str` | default = "_DN") – str suffix indicating that the suffix indicating the signature in a DN direction (end of the signature). Can be replaced by “None” (quoted) or any kind of unexpected string to avoid combination.
method (str | default = “scanpy”) – a string indicating which method to use (‘scanpy’ available)
overwrite (boolean | default = False) – If False, will parse the data.obs to only recompute scores that are not present.
verbose (boolean | default = False) – If True, will print the signature reads. This does not overwrite the scanpy verbosity parameter that should be set separately
use_raw (boolean | default = None) – If True, computation will be done on adata.raw.X (on adata.X otherwise).
conversion (`a panda serie’ | default = None.) – If not none, this should contain a serie indexed by x with column containing values y. This indicate the how to transpose the signatures (from x to y). Classical example would be indexed by Ensembl id and column would contains HGNC symbol.
- Return type:
None (the adata obs is modified within the function)
Example
>>> import os >>> import besca as bc >>> bescapath = os.path.split(os.path.dirname(bc.__file__))[0] >>> adata = bc.datasets.simulated_pbmc3k_processed() >>> gmt_file= bescapath + '/besca/datasets/genesets/Immune.gmt' >>> bc.tl.sig.combined_signature_score( adata, GMT_file = gmt_file) >>> # this code is only displayed not executed