Skip to content

Commit ccb0cc7

Browse files
committed
sort test output to get consistent results
1 parent ef31b8d commit ccb0cc7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pgscatalog.matchlib/src/pgscatalog/matchlib/matchresult.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class MatchResults(collections.abc.Sequence):
101101
102102
Useful for making matching logs and writing scoring files ready to be used by ``plink2 --score``
103103
104-
>>> import tempfile, os, glob
104+
>>> import tempfile, os, glob, pathlib
105105
>>> from ._config import Config
106106
>>> from .variantframe import VariantFrame
107107
>>> from .scoringfileframe import ScoringFileFrame, match_variants
@@ -129,7 +129,7 @@ class MatchResults(collections.abc.Sequence):
129129
130130
By default, scoring files are written with multiple chromosomes per file:
131131
132-
>>> combined_paths = glob.glob(foutdir + "/*ALL*")
132+
>>> combined_paths = sorted(glob.glob(foutdir + "/*ALL*"), key=lambda x: pathlib.Path(x).stem)
133133
>>> combined_paths # doctest: +ELLIPSIS
134134
['.../goodmatch_ALL_additive_0.scorefile.gz', '.../goodmatch_ALL_dominant_0.scorefile.gz', '.../goodmatch_ALL_recessive_0.scorefile.gz']
135135
>>> assert len(combined_paths) == 3

pgscatalog.matchlib/src/pgscatalog/matchlib/plinkscorefiles.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ def merge(self, directory):
5151
>>> psf # doctest: +ELLIPSIS
5252
PlinkScoreFiles([PosixPath('.../goodmatch_1_additive_0.scorefile.gz'), ...])
5353
>>> psf.merge(foutdir)
54-
>>> combined_paths = glob.glob(foutdir + "/*ALL*")
54+
>>> combined_paths = sorted(glob.glob(foutdir + "/*ALL*"), key=lambda x: pathlib.Path(x).stem)
5555
>>> len(combined_paths)
5656
3
5757
>>> combined_paths # doctest: +ELLIPSIS
5858
['.../goodmatch_ALL_additive_0.scorefile.gz', '.../goodmatch_ALL_dominant_0.scorefile.gz', '.../goodmatch_ALL_recessive_0.scorefile.gz']
59+
5960
"""
6061
dataset = self._elements[0].stem.split("_")[0]
6162
for x in self._elements:

0 commit comments

Comments
 (0)