Skip to content

Commit

Permalink
Fixed an issue with paths, patch version
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisgKent committed Aug 20, 2024
1 parent 7414544 commit eda9430
Show file tree
Hide file tree
Showing 8 changed files with 338 additions and 297 deletions.
600 changes: 316 additions & 284 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion primal_page/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.8.0"
__version__ = "1.8.1"
2 changes: 2 additions & 0 deletions primal_page/build_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def parse_version(
) -> dict[str, str]:
version_dict = dict()

log.info(f"parsing {version_path}")

# Read in the info.json file
with open(version_path / "info.json") as f:
info_dict = json.load(f)
Expand Down
11 changes: 9 additions & 2 deletions primal_page/modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ def write_info_json(info: Info, schemeinfo: pathlib.Path):

def generate_files(info: Info, schemeinfo: pathlib.Path):
# Write the validated info.json
write_info_json(info, schemeinfo / "info.json")

if schemeinfo.name != "info.json":
schemeinfo = schemeinfo / "info.json"

write_info_json(info, schemeinfo)

# Update the README
scheme_path = schemeinfo.parent
Expand Down Expand Up @@ -151,7 +155,10 @@ def remove_link(
schemeinfo: Annotated[
pathlib.Path,
typer.Argument(
help="The path to info.json", readable=True, exists=True, writable=True
help="The path to info.json",
readable=True,
exists=True,
writable=True,
),
],
linkfield: Annotated[
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "primal-page"
version = "1.8.0"
version = "1.8.1"
description = "Tooling and schemas for the primerschemes index"
authors = ["ChrisKent <[email protected]>"]
readme = "README.md"
Expand All @@ -11,9 +11,9 @@ python = "^3.10"
pydantic = "^2.4.2"
requests = "^2.31.0"
biopython = "^1.83"

typer = "^0.12.3"
pre-commit = "^3.7.1"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.3"
ruff = "^0.3.4"
Expand Down
12 changes: 6 additions & 6 deletions tests/test_bedfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class TestBedfile(unittest.TestCase):
v1bedfile = pathlib.Path("tests/test_input/v1.primer.bed")
v2bedfile = pathlib.Path("tests/test_input/v2.primer.bed")
v3bedfile = pathlib.Path("tests/test_input/v3.primer.bed")
invalidbedfile = pathlib.Path("tests/test_input/invalid.primer.bed")
invalidstructbedfile = pathlib.Path("tests/test_input/invalid.struct.primer.bed")
invalid_bedfile = pathlib.Path("tests/test_input/invalid.primer.bed")
invalid_struct_bedfile = pathlib.Path("tests/test_input/invalid.struct.primer.bed")

def test_validate_bedfile(self):
# Test v1
Expand All @@ -31,11 +31,11 @@ def test_validate_bedfile(self):
self.assertEqual(validate_bedfile(self.v3bedfile), BEDFileResult.VALID)
# Test invalid raises
with self.assertRaises(PrimerVersionError):
validate_bedfile(self.invalidbedfile)
validate_bedfile(self.invalid_bedfile)

# Test invalid structure
with self.assertRaises(InvalidBedFileLine):
validate_bedfile(self.invalidstructbedfile)
validate_bedfile(self.invalid_struct_bedfile)


class TestDeterminePrimernameVersion(unittest.TestCase):
Expand Down Expand Up @@ -122,7 +122,7 @@ class TestValidateBedfileLineStructure(unittest.TestCase):
v1bedfile = pathlib.Path("tests/test_input/v1.primer.bed")
v2bedfile = pathlib.Path("tests/test_input/v2.primer.bed")
v3bedfile = pathlib.Path("tests/test_input/v3.primer.bed")
invalidbedfile = pathlib.Path("tests/test_input/invalid.struct.primer.bed")
invalid_bedfile = pathlib.Path("tests/test_input/invalid.struct.primer.bed")

def test_bed_file_structure_v3(self):
"""
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_bed_file_structure_invalid(self):
"""
Test that the bed file structure is correct
"""
with open(self.invalidbedfile) as bedfile:
with open(self.invalid_bedfile) as bedfile:
results = [
validate_bedfile_line_structure(line) for line in bedfile.readlines()
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"articbedversion": "v3.0",
"collections": [],
"links": {
"protocals": [],
"protocols": [],
"validation": [],
"homepage": [],
"vendors": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"articbedversion": "v3.0",
"collections": [],
"links": {
"protocals": [],
"protocols": [],
"validation": [],
"homepage": [],
"vendors": [],
Expand Down

0 comments on commit eda9430

Please sign in to comment.