From e20d02ca1558cef5f63916cdebb73d0df3ed1e47 Mon Sep 17 00:00:00 2001 From: Ladislav Hovan <19410951+ladislav-hovan@users.noreply.github.com> Date: Wed, 10 Dec 2025 11:38:53 +0100 Subject: [PATCH 1/2] Make compatible with current JASPAR TFBS format --- pyproject.toml | 21 ++++++++++--------- .../data_retriever/region_retriever.py | 4 ++-- .../modules/ppi_retriever/ppi_retriever.py | 4 ++-- src/sponge/modules/utils/tfbs_filtering.py | 5 +++++ 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 28acd00..9a669dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,14 +17,14 @@ classifiers = [ "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Bio-Informatics", ] -dependencies = [ - "bioframe", - "numpy", - "pandas", - "pybbi", - "pyjaspar", - "scikit-learn", - "tqdm", +dependencies = [ + "bioframe>=0.8.0,<0.9", + "numpy>=2.2.6,<3", + "pandas>=2.3.3,<3", + "pybbi>=0.4.2,<0.5", + "pyjaspar>=4.0.0,<5", + "scikit-learn>=1.7.2,<2", + "tqdm>=4.67.1,<5", ] [project.scripts] @@ -49,15 +49,16 @@ channels = ["conda-forge"] platforms = ["linux-64"] [tool.pixi.tasks] +sponge = "netzoopy-sponge" [tool.pixi.dependencies] -python = "3.10.*" +python = ">=3.10.0" [tool.pixi.pypi-dependencies] netzoopy-sponge = { path = ".", editable = true } [tool.pixi.feature.sponge-dev.dependencies] -pytest = "*" +pytest = ">=8.4.0" [tool.pixi.feature.sponge-dev.tasks] test = "pytest -m 'not slow'" diff --git a/src/sponge/modules/data_retriever/region_retriever.py b/src/sponge/modules/data_retriever/region_retriever.py index aa2402c..4b5b851 100644 --- a/src/sponge/modules/data_retriever/region_retriever.py +++ b/src/sponge/modules/data_retriever/region_retriever.py @@ -121,7 +121,7 @@ def _retrieve_region( # Convert the response into a DataFrame df = pd.read_csv(buffer, sep='\t', dtype=dtype_dict) - print ('Filtering and modifying dataframe...') + print ('\nFiltering and modifying dataframe...\n') if self.settings['filter_basic']: # Filter only for GENCODE basic df = df[df['GENCODE basic annotation'] == 'GENCODE basic'].copy() @@ -162,7 +162,7 @@ def _retrieve_region( # Columns to be saved into a file columns = ['Chromosome', 'Start', 'End', 'Transcript stable ID', 'Gene stable ID', 'Gene name', 'Gene type'] - print (f'Saving data to: {self.temp_filename}') + print (f'\nSaving data to: {self.temp_filename}') # Save the file self.df = df[columns] self.df.to_csv(self.temp_filename, sep='\t', index=False) diff --git a/src/sponge/modules/ppi_retriever/ppi_retriever.py b/src/sponge/modules/ppi_retriever/ppi_retriever.py index 2e04359..607ffe7 100644 --- a/src/sponge/modules/ppi_retriever/ppi_retriever.py +++ b/src/sponge/modules/ppi_retriever/ppi_retriever.py @@ -141,8 +141,8 @@ def retrieve_ppi( 'preferredName_B': 'tf2'}, inplace=True) if len(ids_to_check) > 0: # Replace with names that have been queried (as used by JASPAR) - ppi_df['tf1'].replace(p_to_q, inplace=True) - ppi_df['tf2'].replace(p_to_q, inplace=True) + ppi_df['tf1'] = ppi_df['tf1'].replace(p_to_q) + ppi_df['tf2'] = ppi_df['tf2'].replace(p_to_q) ppi_df.sort_values(by=['tf1', 'tf2'], inplace=True) print ('\nFinal number of TFs in the PPI network: ' diff --git a/src/sponge/modules/utils/tfbs_filtering.py b/src/sponge/modules/utils/tfbs_filtering.py index 50115d5..9d2c0af 100644 --- a/src/sponge/modules/utils/tfbs_filtering.py +++ b/src/sponge/modules/utils/tfbs_filtering.py @@ -78,6 +78,11 @@ def filter_edges( start,end = bed_df.loc[transcript][['Start', 'End']] # Load all matches in that region from the bigbed file motifs = bioframe.read_bigbed(bb_ref, chrom, start=start, end=end) + # This is a temporary guard until the name of TFName column + # is fixed for the 2026 release + colnames = ['chrom', 'start', 'end', 'name', 'score', 'strand', + 'TFName'] + motifs.columns = colnames # Ensure the entire motif fits within range (not default behaviour) motifs = motifs[(motifs['start'] >= start) & (motifs['end'] <= end)] # Filter only the transcription factors in the list From 372a03667c36c1e7ce903f0d47d5dce1e94754e8 Mon Sep 17 00:00:00 2001 From: Ladislav Hovan <19410951+ladislav-hovan@users.noreply.github.com> Date: Wed, 10 Dec 2025 11:42:47 +0100 Subject: [PATCH 2/2] Update Python versions for tests --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 41bd151..c3ce1e5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: strategy: matrix: os: [ 'ubuntu-latest', 'macos-latest' ] - python: [ '3.9', '3.10', '3.11', '3.12' ] + python: [ '3.10', '3.11', '3.12', '3.13' ] runs-on: ${{ matrix.os }}