jamofetch 3.7.7__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.
- {jamofetch-3.7.7 → jamofetch-3.7.8}/PKG-INFO +4 -4
- {jamofetch-3.7.7 → jamofetch-3.7.8}/README.md +3 -3
- {jamofetch-3.7.7 → jamofetch-3.7.8}/pyproject.toml +1 -1
- {jamofetch-3.7.7 → jamofetch-3.7.8}/src/jamofetch/jamofetch.py +32 -5
- jamofetch-3.7.8/tests/test_jamofetch.py +47 -0
- jamofetch-3.7.7/tests/test_jamofetch.py +0 -2
- {jamofetch-3.7.7 → jamofetch-3.7.8}/.gitignore +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/.gitlab-ci.yml +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/.readthedocs.yml +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/CHANGELOG.md +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/CONDUCT.md +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/CONTRIBUTING.md +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/docs/Makefile +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/docs/changelog.md +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/docs/conduct.md +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/docs/conf.py +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/docs/contributing.md +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/docs/demo_script.py +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/docs/index.md +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/docs/make.bat +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/docs/requirements.txt +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/prepare-gitlab-publish.sh +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/push-version-tag.sh +0 -0
- {jamofetch-3.7.7 → jamofetch-3.7.8}/src/jamofetch/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jamofetch
|
|
3
|
-
Version: 3.7.
|
|
3
|
+
Version: 3.7.8
|
|
4
4
|
Summary: A thin wrapper to retrieve sequence from JAMO at NERSC and on Dori.
|
|
5
5
|
Author: Duncan Scott
|
|
6
6
|
Requires-Python: >=3.9
|
|
@@ -89,15 +89,15 @@ options:
|
|
|
89
89
|
(venv) [dnscott@ln005 jamofetch]$ jamofetch -d data -l NPUNN -l NOOHG -l HOGH -w --max -1
|
|
90
90
|
fetching sequence:
|
|
91
91
|
|
|
92
|
-
apptainer --silent
|
|
92
|
+
apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom '{"metadata.library_name":"NPUNN","metadata.fastq_type":"sdm_normal","group":"sdm"}'
|
|
93
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
|
|
94
94
|
NPUNN /clusterfs/jgi/groups/dsi/homes/dnscott/git/jamofetch/data/NPUNN.pbio-2747.27352.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz
|
|
95
95
|
|
|
96
|
-
apptainer --silent
|
|
96
|
+
apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom '{"metadata.library_name":"NOOHG","metadata.fastq_type":"sdm_normal","group":"sdm"}'
|
|
97
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
|
|
98
98
|
NOOHG /clusterfs/jgi/groups/dsi/homes/dnscott/git/jamofetch/data/NOOHG.pbio-2691.26653.bc1001_BAK8A_OA--bc1001_BAK8A_OA.ccs.fastq.gz
|
|
99
99
|
|
|
100
|
-
apptainer --silent
|
|
100
|
+
apptainer --silent exec docker://doejgi/jamo-dori jamo link -s dori custom '{"metadata.library_name":"HOGH","metadata.fastq_type":"sdm_normal","group":"sdm"}'
|
|
101
101
|
HOGH /global/dna/dm_archive/sdm/illumina/00/63/97/6397.2.44053.GGCTAC.fastq.gz RESTORED 51d52a82067c014cd6ef4f6f
|
|
102
102
|
HOGH /clusterfs/jgi/groups/dsi/homes/dnscott/git/jamofetch/data/HOGH.6397.2.44053.GGCTAC.fastq.gz
|
|
103
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
|
|
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
|
|
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
|
|
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
|
|
|
@@ -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
|
-
|
|
14
|
-
|
|
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
25
|
def get_cmd(clean_lib_name) -> str:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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):
|
|
@@ -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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|