jamofetch 3.7.6__tar.gz → 3.7.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,151 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+ **__pycache__
131
+
132
+ # PyCharm
133
+ .idea/
134
+
135
+ # RStudio project files
136
+ **.Rproj.user/
137
+ **.Rproj.user*
138
+ **.Rproj
139
+ **.Rhistory
140
+
141
+ # MacOS
142
+ .DS_Store
143
+
144
+ # IntelliJ
145
+ *.iml
146
+
147
+ # Ignore local data directory
148
+ /data/
149
+ /test-data/
150
+ /test-output/
151
+
@@ -0,0 +1,32 @@
1
+ stages:
2
+ - install
3
+ - build
4
+
5
+ image: python:3.9.18
6
+
7
+ install:
8
+ stage: install
9
+ rules:
10
+ - if: $CI_COMMIT_TAG =~ /^v[0-9]+(\.[0-9]+)*$/
11
+ when: always
12
+ tags:
13
+ - docker-build # jgi-docker-runner (#74), confirmed docker executor
14
+ script:
15
+ - chmod 544 prepare-gitlab-publish.sh
16
+ - ./prepare-gitlab-publish.sh
17
+
18
+ publish:
19
+ stage: build
20
+ rules:
21
+ - if: $CI_COMMIT_TAG =~ /^v[0-9]+(\.[0-9]+)*$/
22
+ when: always
23
+ tags:
24
+ - docker-build # jgi-docker-runner (#74), confirmed docker executor
25
+ script:
26
+ - pip install --upgrade pip
27
+ # flit_core must stay <4: 4.x emits Metadata-Version 2.5, which twine<7 can't
28
+ # parse, and twine>=7 requires Python >=3.10 (incompatible with this image).
29
+ - pip install "flit>=3.9,<4" "flit_core>=3.9,<4" "twine>=6.0,<7"
30
+ - flit build
31
+ - twine upload --repository-url "https://code.jgi.doe.gov/api/v4/projects/$CI_PROJECT_ID/packages/pypi" -u gitlab-ci-token -p "$CI_JOB_TOKEN" dist/*
32
+ - twine upload -u __token__ -p "$PYPI_TOKEN" dist/*
@@ -0,0 +1,14 @@
1
+ # Required
2
+ version: 2
3
+
4
+ # Image to use
5
+ build:
6
+ image: testing
7
+
8
+ # Configuration
9
+ python:
10
+ version: 3.9
11
+ install:
12
+ - requirements: docs/requirements.txt
13
+ - method: pip
14
+ path: .
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ <!--next-version-placeholder-->
4
+
5
+ ## v0.1.0 (07/07/2023)
6
+
7
+ - First release of `jamofetch`!
@@ -0,0 +1,43 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant homepage](http://contributor-covenant.org/version/1/4), version 1.4.
@@ -0,0 +1,76 @@
1
+ # Contributing
2
+
3
+ Contributions are welcome, and they are greatly appreciated! Every little bit
4
+ helps, and credit will always be given.
5
+
6
+ ## Types of Contributions
7
+
8
+ ### Report Bugs
9
+
10
+ If you are reporting a bug, please include:
11
+
12
+ * Your operating system name and version.
13
+ * Any details about your local setup that might be helpful in troubleshooting.
14
+ * Detailed steps to reproduce the bug.
15
+
16
+ ### Fix Bugs
17
+
18
+ Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
19
+ wanted" is open to whoever wants to implement it.
20
+
21
+ ### Implement Features
22
+
23
+ Look through the GitHub issues for features. Anything tagged with "enhancement"
24
+ and "help wanted" is open to whoever wants to implement it.
25
+
26
+ ### Write Documentation
27
+
28
+ You can never have enough documentation! Please feel free to contribute to any
29
+ part of the documentation, such as the official docs, docstrings, or even
30
+ on the web in blog posts, articles, and such.
31
+
32
+ ### Submit Feedback
33
+
34
+ If you are proposing a feature:
35
+
36
+ * Explain in detail how it would work.
37
+ * Keep the scope as narrow as possible, to make it easier to implement.
38
+ * Remember that this is a volunteer-driven project, and that contributions
39
+ are welcome :)
40
+
41
+ ## Get Started!
42
+
43
+ Ready to contribute? Here's how to set up `jamofetch` for local development.
44
+
45
+ 1. Download a copy of `jamofetch` locally.
46
+ 2. Install Python 3.9.18 with `pyenv` and install `jamofetch` for local development using `flit`:
47
+
48
+ ```console
49
+ $ pyenv install 3.9.18
50
+ $ pyenv local 3.9.18
51
+ $ pip install flit
52
+ $ flit install --symlink
53
+ ```
54
+
55
+ 3. Use `git` (or similar) to create a branch for local development and make your changes:
56
+
57
+ ```console
58
+ $ git checkout -b name-of-your-bugfix-or-feature
59
+ ```
60
+
61
+ 4. When you're done making changes, check that your changes conform to any code formatting requirements and pass any tests.
62
+
63
+ 5. Commit your changes and open a pull request.
64
+
65
+ ## Pull Request Guidelines
66
+
67
+ Before you submit a pull request, check that it meets these guidelines:
68
+
69
+ 1. The pull request should include additional tests if appropriate.
70
+ 2. If the pull request adds functionality, the docs should be updated.
71
+ 3. The pull request should work for all currently supported operating systems and versions of Python.
72
+
73
+ ## Code of Conduct
74
+
75
+ Please note that the `jamofetch` project is released with a
76
+ Code of Conduct. By contributing to this project you agree to abide by its terms.
@@ -1,17 +1,13 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: jamofetch
3
- Version: 3.7.6
3
+ Version: 3.7.8
4
4
  Summary: A thin wrapper to retrieve sequence from JAMO at NERSC and on Dori.
5
- License: None
6
5
  Author: Duncan Scott
7
- Requires-Python: >=3.8
8
- Classifier: License :: Other/Proprietary License
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.8
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
6
+ Requires-Python: >=3.9
14
7
  Description-Content-Type: text/markdown
8
+ Requires-Dist: sphinx-autoapi>=2.1.1,<3 ; extra == "docs"
9
+ Requires-Dist: sphinx-rtd-theme>=1.2.2,<2 ; extra == "docs"
10
+ Provides-Extra: docs
15
11
 
16
12
  # jamofetch
17
13
  thin wrapper on JAMO to allow sequence retrieval on Dori and at NERSC
@@ -93,15 +89,15 @@ options:
93
89
  (venv) [dnscott@ln005 jamofetch]$ jamofetch -d data -l NPUNN -l NOOHG -l HOGH -w --max -1
94
90
  fetching sequence:
95
91
 
96
- apptainer --silent run docker://doejgi/jamo-dori jamo link -s dori library NPUNN
92
+ apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom '{"metadata.library_name":"NPUNN","metadata.fastq_type":"sdm_normal","group":"sdm"}'
97
93
  NPUNN /global/dna/dm_archive/sdm/pacbio/00/27/47/pbio-2747.27352.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz BACKUP_COMPLETE 6391936239a7711d789a9380
98
94
  NPUNN /clusterfs/jgi/groups/dsi/homes/dnscott/git/jamofetch/data/NPUNN.pbio-2747.27352.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz
99
95
 
100
- apptainer --silent run docker://doejgi/jamo-dori jamo link -s dori library NOOHG
96
+ apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom '{"metadata.library_name":"NOOHG","metadata.fastq_type":"sdm_normal","group":"sdm"}'
101
97
  NOOHG /global/dna/dm_archive/sdm/pacbio/00/26/91/pbio-2691.26653.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz RESTORED 6347dbb35bc59487d7e768d6
102
98
  NOOHG /clusterfs/jgi/groups/dsi/homes/dnscott/git/jamofetch/data/NOOHG.pbio-2691.26653.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz
103
99
 
104
- apptainer --silent run docker://doejgi/jamo-dori jamo link -s dori library HOGH
100
+ apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom '{"metadata.library_name":"HOGH","metadata.fastq_type":"sdm_normal","group":"sdm"}'
105
101
  HOGH /global/dna/dm_archive/sdm/illumina/00/63/97/6397.2.44053.GGCTAC.fastq.gz RESTORED 51d52a82067c014cd6ef4f6f
106
102
  HOGH /clusterfs/jgi/groups/dsi/homes/dnscott/git/jamofetch/data/HOGH.6397.2.44053.GGCTAC.fastq.gz
107
103
 
@@ -78,15 +78,15 @@ options:
78
78
  (venv) [dnscott@ln005 jamofetch]$ jamofetch -d data -l NPUNN -l NOOHG -l HOGH -w --max -1
79
79
  fetching sequence:
80
80
 
81
- apptainer --silent run docker://doejgi/jamo-dori jamo link -s dori library NPUNN
81
+ apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom '{"metadata.library_name":"NPUNN","metadata.fastq_type":"sdm_normal","group":"sdm"}'
82
82
  NPUNN /global/dna/dm_archive/sdm/pacbio/00/27/47/pbio-2747.27352.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz BACKUP_COMPLETE 6391936239a7711d789a9380
83
83
  NPUNN /clusterfs/jgi/groups/dsi/homes/dnscott/git/jamofetch/data/NPUNN.pbio-2747.27352.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz
84
84
 
85
- apptainer --silent run docker://doejgi/jamo-dori jamo link -s dori library NOOHG
85
+ apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom '{"metadata.library_name":"NOOHG","metadata.fastq_type":"sdm_normal","group":"sdm"}'
86
86
  NOOHG /global/dna/dm_archive/sdm/pacbio/00/26/91/pbio-2691.26653.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz RESTORED 6347dbb35bc59487d7e768d6
87
87
  NOOHG /clusterfs/jgi/groups/dsi/homes/dnscott/git/jamofetch/data/NOOHG.pbio-2691.26653.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz
88
88
 
89
- apptainer --silent run docker://doejgi/jamo-dori jamo link -s dori library HOGH
89
+ apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom '{"metadata.library_name":"HOGH","metadata.fastq_type":"sdm_normal","group":"sdm"}'
90
90
  HOGH /global/dna/dm_archive/sdm/illumina/00/63/97/6397.2.44053.GGCTAC.fastq.gz RESTORED 51d52a82067c014cd6ef4f6f
91
91
  HOGH /clusterfs/jgi/groups/dsi/homes/dnscott/git/jamofetch/data/HOGH.6397.2.44053.GGCTAC.fastq.gz
92
92
 
@@ -0,0 +1,19 @@
1
+ # Minimal makefile for Sphinx documentation
2
+
3
+ # You can set these variables from the command line.
4
+ SPHINXOPTS =
5
+ SPHINXBUILD = python -msphinx
6
+ SPHINXPROJ = jamofetch
7
+ SOURCEDIR = .
8
+ BUILDDIR = _build
9
+
10
+ # Put it first so that "make" without argument is like "make help".
11
+ help:
12
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13
+
14
+ .PHONY: help Makefile
15
+
16
+ # Catch-all target: route all unknown targets to Sphinx using the new
17
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18
+ %: Makefile
19
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,2 @@
1
+ ```{include} ../CHANGELOG.md
2
+ ```
@@ -0,0 +1,2 @@
1
+ ```{include} ../CONDUCT.md
2
+ ```
@@ -0,0 +1,35 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # This file only contains a selection of the most common options. For a full
4
+ # list see the documentation:
5
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
+
7
+ # -- Project information -----------------------------------------------------
8
+
9
+ project = u"jamofetch"
10
+ copyright = u"2023, Duncan Scott"
11
+ author = u"Duncan Scott"
12
+
13
+ # -- General configuration ---------------------------------------------------
14
+ # Add any Sphinx extension module names here, as strings. They can be
15
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
16
+ # ones.
17
+ extensions = [
18
+ "autoapi.extension",
19
+ "sphinx.ext.napoleon",
20
+ "sphinx.ext.viewcode",
21
+ "myst_parser"
22
+ ]
23
+ autoapi_dirs = ["../src"]
24
+
25
+ # List of patterns, relative to source directory, that match files and
26
+ # directories to ignore when looking for source files.
27
+ # This pattern also affects html_static_path and html_extra_path.
28
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
29
+
30
+ # -- Options for HTML output -------------------------------------------------
31
+
32
+ # The theme to use for HTML and HTML Help pages. See the documentation for
33
+ # a list of builtin themes.
34
+ #
35
+ html_theme = "sphinx_rtd_theme"
@@ -0,0 +1,2 @@
1
+ ```{include} ../CONTRIBUTING.md
2
+ ```
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env python3
2
+
3
+
4
+ import os.path
5
+ import shutil
6
+ from pathlib import Path
7
+
8
+ from jamofetch.jamofetch import JamoFetcher, LibSeq
9
+
10
+ WAIT_INTERVAL = 10 # check if JAMO has provisioned sequence every 10 seconds
11
+ WAIT_MAX = 7200 # max wait is 7200 seconds or 2 hours
12
+
13
+ LIBRARY_1 = 'NPUNN'
14
+ LIBRARY_2 = 'NOOHG'
15
+
16
+
17
+ def get_project_root() -> Path:
18
+ return Path(__file__).parent.parent
19
+
20
+
21
+ # Print the path to the sequence symlink created by JAMO
22
+ # and the real path of the sequence file. If param wait is True,
23
+ # wait for Jamo to provision sequence before outputting real path.
24
+ def print_lib_seq(lib_seq: LibSeq, wait=False):
25
+ print(f"{lib_seq.get_lib_name()} sequence symlink: {lib_seq.get_seq_path()}")
26
+ real_path = lib_seq.get_real_path() if not wait else lib_seq.get_real_path_wait()
27
+ print(f"{lib_seq.get_lib_name()} sequence real path: {real_path}")
28
+
29
+
30
+ # Delete directory "test-output" in project root if it exists.
31
+ # Directory "test-output" will be created by JamoFetcher and
32
+ # be used by JAMO to create symlinks to requested sequence files.
33
+ link_dir = os.path.join(get_project_root(), 'test-output')
34
+ shutil.rmtree(link_dir, ignore_errors=True)
35
+ print(f"\nlink directory: {link_dir}")
36
+
37
+ # create a fetcher
38
+ fetcher: JamoFetcher = JamoFetcher(link_dir=link_dir, wait_interval_secs=WAIT_INTERVAL, wait_max_secs=WAIT_MAX)
39
+
40
+ # Call JAMO to link sequence in the background. Symlinks to the sequence
41
+ # files are created by JAMO in directory <link_directory>.
42
+ lib_seq_1: LibSeq = fetcher.fetch_lib_seq(LIBRARY_1)
43
+ lib_seq_2: LibSeq = fetcher.fetch_lib_seq(LIBRARY_2)
44
+
45
+ # If JAMO already fetched sequence for the first library,
46
+ # print the real path to the sequence file via call
47
+ # print_lib_seq(lib_seq_1),
48
+ # otherwise just print the symlink created by JAMO.
49
+ print()
50
+ print_lib_seq(lib_seq_1)
51
+ if lib_seq_1.seq_exists():
52
+ print(f"{lib_seq_1.get_lib_name()} sequence ready")
53
+ else:
54
+ print(f"{lib_seq_1.get_lib_name()} sequence not yet ready")
55
+
56
+ # Print real path to sequence file for second library when it
57
+ # has been provisioned by JAMO.
58
+ print(f"\n{lib_seq_2.get_lib_name()} waiting on JAMO to provision sequence")
59
+ print_lib_seq(lib_seq_2, wait=True)
60
+ print()
@@ -0,0 +1,17 @@
1
+ ```{include} ../README.md
2
+ ```
3
+ ## Demo Script
4
+ docs/demo_script.py
5
+ ```{literalinclude} ./demo_script.py
6
+ :language: python
7
+ ```
8
+
9
+ ```{toctree}
10
+ :maxdepth: 1
11
+ :hidden:
12
+
13
+ changelog.md
14
+ contributing.md
15
+ conduct.md
16
+ autoapi/index
17
+ ```
@@ -0,0 +1,36 @@
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=python -msphinx
9
+ )
10
+ set SOURCEDIR=.
11
+ set BUILDDIR=_build
12
+ set SPHINXPROJ=jamofetch
13
+
14
+ if "%1" == "" goto help
15
+
16
+ %SPHINXBUILD% >NUL 2>NUL
17
+ if errorlevel 9009 (
18
+ echo.
19
+ echo.The Sphinx module was not found. Make sure you have Sphinx installed,
20
+ echo.then set the SPHINXBUILD environment variable to point to the full
21
+ echo.path of the 'sphinx-build' executable. Alternatively you may add the
22
+ echo.Sphinx directory to PATH.
23
+ echo.
24
+ echo.If you don't have Sphinx installed, grab it from
25
+ echo.http://sphinx-doc.org/
26
+ exit /b 1
27
+ )
28
+
29
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
30
+ goto end
31
+
32
+ :help
33
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
34
+
35
+ :end
36
+ popd
@@ -0,0 +1,3 @@
1
+ myst-nb
2
+ sphinx-autoapi
3
+ sphinx-rtd-theme
@@ -0,0 +1,40 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ VERSION=$(grep version pyproject.toml | awk '{print $3}' | tr -d '"')
5
+ TAGS=$(git tag --points-at HEAD)
6
+ TAG_TO_MATCH="v${VERSION}"
7
+
8
+ echo project version: $VERSION
9
+ echo tags: $TAGS
10
+ echo tag to match: $TAG_TO_MATCH
11
+
12
+ if echo $TAGS | grep -qw "$TAG_TO_MATCH"
13
+ then
14
+ echo version tag matched
15
+ else
16
+ echo no matching version tag
17
+ echo exiting
18
+ exit 1
19
+ fi
20
+
21
+ python -V
22
+ pip install --upgrade pip
23
+
24
+ PUBLISHED_VERSIONS=$(pip index versions $CI_PROJECT_NAME \
25
+ --index-url https://oauth2:$CI_JOB_TOKEN@code.jgi.doe.gov/api/v4/projects/479/packages/pypi/simple \
26
+ | grep 'Available versions:' \
27
+ | awk -F: '{print $2}')
28
+
29
+ echo published versions: $PUBLISHED_VERSIONS
30
+
31
+ if echo $PUBLISHED_VERSIONS | grep -qw "$VERSION"
32
+ then
33
+ echo "already published"
34
+ echo "exiting"
35
+ exit 1
36
+ fi
37
+
38
+ # smoke test: confirm the package actually builds before the publish stage runs
39
+ pip install "flit>=3.9,<4" "flit_core>=3.9,<4"
40
+ flit build
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ SCRIPT_PATH=$(realpath "${BASH_SOURCE[0]}")
5
+ SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
6
+
7
+ cd "$SCRIPT_DIR"
8
+
9
+ VERSION=$(grep version pyproject.toml | awk '{print $3}' | tr -d '"')
10
+ TAG_VERSION="v${VERSION}"
11
+
12
+ git tag -a "$TAG_VERSION" -m "$TAG_VERSION"
13
+ git push origin --tags
14
+
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = ["flit_core>=3.9,<4"]
3
+ build-backend = "flit_core.buildapi"
4
+
5
+ [project]
6
+ name = "jamofetch"
7
+ version = "3.7.8"
8
+ description = "A thin wrapper to retrieve sequence from JAMO at NERSC and on Dori."
9
+ authors = [{ name = "Duncan Scott" }]
10
+ readme = "README.md"
11
+ requires-python = ">=3.9"
12
+
13
+ [project.scripts]
14
+ jamofetch = "jamofetch.jamofetch:cli"
15
+
16
+ [project.optional-dependencies]
17
+ docs = [
18
+ "sphinx-autoapi>=2.1.1,<3",
19
+ "sphinx-rtd-theme>=1.2.2,<2",
20
+ ]
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
+ import json
3
4
  import logging
4
5
  import os
5
6
  import pathlib
@@ -10,17 +11,43 @@ import time
10
11
  from argparse import ArgumentParser
11
12
  from stat import ST_CTIME
12
13
 
13
- JAMO_CMD_NERSC = 'module load jamo; jamo link library'
14
- JAMO_CMD_DORI = 'apptainer --silent run docker://doejgi/jamo-dori jamo link -s dori library'
14
+ # Base commands; get_cmd() appends the query.
15
+ #
16
+ # Dori uses `apptainer exec`, not `run`: the jamo-dori image's runscript strips the
17
+ # double quotes out of the JSON query, and jamo then fails with a JSONDecodeError.
18
+ JAMO_CMD_NERSC = 'module load jamo; jamo link'
19
+ JAMO_CMD_DORI = 'apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori'
15
20
 
16
21
  TWO_HOURS = 7200 # seconds
17
22
  ONE_MINUTE = 60 # seconds
18
23
 
19
24
 
20
- def _get_cmd(clean_lib_name) -> str:
21
- if os.getenv('SLURM_PARTITION') == 'dori':
22
- return f"{JAMO_CMD_DORI} {clean_lib_name}"
23
- return f"{JAMO_CMD_NERSC} {clean_lib_name}"
25
+ def get_cmd(clean_lib_name) -> str:
26
+ """
27
+ Build the site-appropriate `jamo link` command for a library's SDM fastq.
28
+
29
+ Uses a custom query rather than `jamo link library <name>`. That form applies
30
+ jamo's default `raw_normal` filter, {'metadata.fastq_type': 'sdm_normal',
31
+ 'user': 'sdm'}, and files from SDM's newer pipeline are owned by user
32
+ 'sdm_pipeline' (group still 'sdm'), so it matched nothing for them. Filtering
33
+ on group instead of user matches both.
34
+
35
+ Key order matters: jamo names each symlink '<first string-valued query key's
36
+ value>.<file_name>', so metadata.library_name must stay first or
37
+ _find_fastq_path() will not find the link.
38
+
39
+ A library sequenced on more than one run matches one fastq per run; nothing
40
+ here chooses between them.
41
+ """
42
+ # Validated because the name is interpolated into a shell command.
43
+ lib_name = _clean_library_name(clean_lib_name)
44
+ query = json.dumps({
45
+ "metadata.library_name": lib_name,
46
+ "metadata.fastq_type": "sdm_normal",
47
+ "group": "sdm",
48
+ }, separators=(',', ':'))
49
+ base = JAMO_CMD_DORI if os.getenv('SLURM_PARTITION') == 'dori' else JAMO_CMD_NERSC
50
+ return f"{base} custom '{query}'"
24
51
 
25
52
 
26
53
  def _clean_library_name(library_name):
@@ -172,7 +199,7 @@ class JamoFetcher():
172
199
  os.chdir(self._link_dir)
173
200
  clean_lib_name = _clean_library_name(lib_name)
174
201
 
175
- cmd = _get_cmd(clean_lib_name)
202
+ cmd = get_cmd(clean_lib_name)
176
203
  print(f"\n{cmd}", file=out_file)
177
204
  output = subprocess.check_output(cmd, shell=True)
178
205
  for line in output.splitlines():
@@ -0,0 +1,47 @@
1
+ import json
2
+ import shlex
3
+
4
+ import pytest
5
+
6
+ from jamofetch import jamofetch
7
+
8
+
9
+ def _query(cmd):
10
+ # The query is the single-quoted final argument; shlex undoes the shell quoting.
11
+ return json.loads(shlex.split(cmd)[-1])
12
+
13
+
14
+ def test_nersc_cmd(monkeypatch):
15
+ monkeypatch.delenv('SLURM_PARTITION', raising=False)
16
+ cmd = jamofetch.get_cmd('LBBDHFZ')
17
+ assert cmd.startswith('module load jamo; jamo link custom ')
18
+ assert _query(cmd) == {
19
+ "metadata.library_name": "LBBDHFZ",
20
+ "metadata.fastq_type": "sdm_normal",
21
+ "group": "sdm",
22
+ }
23
+
24
+
25
+ def test_dori_cmd_uses_exec(monkeypatch):
26
+ monkeypatch.setenv('SLURM_PARTITION', 'dori')
27
+ cmd = jamofetch.get_cmd('LBBDHFZ')
28
+ assert cmd.startswith('apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom ')
29
+ assert _query(cmd)["metadata.library_name"] == "LBBDHFZ"
30
+
31
+
32
+ def test_library_name_is_first_query_key(monkeypatch):
33
+ # jamo names the symlink after the first string-valued key; _find_fastq_path
34
+ # relies on that being the library name.
35
+ monkeypatch.delenv('SLURM_PARTITION', raising=False)
36
+ assert next(iter(_query(jamofetch.get_cmd('LBBDHFZ')))) == "metadata.library_name"
37
+
38
+
39
+ def test_query_does_not_filter_on_user(monkeypatch):
40
+ monkeypatch.delenv('SLURM_PARTITION', raising=False)
41
+ assert "user" not in _query(jamofetch.get_cmd('LBBDHFZ'))
42
+
43
+
44
+ @pytest.mark.parametrize('bad', ["LBB'DHFZ", 'lbbdhfz', 'LBB DHFZ', 'LBB;rm'])
45
+ def test_invalid_library_name_rejected(bad):
46
+ with pytest.raises(ValueError):
47
+ jamofetch.get_cmd(bad)
@@ -1,23 +0,0 @@
1
- [tool.poetry]
2
- name = "jamofetch"
3
- version = "3.7.6"
4
- description = "A thin wrapper to retrieve sequence from JAMO at NERSC and on Dori."
5
- authors = ["Duncan Scott"]
6
- license = "None"
7
- readme = "README.md"
8
-
9
- [tool.poetry.dependencies]
10
- python = ">=3.8"
11
-
12
- [tool.poetry.dev-dependencies]
13
-
14
- [tool.poetry.group.dev.dependencies]
15
- sphinx-autoapi = "^2.1.1"
16
- sphinx-rtd-theme = "^1.2.2"
17
-
18
- [tool.poetry.scripts]
19
- jamofetch = 'jamofetch.jamofetch:cli'
20
-
21
- [build-system]
22
- requires = ["poetry-core>=1.0.0"]
23
- build-backend = "poetry.core.masonry.api"