Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 17 additions & 7 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import operator
import os
import shutil
import warnings
import numpy as np


Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 24 additions & 3 deletions src/alphaimpute2/alphaimpute2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import sys
import numpy as np

from .tinyhouse import Pedigree
Expand All @@ -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()):

Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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)
Expand Down
Loading