From 27b467475c4c890ebbdfe39975c501440b9625f0 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 15:44:13 -0500 Subject: [PATCH 01/22] Add CI for wheel upload --- .github/workflows/build_wheels.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/build_wheels.yml diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml new file mode 100644 index 0000000..f2dba92 --- /dev/null +++ b/.github/workflows/build_wheels.yml @@ -0,0 +1,30 @@ +name: Build + +on: [ push, pull_request ] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + # macos-13 is an intel runner, macos-14 is apple silicon + os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ] + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.22.0 + # env: + # CIBW_SOME_OPTION: value + # ... + # with: + # package-dir: . + # output-dir: wheelhouse + # config-file: "{package}/pyproject.toml" + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl From 6fd5580cf0fb99e24dd50cb4d54dc291ff713215 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 15:48:00 -0500 Subject: [PATCH 02/22] Add submodule to checkout --- .github/workflows/build_wheels.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index f2dba92..9cdab23 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -13,6 +13,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + submodules: 'true' - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 From 745b80901501051d78ea116e671c10816845ddb4 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 15:52:30 -0500 Subject: [PATCH 03/22] Use correct recursion --- .github/workflows/build_wheels.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 9cdab23..95cee8d 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: 'true' + submodules: 'recursive' - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 @@ -26,7 +26,7 @@ jobs: # output-dir: wheelhouse # config-file: "{package}/pyproject.toml" - - uses: actions/upload-artifact@v4 - with: - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} - path: ./wheelhouse/*.whl + # - uses: actions/upload-artifact@v4 + # with: + # name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + # path: ./wheelhouse/*.whl From 32ccc1f4ac90635ce3212e04ff30fb633e5cf336 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 15:56:40 -0500 Subject: [PATCH 04/22] Limit runners to ubuntu and build --- .github/workflows/build_wheels.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 95cee8d..4e15b2f 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -8,10 +8,12 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - # macos-13 is an intel runner, macos-14 is apple silicon - os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ] + os: [ ubuntu-latest ] steps: + - name: Install deps + run: sudo apt-get install -y libbz2-dev + - uses: actions/checkout@v4 with: submodules: 'recursive' From 764bf7d2c14caebb563987ec3e3d336e82c96a6e Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 16:01:39 -0500 Subject: [PATCH 05/22] Use CIBW envvar for deps --- .github/workflows/build_wheels.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 4e15b2f..4b188a9 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -11,17 +11,14 @@ jobs: os: [ ubuntu-latest ] steps: - - name: Install deps - run: sudo apt-get install -y libbz2-dev - - uses: actions/checkout@v4 with: submodules: 'recursive' - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 - # env: - # CIBW_SOME_OPTION: value + env: + CIBW_BEFORE_ALL_LINUX: apt-get install -y libbz2-dev # ... # with: # package-dir: . From f914bfc33bb3608401fad17125053f444ef557d5 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 16:06:10 -0500 Subject: [PATCH 06/22] Use centos for linux builds --- .github/workflows/build_wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 4b188a9..1cb0d8f 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -18,7 +18,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: - CIBW_BEFORE_ALL_LINUX: apt-get install -y libbz2-dev + CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-libs # ... # with: # package-dir: . From 5605d31a23d0e171908649b57fd94eddba515cab Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 16:08:59 -0500 Subject: [PATCH 07/22] Use bzip2-devel --- .github/workflows/build_wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 1cb0d8f..dee4bf8 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -18,7 +18,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: - CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-libs + CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel # ... # with: # package-dir: . From 1d88968f411ed0766fbe109e9dd7dc18b1356be2 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 16:35:36 -0500 Subject: [PATCH 08/22] Use either option for Deb or CentOs --- .github/workflows/build_wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index dee4bf8..2b5f45d 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -18,7 +18,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: - CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel + CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel || apt-get install -y libbz2-dev # ... # with: # package-dir: . From f058dd309d343f413446e8e8ce728e455a8d9b71 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 16:36:40 -0500 Subject: [PATCH 09/22] Upload test artifact --- .github/workflows/build_wheels.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 2b5f45d..5d2c6c4 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -25,7 +25,7 @@ jobs: # output-dir: wheelhouse # config-file: "{package}/pyproject.toml" - # - uses: actions/upload-artifact@v4 - # with: - # name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} - # path: ./wheelhouse/*.whl + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl From 94ca02460a5f44618a2809b878c1373c9f2188f8 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 16:40:22 -0500 Subject: [PATCH 10/22] Update gha flags --- .github/workflows/build_wheels.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 5d2c6c4..7791543 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -1,6 +1,14 @@ name: Build -on: [ push, pull_request ] +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + release: + types: + - published jobs: build_wheels: From 358ec1b10f89c8f94ce09ea9e1b6fef2a4896833 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 17:04:10 -0500 Subject: [PATCH 11/22] Add apk entry for bzip2 devel --- .github/workflows/build_wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 7791543..50ebddd 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -26,7 +26,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: - CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel || apt-get install -y libbz2-dev + CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel || apk add --upgrade bzip2-dev || apt-get install -y libbz2-dev # ... # with: # package-dir: . From c00d6b43b2fbd273933d5bc001a5c02b09a98c8c Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 17:49:39 -0500 Subject: [PATCH 12/22] Limit wheels and push to test pypi --- .github/workflows/build_wheels.yml | 43 ++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 50ebddd..c974431 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -27,13 +27,46 @@ jobs: uses: pypa/cibuildwheel@v2.22.0 env: CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel || apk add --upgrade bzip2-dev || apt-get install -y libbz2-dev - # ... - # with: - # package-dir: . - # output-dir: wheelhouse - # config-file: "{package}/pyproject.toml" + CIBW_SKIP: '*-musllinux_i686 *-manylinux_i686 pp*' - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Build sdist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + + pypi-publish: + needs: [build_wheels, build_sdist] + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: testpypi + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + # unpacks all CIBW artifacts into dist/ + pattern: cibw-* + path: dist + merge-multiple: true + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ From 94d601e63c2146e81b4dd187bffb061fd4b41497 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 18:09:21 -0500 Subject: [PATCH 13/22] Reduce time and adjust upload --- .github/workflows/build_wheels.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index c974431..e33106d 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -27,31 +27,31 @@ jobs: uses: pypa/cibuildwheel@v2.22.0 env: CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel || apk add --upgrade bzip2-dev || apt-get install -y libbz2-dev - CIBW_SKIP: '*-musllinux_i686 *-manylinux_i686 pp*' + CIBW_SKIP: '*-musllinux_i686 *-manylinux_i686 pp* *musllinux*' - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl - build_sdist: - name: Build source distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' + # build_sdist: + # name: Build source distribution + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # with: + # submodules: 'recursive' - - name: Build sdist - run: pipx run build --sdist + # - name: Build sdist + # run: pipx run build --sdist - - uses: actions/upload-artifact@v4 - with: - name: cibw-sdist - path: dist/*.tar.gz + # - uses: actions/upload-artifact@v4 + # with: + # name: cibw-sdist + # path: dist/*.tar.gz pypi-publish: - needs: [build_wheels, build_sdist] + needs: [build_wheels] name: Upload release to PyPI runs-on: ubuntu-latest environment: From a5f2efd6ce78154161cd350bca5f70458b30cda4 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 18:18:34 -0500 Subject: [PATCH 14/22] Test mac installers --- .github/workflows/build_wheels.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index e33106d..1566e96 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -16,13 +16,17 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest ] + os: [ubuntu-latest, macos-13, macos-14] steps: - uses: actions/checkout@v4 with: submodules: 'recursive' + - if: runner.os == 'macOS' + run: | + echo 'Test' + - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: From 82384f7e5f429a355b607298db983cd7e2dd40ad Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 18:21:26 -0500 Subject: [PATCH 15/22] Add autoconf to mac runners --- .github/workflows/build_wheels.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 1566e96..55806da 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -30,6 +30,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: + CIBW_BEFORE_ALL_MACOS: brew install autoconf CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel || apk add --upgrade bzip2-dev || apt-get install -y libbz2-dev CIBW_SKIP: '*-musllinux_i686 *-manylinux_i686 pp* *musllinux*' From 0127d9e8bba047c3808e8952768192321169bdb4 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 18:25:29 -0500 Subject: [PATCH 16/22] Add additional mac dep --- .github/workflows/build_wheels.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 55806da..0d7e1ac 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -23,14 +23,10 @@ jobs: with: submodules: 'recursive' - - if: runner.os == 'macOS' - run: | - echo 'Test' - - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: - CIBW_BEFORE_ALL_MACOS: brew install autoconf + CIBW_BEFORE_ALL_MACOS: brew install autoconf automake CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel || apk add --upgrade bzip2-dev || apt-get install -y libbz2-dev CIBW_SKIP: '*-musllinux_i686 *-manylinux_i686 pp* *musllinux*' From 500daa0890f642a641355d641f6652cc3d03af63 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 18:35:50 -0500 Subject: [PATCH 17/22] Update license pointer --- .github/workflows/build_wheels.yml | 1 + setup.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 0d7e1ac..37a0863 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -71,3 +71,4 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ + skip-existing: true diff --git a/setup.py b/setup.py index bc6b7ed..503351a 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ def build_extension(self, ext): subprocess.check_call(['cmake', '--build', '.', *build_args], cwd=self.build_temp) -description = 'Tool for emending alignments of spuriously spliced transcript reads' +desc = 'Tool for emending alignments of spuriously spliced transcript reads' with open('./README.md', 'r', encoding='utf-8') as fh: long_description = fh.read() @@ -67,7 +67,7 @@ def build_extension(self, ext): version='1.0.0', author='Ida Shinder', author_email='ishinde1@jhmi.edu', - description=description, + description=desc, long_description=long_description, long_description_content_type='text/markdown', url='https://github.com/ishinder/EASTR', @@ -90,5 +90,6 @@ def build_extension(self, ext): ] }, python_requires='>=3.10', - license = license_str, + license='MIT', + license_files =('LICENSE',), ) From a604a87a41fd82cf132421d8d6ab35ffdce90243 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 19:05:27 -0500 Subject: [PATCH 18/22] Finalize test --- .github/workflows/build_wheels.yml | 35 +++++++----------------------- setup.py | 2 +- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 37a0863..06908af 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -1,11 +1,6 @@ -name: Build +name: Build and upload to PyPI on: - workflow_dispatch: - pull_request: - push: - branches: - - main release: types: - published @@ -16,6 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: + # macos-13 is an intel runner, macos-14 is apple silicon os: [ubuntu-latest, macos-13, macos-14] steps: @@ -28,6 +24,7 @@ jobs: env: CIBW_BEFORE_ALL_MACOS: brew install autoconf automake CIBW_BEFORE_ALL_LINUX: yum install -y bzip2-devel || apk add --upgrade bzip2-dev || apt-get install -y libbz2-dev + # Skip these architectures, 32-bit, PyPy, and musl CIBW_SKIP: '*-musllinux_i686 *-manylinux_i686 pp* *musllinux*' - uses: actions/upload-artifact@v4 @@ -35,40 +32,24 @@ jobs: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl - # build_sdist: - # name: Build source distribution - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # with: - # submodules: 'recursive' - - # - name: Build sdist - # run: pipx run build --sdist - - # - uses: actions/upload-artifact@v4 - # with: - # name: cibw-sdist - # path: dist/*.tar.gz - pypi-publish: needs: [build_wheels] name: Upload release to PyPI runs-on: ubuntu-latest environment: - name: testpypi + name: pypi + url: https://pypi.org/p/ permissions: id-token: write steps: - uses: actions/download-artifact@v4 with: - # unpacks all CIBW artifacts into dist/ pattern: cibw-* path: dist merge-multiple: true - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - skip-existing: true + # Testing only + # with: + # repository-url: https://test.pypi.org/legacy/ diff --git a/setup.py b/setup.py index 503351a..0e972ea 100644 --- a/setup.py +++ b/setup.py @@ -91,5 +91,5 @@ def build_extension(self, ext): }, python_requires='>=3.10', license='MIT', - license_files =('LICENSE',), + license_files=('LICENSE',), ) From 1f8a2b6dd40c7bae0b529cf9ac4d0a1df528425e Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 19:33:35 -0500 Subject: [PATCH 19/22] Update install instructions --- README.md | 61 ++++++++----------------------------------------------- 1 file changed, 9 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 7d1e39a..c5a6840 100644 --- a/README.md +++ b/README.md @@ -27,64 +27,21 @@ regardless of the alignment software used. The installation steps for running EASTR are outlined below. Installation takes a few minutes. -1. Clone source repository +1. Clone repository ```bash git clone --recurse-submodules https://github.com/ishinder/EASTR.git - cd EASTR ``` -2. Compile junction_extractor and vacuum +2. Install source code - ```bash - cd utils - cmake -DCMAKE_BUILD_TYPE=Release . - make - ``` - -3. To add the junction_extractor and vacuum executables in the `utils` folder to - your PATH, you can follow these steps: - - Get the absolute path of the build directory: - - ```bash - pwd - ``` - - This command will print the absolute path of the current directory, which is - the `utils` directory. - - Add the absolute path to the PATH environment variable: For temporary use - (not persistent across sessions), you can run: - - ```bash - export PATH=$PATH: - ``` - - Replace `` with the path you obtained in - the previous step. - - For persistent use (across sessions), you can add the `export` command to - your shell's configuration file. For bash, this is typically the `.bashrc` or - `.bash_profile` file in your home directory. For zsh, this is the `.zshrc` - file. To add the path to your shell configuration file, run: - - ```bash - echo 'export PATH=$PATH:' >> ~/.bashrc - ``` - -4. Install EASTR - - Ensure you are in the EASTR main directory before proceeding: - - ```bash - # Navigate back to the main EASTR directory if you are not already there - cd path/to/EASTR - # (OPTIONAL) Install in a Python virtual environment - # python3 -m virtualenv .venv # (OPTIONAL) - # source .venv/bin/activate # (OPTIONAL) - make install # Install EASTR package - ``` + ```bash + cd EASTR + # python3 -m venv .venv # (OPTIONAL) + # source .venv/bin/activate # (OPTIONAL) + pip install setuptools + python3 setup.py install + ``` ### Required Arguments From 20ca94d9a5a38dd486cb2bbc18f5a1adbd102b17 Mon Sep 17 00:00:00 2001 From: copenri Date: Mon, 20 Jan 2025 19:55:12 -0500 Subject: [PATCH 20/22] Add dependency check --- EASTR/extract_junctions.py | 12 +++++++++++- EASTR/output_utils.py | 13 ++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/EASTR/extract_junctions.py b/EASTR/extract_junctions.py index bd80b8d..189a5fb 100644 --- a/EASTR/extract_junctions.py +++ b/EASTR/extract_junctions.py @@ -1,11 +1,16 @@ import collections import multiprocessing import os +import pathlib import shlex import subprocess import pandas as pd +this_directory = pathlib.Path(__file__).resolve().parent +# This should exist with source after compilation. +JUNCTION_CMD = os.path.join(this_directory, 'junction_extractor') + def get_junctions_from_bed(bed_path: str) -> dict: junctions = {} @@ -48,8 +53,9 @@ def get_junctions_multi_bed(bed_list:list, p) -> dict: return dd def junction_extractor(bam_path:str, out_path:str) -> dict: + check_for_dependency() name = os.path.splitext(os.path.basename(bam_path))[0] - cmd = f"junction_extractor -o {out_path} {bam_path}" + cmd = f"{JUNCTION_CMD} -o {out_path} {bam_path}" a = subprocess.Popen(shlex.split(cmd), stdout=subprocess.DEVNULL) b = a.communicate() @@ -155,3 +161,7 @@ def extract_splice_sites_gtf(gtf_path:str) -> dict: # x=extract_splice_sites_bam_regtools(bam_path) # end = time.time() # print(f"took {(end-start)/60} mins to get junctions") + +def check_for_dependency(): + if not os.path.exists(JUNCTION_CMD): + raise RuntimeError(f"{JUNCTION_CMD} not found.") diff --git a/EASTR/output_utils.py b/EASTR/output_utils.py index b857415..3249e43 100644 --- a/EASTR/output_utils.py +++ b/EASTR/output_utils.py @@ -2,6 +2,7 @@ import csv import multiprocessing import os +import pathlib import shlex import subprocess import sys @@ -11,6 +12,10 @@ from EASTR import alignment_utils from EASTR import utils +this_directory = pathlib.Path(__file__).resolve().parent +# This should exist with source after compilation. +VACUUM_CMD = os.path.join(this_directory, 'vacuum') + def out_junctions_filelist(bam_list:list, gtf_path, bed_list, out_junctions, suffix="") -> Union[List[str], None, str]: if out_junctions is None: return None @@ -217,7 +222,8 @@ def spurious_dict_bam_by_sample_to_bed(spurious_dict, bam_list, out_removed_junc def filter_bam_with_vacuum(bam_path, spurious_junctions_bed, out_bam_path, verbose, removed_alignments_bam): - vacuum_cmd = "vacuum --remove_mate " + check_for_dependency() + vacuum_cmd = f"{VACUUM_CMD} --remove_mate " if verbose: vacuum_cmd = f"{vacuum_cmd} -V" if removed_alignments_bam: @@ -289,3 +295,8 @@ def filter_multi_bam_with_vacuum(bam_list, sample_to_bed, out_bam_list, p, verbo # # spurious_alignments, NH = get_spurious_alignments(bam_path, spurious_introns) # # end = time.time() # # print(f"took {(end-start)/60} mins")) + +def check_for_dependency(): + """Check if runtime dependency exists.""" + if not os.path.exists(VACUUM_CMD): + raise RuntimeError(f"{VACUUM_CMD} not found.") From 316238fc3027fa46c0c746640b736c2353dc104c Mon Sep 17 00:00:00 2001 From: ishinder <32040472+ishinder@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:12:57 -0500 Subject: [PATCH 21/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5a6840..75e4a7b 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ a few minutes. cd EASTR # python3 -m venv .venv # (OPTIONAL) # source .venv/bin/activate # (OPTIONAL) - pip install setuptools + pip install -U pip setuptools python3 setup.py install ``` From 24595d39f9637100397d7e5e9b95d5d223298fc2 Mon Sep 17 00:00:00 2001 From: ishinder <32040472+ishinder@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:13:03 -0500 Subject: [PATCH 22/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75e4a7b..eb5e5d6 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ a few minutes. # python3 -m venv .venv # (OPTIONAL) # source .venv/bin/activate # (OPTIONAL) pip install -U pip setuptools - python3 setup.py install + pip install . ``` ### Required Arguments