Skip to content

Commit

Permalink
v0.6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
earmingol committed Mar 22, 2023
1 parent e6568f7 commit 495fdc4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cell2cell/external/gseapy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from collections import defaultdict
from tqdm import tqdm

Expand Down Expand Up @@ -54,7 +56,7 @@ def load_gmt(filename, backup_url=None, readable_name=False):


def generate_lr_geneset(lr_list, complex_sep=None, lr_sep='^', pathway_per_gene=None, organism='human', pathwaydb='GOBP',
min_pathways=15, max_pathways=10000, readable_name=False):
min_pathways=15, max_pathways=10000, readable_name=False, output_folder=None):
'''Generate a gene set from a list of LR pairs.
Parameters
Expand Down Expand Up @@ -90,6 +92,10 @@ def generate_lr_geneset(lr_list, complex_sep=None, lr_sep='^', pathway_per_gene=
readable_name : boolean, default=False
If True, the pathway names are transformed to a more readable format.
output_folder : str, default=None
Path to store the GMT file. If None, it stores the gmt file in the
current directory.
Returns
-------
lr_set : dict
Expand All @@ -99,8 +105,11 @@ def generate_lr_geneset(lr_list, complex_sep=None, lr_sep='^', pathway_per_gene=
_check_pathwaydb(organism, pathwaydb)

# Obtain annotations
gmt_info = PATHWAY_DATA[organism][pathwaydb]
if output_folder is not None:
gmt_info['filename'] = os.path.join(output_folder, gmt_info['filename'])
if pathway_per_gene is None:
pathway_per_gene = load_gmt(readable_name=readable_name, **PATHWAY_DATA[organism][pathwaydb])
pathway_per_gene = load_gmt(readable_name=readable_name, **gmt_info)

# Dictionary to save the LR interaction (key) and the annotated pathways (values).
pathway_sets = defaultdict(set)
Expand Down
1 change: 1 addition & 0 deletions release/0.6.7-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## New features
- Direct access to `interaction_elements` attribute from `cell2cell.analysis.cell2cell_pipelines.SingleCellInteractions`
and `cell2cell.analysis.cell2cell_pipelines.BulkInteractions`
- Added option to store GMT file in output_folder in `cell2cell.external.gseapy`

## Feature updates
- Removed tqdm for jupyter notebooks.
Expand Down

0 comments on commit 495fdc4

Please sign in to comment.