moducomp 0.7.12__tar.gz → 0.7.14__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moducomp
3
- Version: 0.7.12
3
+ Version: 0.7.14
4
4
  Summary: moducomp: metabolic module completeness and complementarity for microbiomes.
5
5
  Keywords: bioinformatics,microbiome,metabolic,kegg,genomics
6
6
  Author-email: "Juan C. Villada" <jvillada@lbl.gov>
@@ -60,16 +60,22 @@ pixi global install \
60
60
 
61
61
  ## Setup data (required)
62
62
 
63
- `moducomp` needs the eggNOG-mapper database to run. Download it once:
63
+ `moducomp` needs the eggNOG-mapper database to run. The primary (recommended) way to download it is using the `download_eggnog_data.py` wrapper, which mirrors the upstream downloader behavior. For upstream details, see the eggNOG-mapper setup guide: [eggNOG-mapper database setup](https://github.com/eggnogdb/eggnog-mapper/wiki/eggNOG-mapper-v2.1.5-to-v2.1.13#user-content-Setup).
64
64
 
65
65
  ```bash
66
- export EGGNOG_DATA_DIR="/path/to/eggnog-data"
67
- moducomp download-eggnog-data --eggnog-data-dir "$EGGNOG_DATA_DIR"
68
- # or the standalone script:
69
- # download_eggnog_data.py
66
+ download_eggnog_data.py
70
67
  ```
71
68
 
72
- If `EGGNOG_DATA_DIR` is not set, `moducomp download-eggnog-data` defaults to `${XDG_DATA_HOME:-~/.local/share}/moducomp/eggnog`.
69
+ By default, the data are stored in `${XDG_DATA_HOME:-~/.local/share}/moducomp/eggnog`, and `moducomp` will auto-detect that location without needing `EGGNOG_DATA_DIR`.
70
+
71
+ To use a custom location:
72
+
73
+ ```bash
74
+ export EGGNOG_DATA_DIR="/path/to/eggnog-data"
75
+ download_eggnog_data.py --eggnog-data-dir "$EGGNOG_DATA_DIR"
76
+ # equivalent:
77
+ # moducomp download-eggnog-data --eggnog-data-dir "$EGGNOG_DATA_DIR"
78
+ ```
73
79
 
74
80
  ### Quick test
75
81
 
@@ -260,7 +266,7 @@ moducomp validate /path/to/output --strict
260
266
  You can override the bundled data location with `MODUCOMP_DATA_DIR`.
261
267
  When working from source, the bundled test genomes live at `moducomp/data/test_genomes`.
262
268
 
263
- `download_eggnog_data.py` is provided by eggnog-mapper and is available in the Pixi environment (or via `pixi global` installs).
269
+ `download_eggnog_data.py` is exposed by `moducomp` as a convenience wrapper for the eggnog-mapper downloader and is available in the Pixi environment (including `pixi global` installs).
264
270
 
265
271
  Pixi task (supports passing a custom location):
266
272
 
@@ -35,16 +35,22 @@ pixi global install \
35
35
 
36
36
  ## Setup data (required)
37
37
 
38
- `moducomp` needs the eggNOG-mapper database to run. Download it once:
38
+ `moducomp` needs the eggNOG-mapper database to run. The primary (recommended) way to download it is using the `download_eggnog_data.py` wrapper, which mirrors the upstream downloader behavior. For upstream details, see the eggNOG-mapper setup guide: [eggNOG-mapper database setup](https://github.com/eggnogdb/eggnog-mapper/wiki/eggNOG-mapper-v2.1.5-to-v2.1.13#user-content-Setup).
39
39
 
40
40
  ```bash
41
- export EGGNOG_DATA_DIR="/path/to/eggnog-data"
42
- moducomp download-eggnog-data --eggnog-data-dir "$EGGNOG_DATA_DIR"
43
- # or the standalone script:
44
- # download_eggnog_data.py
41
+ download_eggnog_data.py
45
42
  ```
46
43
 
47
- If `EGGNOG_DATA_DIR` is not set, `moducomp download-eggnog-data` defaults to `${XDG_DATA_HOME:-~/.local/share}/moducomp/eggnog`.
44
+ By default, the data are stored in `${XDG_DATA_HOME:-~/.local/share}/moducomp/eggnog`, and `moducomp` will auto-detect that location without needing `EGGNOG_DATA_DIR`.
45
+
46
+ To use a custom location:
47
+
48
+ ```bash
49
+ export EGGNOG_DATA_DIR="/path/to/eggnog-data"
50
+ download_eggnog_data.py --eggnog-data-dir "$EGGNOG_DATA_DIR"
51
+ # equivalent:
52
+ # moducomp download-eggnog-data --eggnog-data-dir "$EGGNOG_DATA_DIR"
53
+ ```
48
54
 
49
55
  ### Quick test
50
56
 
@@ -235,7 +241,7 @@ moducomp validate /path/to/output --strict
235
241
  You can override the bundled data location with `MODUCOMP_DATA_DIR`.
236
242
  When working from source, the bundled test genomes live at `moducomp/data/test_genomes`.
237
243
 
238
- `download_eggnog_data.py` is provided by eggnog-mapper and is available in the Pixi environment (or via `pixi global` installs).
244
+ `download_eggnog_data.py` is exposed by `moducomp` as a convenience wrapper for the eggnog-mapper downloader and is available in the Pixi environment (including `pixi global` installs).
239
245
 
240
246
  Pixi task (supports passing a custom location):
241
247
 
@@ -2,7 +2,7 @@
2
2
  moducomp: metabolic module completeness and complementarity for microbiomes.
3
3
  """
4
4
 
5
- __version__ = "0.7.12"
5
+ __version__ = "0.7.14"
6
6
  __author__ = "Juan C. Villada"
7
7
  __email__ = "jvillada@lbl.gov"
8
8
  __title__ = "moducomp"
@@ -145,15 +145,23 @@ def require_eggnog_data_dir(eggnog_data_dir: Optional[str], logger: Optional[log
145
145
  if eggnog_data_dir:
146
146
  os.environ["EGGNOG_DATA_DIR"] = eggnog_data_dir
147
147
 
148
- env_value = os.environ.get("EGGNOG_DATA_DIR", "")
149
- if not env_value.strip():
150
- message = (
151
- "EGGNOG_DATA_DIR is required to run eggNOG-mapper. "
152
- "Set the EGGNOG_DATA_DIR environment variable or pass --eggnog-data-dir. "
153
- "Download the data with: download_eggnog_data.py or moducomp download-eggnog-data"
154
- )
155
- emit_error(message, logger)
156
- raise typer.Exit(1)
148
+ env_value = os.environ.get("EGGNOG_DATA_DIR", "").strip()
149
+ if not env_value:
150
+ default_dir = default_eggnog_data_dir()
151
+ if default_dir.exists() and default_dir.is_dir() and any(default_dir.iterdir()):
152
+ os.environ["EGGNOG_DATA_DIR"] = str(default_dir)
153
+ env_value = str(default_dir)
154
+ if logger:
155
+ logger.info("EGGNOG_DATA_DIR not set; using default %s", env_value)
156
+ else:
157
+ message = (
158
+ "EGGNOG_DATA_DIR is required to run eggNOG-mapper. "
159
+ "Set the EGGNOG_DATA_DIR environment variable or pass --eggnog-data-dir. "
160
+ f"Default location is {default_dir}. "
161
+ "Download the data with: download_eggnog_data.py or moducomp download-eggnog-data"
162
+ )
163
+ emit_error(message, logger)
164
+ raise typer.Exit(1)
157
165
 
158
166
  data_dir = Path(env_value).expanduser().resolve()
159
167
  if not data_dir.exists() or not data_dir.is_dir():
@@ -3762,7 +3770,19 @@ def download_eggnog_data(
3762
3770
  data_dir.mkdir(parents=True, exist_ok=True)
3763
3771
  logger.info("Downloading eggNOG data into %s", data_dir)
3764
3772
 
3765
- downloader = shutil.which("download_eggnog_data.py")
3773
+ downloader = None
3774
+ for path_entry in os.environ.get("PATH", "").split(os.pathsep):
3775
+ candidate = Path(path_entry) / "download_eggnog_data.py"
3776
+ if not candidate.is_file() or not os.access(candidate, os.X_OK):
3777
+ continue
3778
+ try:
3779
+ wrapper_text = candidate.read_text(encoding="utf-8", errors="ignore")
3780
+ except OSError:
3781
+ wrapper_text = ""
3782
+ if "moducomp.moducomp" in wrapper_text and "download_eggnog_data_cli" in wrapper_text:
3783
+ continue
3784
+ downloader = str(candidate)
3785
+ break
3766
3786
  if downloader is None:
3767
3787
  message = (
3768
3788
  "download_eggnog_data.py not found in PATH. "
@@ -3883,9 +3903,10 @@ def download_eggnog_data(
3883
3903
 
3884
3904
 
3885
3905
  def download_eggnog_data_cli() -> None:
3886
- """Entry point for the download-eggnog-data script."""
3906
+ """Entry point for download-eggnog-data/download_eggnog_data.py scripts."""
3907
+ prog = Path(sys.argv[0]).name if sys.argv else "download-eggnog-data"
3887
3908
  app(
3888
- prog_name="download-eggnog-data",
3909
+ prog_name=prog,
3889
3910
  args=["download-eggnog-data", *sys.argv[1:]],
3890
3911
  )
3891
3912
 
@@ -29,6 +29,7 @@ dynamic = ["version", "description"]
29
29
  [project.scripts]
30
30
  moducomp = "moducomp.moducomp:app"
31
31
  download-eggnog-data = "moducomp.moducomp:download_eggnog_data_cli"
32
+ "download_eggnog_data.py" = "moducomp.moducomp:download_eggnog_data_cli"
32
33
 
33
34
  [project.urls]
34
35
  Homepage = "https://github.com/NeLLi-team/moducomp"
@@ -1,5 +1,5 @@
1
1
  context:
2
- version: 0.7.12
2
+ version: 0.7.14
3
3
 
4
4
  package:
5
5
  name: moducomp
@@ -7,7 +7,7 @@ package:
7
7
 
8
8
  source:
9
9
  - url: https://pypi.org/packages/source/m/moducomp/moducomp-${{ version }}.tar.gz
10
- sha256: bf876d320c88ae31dabe4f43086fbb3b2d0d10a153fa2effb09f2a6be394d2f1
10
+ sha256: bfa45b0d4383ce954e89dceb9b54f4502e02b6ebe995f6a07395ce6a6ede7360
11
11
 
12
12
  build:
13
13
  script:
@@ -15,6 +15,8 @@ build:
15
15
  python:
16
16
  entry_points:
17
17
  - moducomp = moducomp.moducomp:app
18
+ - download-eggnog-data = moducomp.moducomp:download_eggnog_data_cli
19
+ - download_eggnog_data.py = moducomp.moducomp:download_eggnog_data_cli
18
20
  noarch: python
19
21
 
20
22
  requirements:
File without changes
File without changes
File without changes