Skip to content
Open
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
44 changes: 36 additions & 8 deletions .github/workflows/cgatapps_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,58 @@ jobs:
- uses: actions/checkout@v3

- name: Cache conda
uses: actions/cache@v3 # Updated to the latest cache action version
uses: actions/cache@v3
env:
# Increase this value to reset cache if conda/environments/cgat-core.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('conda/environments/cgat-apps.yml') }}

- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
- name: Set installer URL and environment file
id: set-installer-and-env
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
echo "installer-url=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" >> $GITHUB_ENV
echo "env-file=conda/environments/cgat-apps.yml" >> $GITHUB_ENV
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
echo "installer-url=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh" >> $GITHUB_ENV
echo "env-file=conda/environments/cgat-apps-macos.yml" >> $GITHUB_ENV
fi

- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*" # Optional: if you prefer using mamba
installer-url: ${{ env.installer-url }}
python-version: ${{ matrix.python-version }}
miniforge-version: "latest" # Added to ensure Miniforge is installed
channels: conda-forge, bioconda, defaults
channel-priority: true
activate-environment: cgat-a
environment-file: conda/environments/cgat-apps.yml
environment-file: ${{ env.env-file }}

- name: Configure Conda Paths
run: echo "/usr/share/miniconda3/condabin" >> $GITHUB_PATH

- name: Show conda
run: |
conda info
conda list


- name: Debug Python Environment
run: |
python --version
pip list
openssl version

- name: Apply macOS-specific patches
if: matrix.os == 'macos-latest'
run: |
# Check if the patch needs to be applied
if grep -q "Skip BigWig tests on macOS" tests/test_scripts.py; then
echo "Patch already applied, skipping"
else
# Apply patch to skip BigWig tests on macOS
patch -p1 < tests/skip_bigwig_tests_macos.patch
fi

- name: Test
run: |
pip install -e .
Expand Down
2 changes: 1 addition & 1 deletion cgat/GTF.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def transcript_iterator(gff_iterator, strict=True):

return a list of entries with the same transcript id.

Any features without a transcript_id will be ignored.
Any features without a transcript_id or gene_id will be ignored.

The entries for the same transcript have to be consecutive
in the file. If *strict* is set an AssertionError will be
Expand Down
40 changes: 40 additions & 0 deletions conda/environments/cgat-apps-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Modified environment file for macOS arm64 architecture
# Based on cgat-apps.yml but without the unavailable packages

name: cgat-a

channels:
- conda-forge
- bioconda
- defaults

dependencies:
# python dependencies
- python
- alignlib-lite
- biopython
- cython
- cgatcore
- matplotlib
- pytest
- numpy
- pandas
- pep8
- pybedtools
- pybigwig
- pysam
- pyyaml
- quicksect
- rdflib
- scikit-learn
- scipy
- setuptools
- sortedcontainers
- bedtools
- grep
- htslib
- samtools
- tar
# Removed ucsc-bedgraphtobigwig and ucsc-wigtobigwig as they're not available for arm64
- wget
- zlib
25 changes: 25 additions & 0 deletions tests/skip_bigwig_tests_macos.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/tests/test_scripts.py b/tests/test_scripts.py
index xxxxxxx..xxxxxxx 100644
--- a/tests/test_scripts.py
+++ b/tests/test_scripts.py
@@ -322,9 +322,20 @@ TEST_CASES = collect_test_cases()


@pytest.mark.parametrize("test_case", TEST_CASES, ids=[tc["description"] for tc in TEST_CASES])
-def test_scripts(test_case):
+def test_scripts(test_case, request):
'''Run parametrized script tests.'''
+
+ # Skip BigWig tests on macOS as the required tools are not available
+ import platform
+ import pytest
+
+ description = test_case["description"]
+ if platform.system() == "Darwin" and ("bigwig" in description.lower() or
+ "bedgraphtobigwig" in description.lower() or
+ "wigtobigwig" in description.lower()):
+ pytest.skip(f"Skipping {description} on macOS as UCSC tools are not available")
+
func = test_case["func"] # Directly retrieve the function object
args = test_case["args"]
func(*args)
13 changes: 12 additions & 1 deletion tests/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,19 @@ def collect_test_cases():


@pytest.mark.parametrize("test_case", TEST_CASES, ids=[tc["description"] for tc in TEST_CASES])
def test_scripts(test_case):
def test_scripts(test_case, request):
'''Run parametrized script tests.'''

# Skip BigWig tests on macOS as the required tools are not available
import platform
import pytest

description = test_case["description"]
if platform.system() == "Darwin" and ("bigwig" in description.lower() or
"bedgraphtobigwig" in description.lower() or
"wigtobigwig" in description.lower()):
pytest.skip(f"Skipping {description} on macOS as UCSC tools are not available")

func = test_case["func"] # Directly retrieve the function object
args = test_case["args"]
func(*args)
Loading