From a61f722001c0e81f30d212990ee30172da3d27ca Mon Sep 17 00:00:00 2001 From: anushka255 Date: Mon, 5 Aug 2024 17:17:17 -0400 Subject: [PATCH 01/10] minor update --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index c5f4291..2ae0c14 100644 --- a/environment.yml +++ b/environment.yml @@ -7,4 +7,4 @@ dependencies: - python=3.8 - pip - pip: - - -r requirements.txt \ No newline at end of file + - -r requirements.txt From d0d9bd194ae9a72dc8fe485147f7eab17b9e8770 Mon Sep 17 00:00:00 2001 From: anushka255 Date: Mon, 5 Aug 2024 17:23:00 -0400 Subject: [PATCH 02/10] using spaces for indentation --- environment.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/environment.yml b/environment.yml index 2ae0c14..938dc27 100644 --- a/environment.yml +++ b/environment.yml @@ -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 From da965aab76ff542aacdce6a7e649477982c68257 Mon Sep 17 00:00:00 2001 From: anushka255 Date: Mon, 5 Aug 2024 17:24:57 -0400 Subject: [PATCH 03/10] added pytest as dependency --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index f366f98..564b213 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ numpy scipy scikit-learn>=0.24.0 IPython>=7.18.1 +pytest From e17bee311c0c7f74cb71eb4e32fbafde35355212 Mon Sep 17 00:00:00 2001 From: anushka255 Date: Mon, 5 Aug 2024 17:27:50 -0400 Subject: [PATCH 04/10] added init file under test directory --- tests/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 From e8d0655793fdc0c7e3be7837949fb5689e716e6d Mon Sep 17 00:00:00 2001 From: anushka255 Date: Tue, 6 Aug 2024 09:37:17 -0400 Subject: [PATCH 05/10] only testing 3 slices --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index cdc9ff5..85ad561 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,8 +12,8 @@ @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") + slice_files = glob.glob(f"{data_folder}/slice[1-3].csv") + coord_files = glob.glob(f"{data_folder}/slice[1-3]_coor.csv") slices = [] for slice, coord in zip(slice_files, coord_files): From d2b68858bdafe10d61ba54fbfbe693f6b6a7177f Mon Sep 17 00:00:00 2001 From: anushka255 Date: Tue, 6 Aug 2024 11:01:14 -0400 Subject: [PATCH 06/10] added windows --- .github/workflows/build.yml | 2 +- tests/conftest.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3db6a1b..d1339e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, ubuntu-latest] + os: [macos-latest, ubuntu-latest, windows-latest] python-version: ["3.8"] name: Build wheel on ${{ matrix.os }} diff --git a/tests/conftest.py b/tests/conftest.py index 85ad561..cdc9ff5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,8 +12,8 @@ @pytest.fixture(scope="session") def slices(): # Returns ann data object relating each slices - slice_files = glob.glob(f"{data_folder}/slice[1-3].csv") - coord_files = glob.glob(f"{data_folder}/slice[1-3]_coor.csv") + 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): From 36d8d76023e9cd287558c90f31954cb1480b1239 Mon Sep 17 00:00:00 2001 From: anushka255 Date: Tue, 6 Aug 2024 11:03:52 -0400 Subject: [PATCH 07/10] updated ubuntu from latest to 20.04 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1339e4..42ae9fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + os: [macos-latest, ubuntu-20.04] python-version: ["3.8"] name: Build wheel on ${{ matrix.os }} From e3103468a1f24197b4196c6a9235bc4d94a15c4c Mon Sep 17 00:00:00 2001 From: anushka255 Date: Tue, 6 Aug 2024 11:12:00 -0400 Subject: [PATCH 08/10] check to see if slices and coordinates are aligned --- tests/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index cdc9ff5..9d1ffa4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ from pathlib import Path +import re import numpy as np import scanpy as sc @@ -17,6 +18,7 @@ def slices(): slices = [] for slice, coord in zip(slice_files, coord_files): + assert re.findall(r'.*?/slice(\d+).csv', slice)[0] == re.findall(r'.*?/slice(\d+)_coor.csv', coord)[0] _slice = sc.read_csv(Path(slice)) _slice.obsm["spatial"] = np.genfromtxt(coord, delimiter=",") _slice.obsm["weights"] = np.ones((_slice.shape[0],)) / _slice.shape[0] From baf6d204e46d2e1bebe820916dfaff1118b312fc Mon Sep 17 00:00:00 2001 From: anushka255 Date: Tue, 6 Aug 2024 11:32:47 -0400 Subject: [PATCH 09/10] ensuring particular slice gets its respective coordinates --- .github/workflows/build.yml | 2 +- tests/conftest.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42ae9fe..3db6a1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, ubuntu-20.04] + os: [macos-latest, ubuntu-latest] python-version: ["3.8"] name: Build wheel on ${{ matrix.os }} diff --git a/tests/conftest.py b/tests/conftest.py index 9d1ffa4..6eec06b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,12 +14,13 @@ 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): - assert re.findall(r'.*?/slice(\d+).csv', slice)[0] == re.findall(r'.*?/slice(\d+)_coor.csv', coord)[0] + for slice in slice_files: + # Get coordinates for the current slice + coord = slice.replace(".csv", "_coor.csv") _slice = sc.read_csv(Path(slice)) + _slice.obsm["spatial"] = np.genfromtxt(coord, delimiter=",") _slice.obsm["weights"] = np.ones((_slice.shape[0],)) / _slice.shape[0] slices.append(_slice) From 1bdd5671f3dffd00d29f81728ce4c17af7b06f9d Mon Sep 17 00:00:00 2001 From: anushka255 Date: Tue, 6 Aug 2024 11:46:05 -0400 Subject: [PATCH 10/10] getting rid of glob --- tests/conftest.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 6eec06b..d6cc0ff 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,27 +1,23 @@ from pathlib import Path -import re - 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") - slices = [] - for slice in slice_files: - # Get coordinates for the current slice - coord = slice.replace(".csv", "_coor.csv") - _slice = sc.read_csv(Path(slice)) + 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") - _slice.obsm["spatial"] = np.genfromtxt(coord, delimiter=",") + # 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)