Skip to content

Commit 06c5bb1

Browse files
Merge branch 'main' of github.com:HippocampusGirl/RAMP
2 parents 9d1f843 + 5371843 commit 06c5bb1

21 files changed

+51
-31
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
exclude_types:
2121
- diff
2222
- repo: https://github.com/astral-sh/ruff-pre-commit
23-
rev: v0.5.6
23+
rev: v0.6.1
2424
hooks:
2525
- id: ruff
2626
args: [--fix, --exit-non-zero-on-fix]

src/gwas/tests/compression/test_arr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import numpy as np
55
import pandas as pd
66
import pytest
7+
from upath import UPath
8+
79
from gwas.compression.arr.base import (
810
Blosc2CompressionMethod,
911
FileArray,
@@ -14,7 +16,6 @@
1416
from gwas.compression.arr.text import header_prefix
1517
from gwas.compression.pipe import CompressedTextReader
1618
from gwas.utils import cpu_count
17-
from upath import UPath
1819

1920
try:
2021
import blosc2 as blosc2

src/gwas/tests/compression/test_pipe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
import numpy as np
44
import pytest
5+
from upath import UPath
6+
57
from gwas.compression.pipe import (
68
CompressedBytesReader,
79
CompressedBytesWriter,
810
CompressedTextReader,
911
CompressedTextWriter,
1012
)
1113
from gwas.utils import cpu_count
12-
from upath import UPath
1314

1415

1516
@pytest.mark.parametrize("compression", ["zst", "xz", "gz", "bz2", "lz4"])

src/gwas/tests/conftest.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
import numpy as np
55
import pandas as pd
66
import pytest
7+
from numpy import typing as npt
8+
from psutil import virtual_memory
9+
from pytest import FixtureRequest
10+
from tqdm.auto import tqdm
11+
from upath import UPath
12+
713
from gwas.compression.convert import to_bgzip
814
from gwas.compression.pipe import CompressedTextReader
915
from gwas.log import add_handler, setup_logging_queue, teardown_logging
@@ -12,11 +18,6 @@
1218
from gwas.utils import apply_num_threads, chromosome_to_int, chromosomes_set, cpu_count
1319
from gwas.vcf.base import VCFFile, calc_vcf, load_vcf
1420
from gwas.vcf.variant import Variant
15-
from numpy import typing as npt
16-
from psutil import virtual_memory
17-
from pytest import FixtureRequest
18-
from tqdm.auto import tqdm
19-
from upath import UPath
2021

2122
base_path: UPath = UPath(os.environ["DATA_PATH"])
2223
dataset: str = "opensnp"

src/gwas/tests/score/conftest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
import numpy as np
88
import pytest
9+
from numpy import typing as npt
10+
from upath import UPath
11+
912
from gwas.eig.base import Eigendecomposition
1013
from gwas.eig.calc import calc_eigendecompositions
1114
from gwas.mem.arr import SharedArray
@@ -29,8 +32,6 @@
2932
get_global_lock,
3033
)
3134
from gwas.vcf.base import VCFFile
32-
from numpy import typing as npt
33-
from upath import UPath
3435

3536
from ..conftest import DirectoryFactory
3637
from .rmw_debug import rmw_debug

src/gwas/tests/score/simulation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import pytest
2+
from upath import UPath
3+
24
from gwas.testing.convert import (
35
convert_vcf_to_pfiles,
46
get_pfile_variant_ids,
@@ -7,7 +9,6 @@
79
from gwas.testing.simulate import SimulationResult, simulate
810
from gwas.utils import cpu_count
911
from gwas.vcf.base import VCFFile
10-
from upath import UPath
1112

1213
from ..conftest import DirectoryFactory
1314

src/gwas/tests/score/test_cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
import numpy as np
55
import pandas as pd
6+
from pytest import FixtureRequest
7+
from upath import UPath
8+
69
from gwas.compression.cache import cache_suffix
710
from gwas.eig.base import Eigendecomposition
811
from gwas.mem.wkspace import SharedWorkspace
@@ -12,8 +15,6 @@
1215
from gwas.score.command import GwasCommand
1316
from gwas.score.job import SummaryCollection
1417
from gwas.vcf.base import VCFFile
15-
from pytest import FixtureRequest
16-
from upath import UPath
1718

1819
from ..conftest import chromosomes
1920
from ..utils import assert_both_close, check_bias

src/gwas/tests/score/test_ml.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import numpy as np
44
import pytest
5+
from jax import numpy as jnp
6+
57
from gwas.log import logger
68
from gwas.null_model.fastlmm import FaSTLMM
79
from gwas.null_model.ml import MaximumLikelihood
@@ -11,7 +13,6 @@
1113
ProfileMaximumLikelihood,
1214
)
1315
from gwas.null_model.reml import RestrictedMaximumLikelihood
14-
from jax import numpy as jnp
1516

1617
from ..utils import assert_both_close, check_bias, check_types
1718
from .rmw_debug import RmwDebug

src/gwas/tests/score/test_pheno.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import numpy as np
22
import pandas as pd
3-
from gwas.mem.wkspace import SharedWorkspace
4-
from gwas.pheno import VariableCollection
53
from numpy.testing import assert_array_equal
64
from pytest import FixtureRequest
75
from upath import UPath
86

7+
from gwas.mem.wkspace import SharedWorkspace
8+
from gwas.pheno import VariableCollection
9+
910
from .simulation import missing_value_rate
1011

1112
sample_count = 100

src/gwas/tests/score/test_rmw.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
import numpy as np
44
import pytest
5+
from upath import UPath
6+
57
from gwas.compression.arr.base import (
68
FileArray,
79
compression_methods,
810
)
911
from gwas.log import logger
1012
from gwas.utils import cpu_count
11-
from upath import UPath
1213

1314
from .conftest import RmwScore
1415

src/gwas/tests/score/test_score.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
import pytest
55
import scipy
66
import seaborn as sns
7+
from matplotlib import pyplot as plt
8+
from numpy import typing as npt
9+
from upath import UPath
10+
711
from gwas.eig.base import Eigendecomposition
812
from gwas.eig.collection import EigendecompositionCollection
913
from gwas.log import logger
@@ -14,9 +18,6 @@
1418
from gwas.score.calc import calc_u_stat, calc_v_stat
1519
from gwas.utils import get_global_lock, make_sample_boolean_vectors
1620
from gwas.vcf.base import VCFFile
17-
from matplotlib import pyplot as plt
18-
from numpy import typing as npt
19-
from upath import UPath
2021

2122
from ..utils import check_bias
2223
from .conftest import RmwScore

src/gwas/tests/score/test_worker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
from gwas.eig.base import Eigendecomposition
34
from gwas.eig.collection import EigendecompositionCollection
45
from gwas.mem.arr import SharedArray

src/gwas/tests/test_arr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import numpy as np
2+
from upath import UPath
3+
24
from gwas.mem.arr import SharedArray
35
from gwas.mem.wkspace import SharedWorkspace
4-
from upath import UPath
56

67

78
def test_sa(tmp_path: UPath) -> None:

src/gwas/tests/test_eig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import numpy as np
88
import pytest
99
import scipy
10+
from upath import UPath
11+
1012
from gwas.defaults import (
1113
default_kinship_minor_allele_frequency_cutoff,
1214
default_kinship_r_squared_cutoff,
@@ -21,7 +23,6 @@
2123
from gwas.tri.tsqr import scale
2224
from gwas.utils import cpu_count, get_global_lock
2325
from gwas.vcf.base import VCFFile
24-
from upath import UPath
2526

2627
from .conftest import chromosomes
2728

src/gwas/tests/test_matrix_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np
22
import pytest
3+
34
from gwas._matrix_functions import dgesvdq, dimatcopy, set_tril, set_triu
45

56

src/gwas/tests/test_tri.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
import numpy as np
44
import pytest
5+
from numpy import typing as npt
6+
from upath import UPath
7+
58
from gwas.mem.wkspace import SharedWorkspace
69
from gwas.tri.base import Triangular, is_lower_triangular
710
from gwas.tri.tsqr import scale
811
from gwas.utils import cpu_count
912
from gwas.vcf.base import VCFFile
10-
from numpy import typing as npt
11-
from upath import UPath
1213

1314
sample_size_label = "large"
1415
chromosome = 22

src/gwas/tests/test_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import logging
22

3+
from pytest import FixtureRequest, LogCaptureFixture
4+
from upath import UPath
5+
36
from gwas.log import (
47
logger,
58
multiprocessing_context,
69
setup_logging,
710
teardown_logging,
811
)
912
from gwas.utils import Process
10-
from pytest import FixtureRequest, LogCaptureFixture
11-
from upath import UPath
1213

1314

1415
class LogProcess(Process):

src/gwas/tests/test_var.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
import numpy as np
55
import pytest
66
import scipy
7+
from jax import numpy as jnp
8+
79
from gwas.log import logger
810
from gwas.null_model.ml import MaximumLikelihood
911
from gwas.null_model.pml import (
1012
OptimizeInput,
1113
ProfileMaximumLikelihood,
1214
)
1315
from gwas.null_model.reml import RestrictedMaximumLikelihood
14-
from jax import numpy as jnp
1516

1617

1718
@pytest.mark.parametrize(

src/gwas/tests/test_vcf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
import numpy as np
55
import pandas as pd
66
import pytest
7+
from pytest_benchmark.fixture import BenchmarkFixture
8+
from upath import UPath
9+
710
from gwas.mem.wkspace import SharedWorkspace
811
from gwas.testing.convert import convert_vcf_to_bgen
912
from gwas.tools import plink2
1013
from gwas.vcf.base import Engine, VCFFile
11-
from pytest_benchmark.fixture import BenchmarkFixture
12-
from upath import UPath
1314

1415
from .conftest import ReadResult
1516
from .utils import check_bias

src/gwas/tests/test_wkspace.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import numpy as np
22
import pytest
3+
from numpy import typing as npt
4+
35
from gwas.mem.arr import SharedArray
46
from gwas.mem.wkspace import SharedWorkspace
5-
from numpy import typing as npt
67

78

89
def test_sw_merge() -> None:

src/gwas/tests/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
import numpy as np
44
import scipy
5-
from gwas.log import logger
65
from jaxtyping import jaxtyped
76
from numpy import typing as npt
87
from typeguard import typechecked as typechecker
98

9+
from gwas.log import logger
10+
1011
check_types = partial(jaxtyped, typechecker=typechecker)
1112

1213

0 commit comments

Comments
 (0)