From 5c71918e0a43e4081edc44d63738d4be20cf9c0e Mon Sep 17 00:00:00 2001 From: seryrzu Date: Tue, 20 Jul 2021 22:06:54 -0700 Subject: [PATCH] Release 1.1.1 (#16) @olga24912 found that running StringDecomposer outside of the git repo (for example, after installation) fails. Reason: git hash, reported in the log, is obtained with a explicit call to git at every execution (contrary to, for example, saving it during make and invoking the saved hash during every launch). This PR: Adds a github action test that ensures correct execution that is initialized outside of the git repo; Disables report of git hash in the log. In the future, we should find a better strategy to report git hash. See also: https://github.com/ablab/stringdecomposer/pull/15 --- .github/workflows/install_notRootLaunch.yml | 60 +++++++++++++++++++++ README.md | 9 ++-- stringdecomposer/__version__.py | 2 +- stringdecomposer/main.py | 4 +- stringdecomposer/py/git.py | 4 ++ 5 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/install_notRootLaunch.yml diff --git a/.github/workflows/install_notRootLaunch.yml b/.github/workflows/install_notRootLaunch.yml new file mode 100644 index 0000000..0f3e462 --- /dev/null +++ b/.github/workflows/install_notRootLaunch.yml @@ -0,0 +1,60 @@ +name: Install with test launch not in root directory + +on: [push, workflow_dispatch] + +jobs: + build-linux: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Add conda to system path + run: | + # $CONDA is an environment variable pointing to the root of the miniconda directory + echo $CONDA/bin >> $GITHUB_PATH + - name: Install dependencies + run: | + conda config --add channels defaults + conda config --add channels bioconda + conda config --add channels conda-forge + conda install -y --file requirements.txt + - name: Install + run: | + make install + make uninstall + - name: Run test dataset + run: | + mkdir test && cd test + make -C .. test_launch + - name: Run test dataset w/ install + run: | + cd test + make -C .. test_launch_install + make -C .. uninstall + - name: Run test dataset w/ binary + run: | + cd test + make -C .. install + stringdecomposer ../stringdecomposer/test_data/read.fa ../stringdecomposer/test_data/DXZ1_star_monomers.fa -o . --second-best + make -C .. uninstall + - name: Run test dataset w/ binary 2 + run: | + make install + cd test + stringdecomposer ../stringdecomposer/test_data/read.fa ../stringdecomposer/test_data/DXZ1_star_monomers.fa -o . --second-best + make -C .. uninstall + - name: Run test dataset w/ binary 3 + run: | + make install + cd .. + mkdir test && cd test + stringdecomposer ../stringdecomposer/stringdecomposer/test_data/read.fa ../stringdecomposer/stringdecomposer/test_data/DXZ1_star_monomers.fa -o . --second-best + make -C ../stringdecomposer uninstall diff --git a/README.md b/README.md index 983b879..bb09e66 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # StringDecomposer -## Version 1.1 +## Version 1.1.1 As an input StringDecomposer algorithm takes the set of monomers (typically, alpha satellites) and a genomic segment (assembly, Oxford Nanopore or a PacBio HiFi read) that contains a tandem repeat consisting of the given monomers. StringDecomposer partitions this segment into distinct monomers, providing an accurate translation from the nucleotide alphabet into the monomer alphabet. @@ -110,7 +110,11 @@ Optional arguments: ## Latest updates -### StringDecomposer 1.1 release (28 July 2021) +### StringDecomposer 1.1.1 release (20 July 2021) + +* git hash is disabled to enable execution outside of git repo + +### StringDecomposer 1.1 release (28 June 2021) * CI support via github actions * improved build and installation @@ -118,7 +122,6 @@ Optional arguments: * py module of StringDecomposer saves commit hash and has a logger ### StringDecomposer 1.0 release (11 August 2020) - * initial StringDecomposer release * conda support * results of StringDecomposer monomer annotation for available centromere assemblies and ONT and Hifi reads of cen6, cen8, and cenX can be found at [Figshare](https://doi.org/10.6084/m9.figshare.12783371) diff --git a/stringdecomposer/__version__.py b/stringdecomposer/__version__.py index f901408..545d07d 100644 --- a/stringdecomposer/__version__.py +++ b/stringdecomposer/__version__.py @@ -1 +1 @@ -__version__ = "1.1" +__version__ = "1.1.1" \ No newline at end of file diff --git a/stringdecomposer/main.py b/stringdecomposer/main.py index db0b7c9..c2217d3 100755 --- a/stringdecomposer/main.py +++ b/stringdecomposer/main.py @@ -220,7 +220,9 @@ def main(): logger = get_logger(logfn, logger_name='StringDecomposer') logger.info(f'cmd: {sys.argv}') - logger.info(f'git hash: {get_git_revision_short_hash()}') + # TODO get_git_revision_short_hash is commented out + # since it does not work when stringdecomposer is run from outside of repo + # logger.info(f'git hash: {get_git_revision_short_hash()}') raw_decomp_fn = os.path.join(args.out_dir, args.out_file + "_raw.tsv") raw_decomposition = run(args.sequences, args.monomers, args.threads, args.scoring, args.batch_size, raw_decomp_fn, args.ed_thr, logger) diff --git a/stringdecomposer/py/git.py b/stringdecomposer/py/git.py index 5e50661..4963848 100644 --- a/stringdecomposer/py/git.py +++ b/stringdecomposer/py/git.py @@ -5,6 +5,10 @@ import subprocess +# Disclaimer: this code can only be run from the git repo and thus should not +# be used in scripts intended for installation + + def get_git_revision_hash(): return subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()