diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 38f9c15..22f79a2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,6 +7,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, Windows-latest, macos-latest] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] runs-on: ${{ matrix.os }} permissions: contents: read diff --git a/conftest.py b/conftest.py index 593a39d..8a44c26 100644 --- a/conftest.py +++ b/conftest.py @@ -2,6 +2,7 @@ import operator import os import shutil +import warnings import numpy as np @@ -50,13 +51,22 @@ def pytest_runtest_makereport(): num_file = 3 else: num_file = 2 - accu = stdout[-1][-1].split("\n")[-(2 + 3 * num_file) :] - name = accu[0].split()[-1] - with open("tests/accuracy_tests/accu_report.txt", "a") as file: - for i in range(num_file): - assessed_file = accu[i * 3 + 1].split()[-1] - file.write(name + " " + assessed_file + " " + accu[i * 3 + 2] + "\n") - file.write(name + " " + assessed_file + " " + accu[i * 3 + 3] + "\n") + try: + accu = stdout[-1][-1].split("\n")[-(2 + 3 * num_file) :] + name = accu[0].split()[-1] + with open("tests/accuracy_tests/accu_report.txt", "a") as file: + for i in range(num_file): + assessed_file = accu[i * 3 + 1].split()[-1] + file.write( + name + " " + assessed_file + " " + accu[i * 3 + 2] + "\n" + ) + file.write( + name + " " + assessed_file + " " + accu[i * 3 + 3] + "\n" + ) + except IndexError: + warnings.warn( + "Some outputs are missing in the accuracy report. If you are using Linux system, you can rerun the tests, or check the test outputs directly with pytest -s for more details." + ) @pytest.hookimpl() diff --git a/pyproject.toml b/pyproject.toml index 0f1d3ff..796449a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ dependencies = [ "numpy>=1.19", "numba>=0.49.0" ] -requires-python = "!= 3.12, !=3.14" +requires-python = ">= 3.6, < 3.14" [project.scripts] # correspond to entry_points diff --git a/src/alphaimpute2/alphaimpute2.py b/src/alphaimpute2/alphaimpute2.py index 940ce2e..3ac3d52 100644 --- a/src/alphaimpute2/alphaimpute2.py +++ b/src/alphaimpute2/alphaimpute2.py @@ -1,4 +1,5 @@ import argparse +import sys import numpy as np from .tinyhouse import Pedigree @@ -13,10 +14,9 @@ from .tinyhouse.Utils import time_func -# try: from .Imputation import version -version_verion = version.version +version_version = version.version if not ("profile" in globals()): @@ -240,6 +240,21 @@ def getArgs(): help=argparse.SUPPRESS, ) # help='Flag to prioritze pedigree imputation for individuals at the same genotyping density as their parents.') + # special handle for version argument to allow it to be called with just -version + parser.add_argument( + "-version", + default=None, + action="version", + version="%(prog)s " + version_version, + help="Show program's version number and exit.", + ) + + args = sys.argv[1:] + + if "-version" in args: + parser.parse_args(args) + sys.exit(0) + return InputOutput.parseArgs("AlphaImpute", parser) @@ -472,9 +487,15 @@ def write_seg(pedigree, outputFile): @time_func("Full Program Run") def main(): - InputOutput.print_boilerplate("AlphaImpute2", version_verion) args = getArgs() + # commenting out as AlphaImpute2 does not have recent changes for x-chr and metafounder + # therefore cannot use the boilerplate as the commit with updated boilerplate also has + # the changes for x-chr and metafounder and cause issues + # remove comment once AlphaImpute2 has been updated to work with x-chr and metafounder + + # InputOutput.print_boilerplate("AlphaImpute2", version_version) + InputOutput.setNumbaSeeds(12345) pedigree = Pedigree.Pedigree(constructor=ImputationIndividual.AlphaImputeIndividual) read_in_data(pedigree, args)