Skip to content

Commit cc72156

Browse files
committed
remove explicit alphastats dependency
1 parent 59fdec4 commit cc72156

3 files changed

Lines changed: 49 additions & 6 deletions

File tree

grassp/io/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
from .read import read, read_prolocdata
1+
from .read import (
2+
read_alphastats,
3+
read_prolocdata,
4+
read_maxquant,
5+
read_fragpipe,
6+
read_diann,
7+
)

grassp/io/read.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
import numpy as np
1212
import pandas as pd
1313
import urllib
14+
import protdata
1415

1516

16-
def read(
17+
def read_alphastats(
1718
loader: alphastats.BaseLoader,
1819
x_dtype: Union[np.dtype, type, int, float, None] = None,
1920
proteins_as_obs: bool = False,
@@ -41,7 +42,12 @@ def read(
4142
- gene_names: Gene name mapping information
4243
"""
4344

44-
import alphastats
45+
try:
46+
import alphastats
47+
except ImportError:
48+
raise Exception(
49+
"To read alphastats, please install the `alphastats` python package (pip install alphastats)."
50+
)
4551

4652
alphastats.DataSet._check_loader(
4753
1, loader
@@ -143,3 +149,27 @@ def read_prolocdata(file_name: str) -> anndata.AnnData:
143149
adata.uns["MIAPE_metadata"] = metadata
144150

145151
return adata
152+
153+
154+
def read_maxquant(*args, **kwargs) -> anndata.AnnData:
155+
"""
156+
Wrapper for protdata.read_maxquant that transposes the AnnData object.
157+
"""
158+
adata = protdata.read_maxquant(*args, **kwargs)
159+
return adata.T
160+
161+
162+
def read_fragpipe(*args, **kwargs) -> anndata.AnnData:
163+
"""
164+
Wrapper for protdata.read_fragpipe that transposes the AnnData object.
165+
"""
166+
adata = protdata.read_fragpipe(*args, **kwargs)
167+
return adata.T
168+
169+
170+
def read_diann(*args, **kwargs) -> anndata.AnnData:
171+
"""
172+
Wrapper for protdata.read_diann that transposes the AnnData object.
173+
"""
174+
adata = protdata.read_diann(*args, **kwargs)
175+
return adata.T

pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ requires = [
44
"wheel",
55
"setuptools_scm[toml]>=3.4"
66
]
7+
build-backend = "setuptools.build_meta"
8+
9+
[tool.setuptools_scm]
10+
version_scheme = "post-release"
11+
local_scheme = "no-local-version"
12+
write_to = "grassp/_version.py"
13+
fallback_version = "0.0.1"
714

815
[project]
916
name = "grassp"
@@ -29,7 +36,8 @@ dependencies = [
2936
"numpy",
3037
"pandas",
3138
"scanpy[leiden]",
32-
"alphastats",
39+
"protdata",
40+
# "alphastats",
3341
"anndata",
3442
"scipy",
3543
"networkx",
@@ -78,8 +86,7 @@ repository = "https://github.com/czbiohub/some-package"
7886

7987

8088
[tool.setuptools]
81-
# explicitly specify the package name
82-
# TODO: is there a better way to do this?
89+
# Use find_namespace_packages to discover all packages
8390
packages = ["grassp"]
8491

8592
# allow use of __file__ to load data files included in the package

0 commit comments

Comments
 (0)