Skip to content

Commit

Permalink
minor update (#1)
Browse files Browse the repository at this point in the history
 added pytest as dependency; added init file under test directory;  getting rid of glob from test
  • Loading branch information
anushka255 authored Aug 6, 2024
1 parent a64ece8 commit a0d0be2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: 'paste'

channels:
- defaults
- defaults

dependencies:
- python=3.8
- pip
- pip:
- -r requirements.txt
- python=3.8
- pip
- pip:
- -r requirements.txt
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ numpy
scipy
scikit-learn>=0.24.0
IPython>=7.18.1
pytest
Empty file added tests/__init__.py
Empty file.
19 changes: 9 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
from pathlib import Path

import numpy as np
import scanpy as sc
import glob
import pytest

base_dir = Path(__file__).parent.parent
data_folder = base_dir / "sample_data"
data_dir = base_dir / "sample_data"


@pytest.fixture(scope="session")
def slices():
# Returns ann data object relating each slices
slice_files = glob.glob(f"{data_folder}/slice[0-9].csv")
coord_files = glob.glob(f"{data_folder}/slice[0-9]_coor.csv")

slices = []
for slice, coord in zip(slice_files, coord_files):
_slice = sc.read_csv(Path(slice))
_slice.obsm["spatial"] = np.genfromtxt(coord, delimiter=",")
for i in range(1, 5):
# File path of slices and respective coordinates
s_fpath = Path(f"{data_dir}/slice{i}.csv")
c_fpath = Path(f"{data_dir}/slice{i}_coor.csv")

# Create ann data object of each slice and add other properties
_slice = sc.read_csv(s_fpath)
_slice.obsm["spatial"] = np.genfromtxt(c_fpath, delimiter=",")
_slice.obsm["weights"] = np.ones((_slice.shape[0],)) / _slice.shape[0]
slices.append(_slice)

Expand Down

0 comments on commit a0d0be2

Please sign in to comment.