Skip to content

Commit

Permalink
1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
zqfang committed Aug 27, 2023
1 parent c8df54e commit bc99967
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 127 deletions.
284 changes: 171 additions & 113 deletions docs/gseapy_example.ipynb

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions gseapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,9 @@
from .biomart import Biomart
from .enrichr import Enrichr
from .gsea import GSEA, Prerank, Replot, SingleSampleGSEA
from .msigdb import Msigdb
from .parser import get_library, get_library_name, read_gmt
from .plot import (
barplot,
dotplot,
enrichment_map,
gseaplot,
gseaplot2,
heatmap,
ringplot,
)
from .plot import barplot, dotplot, enrichment_map, gseaplot, gseaplot2, heatmap


def gsea(
Expand Down Expand Up @@ -640,7 +633,6 @@ def enrich(
"dotplot",
"barplot",
"enrichment_map",
"ringplot",
"heatmap",
"gseaplot",
"gseaplot2",
Expand All @@ -656,6 +648,7 @@ def enrich(
"SingleSampleGSEA",
"Enrichr",
"Biomart",
"Msigdb",
"get_library",
"get_library_name",
"read_gmt",
Expand Down
12 changes: 8 additions & 4 deletions gseapy/msigdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ def __init__(self, dbver: str = "2023.1.Hs"):
dbver: MSIGDB version number. default: 2023.1.Hs
"""
self.url = "https://data.broadinstitute.org/gsea-msigdb/msigdb/release/"
self._pattern = re.compile("(\w.+)\.(v\d.+)\.(entrez|symbols)\.gmt")
self._db_version = self._get_db_version()
self.categoires = self.list_category(dbver)
self._pattern = re.compile("(\w.+)\.(v\d.+)\.(entrez|symbols)\.gmt")

def _get_db_version(self):
resp = requests.get(self.url)
Expand All @@ -28,7 +28,10 @@ def get_gmt(
self, category: str = "h.all", dbver: str = "2023.1.Hs", entrez: bool = False
):
"""
example: "https://data.broadinstitute.org/gsea-msigdb/msigdb/release/2023.1.Hs/c2.cp.kegg.v2023.1.Hs.entrez.gmt"
:params category: choose one from .list_category()
:params dbver: choose one from .list_dbver()
An example of query url: "https://data.broadinstitute.org/gsea-msigdb/msigdb/release/2023.1.Hs/c2.cp.kegg.v2023.1.Hs.entrez.gmt"
"""
identifier = "symbols"
if entrez:
Expand All @@ -47,9 +50,10 @@ def list_dbver(self):
# self._db_version.columns = ["dbver", "date"]
return self._db_version

def list_category(self, dbver):
def list_category(self, dbver: str = "2023.1.Hs"):
"""
dbver: MSIGDB version number. default: 2023.1.Hs
see a list of dbver, call .list_dbver()
"""
d = self.list_gmt(dbver)
if d is not None:
Expand All @@ -61,7 +65,7 @@ def list_category(self, dbver):
return categories.to_list()
return None

def list_gmt(self, db):
def list_gmt(self, db: str):
url = self.url + db
resp = requests.get(url)
if resp.ok:
Expand Down

0 comments on commit bc99967

Please sign in to comment.