Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made the package pip installable and updated ci #6

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
environment-file: environment.yml

- name: Install package
run: pip install .
run: pip install -e .

- name: Pytest
run: pytest
46 changes: 42 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
requires = ["setuptools>=61.0", "setuptools_scm>=6.2"]
build-backend = "setuptools.build_meta"

[project]
name = "paste"
authors = [
{name="Max Land", email="max.ruikang.land@gmail.com"}
]
build-backend = "setuptools.build_meta"
description = "A computational method to align and integrate spatial transcriptomics experiments."
readme = "README.md"
requires-python = ">=3.6"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
]

dependencies = [
"anndata>=0.7.6",
"scanpy>=1.7.2",
"POT==0.9.0",
"numpy",
"scipy",
"scikit-learn>=0.24.0",
"IPython>=7.18.1",
]
dynamic = ["version"]

[project.scripts]
paste = "paste.__main__:main"

[tool.setuptools]
package-dir = {"" = "src"}

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-sv"

[project.optional-dependencies]
dev = [
"build",
"pytest",
]
25 changes: 0 additions & 25 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

6 changes: 3 additions & 3 deletions paste-cmd-line.py → src/paste/paste-cmd-line.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def main(args):
pis_init = [pd.read_csv(args.start[i],index_col=0).to_numpy() for i in range(len(args.start))]

# create output folder
output_path = os.path.join(args.direc, "paste_output")
output_path = os.path.join(args.direc, "../../paste_output")
if not os.path.exists(output_path):
os.mkdir(output_path)

Expand All @@ -82,8 +82,8 @@ def main(args):
center_slice, pis = center_align(initial_slice, slices, lmbda, args.alpha, args.n_components, args.threshold, dissimilarity=args.cost, distributions=[slices[i].obsm['weights'] for i in range(n_slices)], pis_init=pis_init)
W = pd.DataFrame(center_slice.uns['paste_W'], index = center_slice.obs.index)
H = pd.DataFrame(center_slice.uns['paste_H'], columns = center_slice.var.index)
W.to_csv(os.path.join(args.direc,"paste_output/W_center"))
H.to_csv(os.path.join(args.direc,"paste_output/H_center"))
W.to_csv(os.path.join(args.direc, "../../paste_output/W_center"))
H.to_csv(os.path.join(args.direc, "../../paste_output/H_center"))
for i in range(len(pis)):
output_filename = "paste_output/slice_center_slice" + str(i+1) + "_pairwise.csv"
pi = pd.DataFrame(pis[i], index = center_slice.obs.index, columns = slices[i].obs.index)
Expand Down
4 changes: 3 additions & 1 deletion tests/test_paste.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import pandas as pd
import tempfile

from paste import pairwise_align, center_align, center_ot, intersect, center_NMF
from paste import pairwise_align, center_align
from paste.PASTE import center_ot, intersect, center_NMF


test_dir = Path(__file__).parent
input_dir = test_dir / "data/input"
Expand Down