Skip to content

Commit

Permalink
Added regenerate to update the info.json infoschema
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisgKent committed Feb 28, 2024
1 parent 6b79ba0 commit 1477672
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion primal_page/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
validate_bedfile,
BEDFILERESULT,
Collection,
INFO_SCHEMA,
)


Expand Down Expand Up @@ -476,7 +477,7 @@ def primerclass(
PrimerClass, typer.Argument(help="The primerclass to change to")
],
):
"""Append an author to the authors list in the info.json file"""
"""Change the primerclass field in the info.json"""

info = json.load(schemeinfo.open())
info = Info(**info)
Expand Down Expand Up @@ -814,6 +815,7 @@ def regenerate(
- Rehashes info.json's primer_bed_md5 and reference_fasta_md5
- Regenerates the README.md file
- Recalculate the artic-primerbed version
- Updates the infoschema version to current
Ensures work/config.json has no absolute paths
- Ensures hashes in config.json are removed
Expand Down Expand Up @@ -847,6 +849,7 @@ def regenerate(
info_json["reference_fasta_md5"] = hashfile(scheme_path / "reference.fasta")

info = Info(**info_json)
info.infoschema = INFO_SCHEMA

# Get the pngs
pngs = [path for path in scheme_path.rglob("*.png")]
Expand Down
4 changes: 3 additions & 1 deletion primal_page/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import pathlib
from primalhelper.bedfile import read_bed_file

INFO_SCHEMA = "v1.3.0"

SCHEMENAME_PATTERN = r"^[a-z0-9][a-z0-9-]*[a-z0-9]$"
VERSION_PATTERN = r"^v\d+\.\d+\.\d+$"

Expand Down Expand Up @@ -193,7 +195,7 @@ class Info(BaseModel):
species: Annotated[set[int | str], AfterValidator(not_empty)]
license: str = "CC BY-SA 4.0"
primerclass: PrimerClass = PrimerClass.PRIMERSCHEMES
infoschema: str = "v1.3.0"
infoschema: str = INFO_SCHEMA
articbedversion: BedfileVersion
# Add the optional fields
description: str | None = None
Expand Down

0 comments on commit 1477672

Please sign in to comment.