Skip to content

Commit

Permalink
fix doctest imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nebfield committed Dec 6, 2024
1 parent 4e6153f commit f23e044
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pgscatalog.core/src/pgscatalog/core/lib/scorefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ScoringFile:
You can make ``ScoringFiles`` with a path to a scoring file with minimal metadata:
>>> from pgscatalog.core.lib.genomebuild import GenomeBuild
>>> from pgscatalog.core.lib._config import Config
>>> sf = ScoringFile(Config.ROOT_DIR / "tests" / "data" / "custom.txt")
>>> sf # doctest: +ELLIPSIS
ScoringFile('.../custom.txt', target_build=None)
Expand Down Expand Up @@ -207,6 +208,7 @@ def variants(self) -> Generator[ScoreVariant, None, None]:
if a local file is available (i.e. after downloading). Always available for
class instances that have a valid local path.
>>> from pgscatalog.core.lib._config import Config
>>> testpath = Config.ROOT_DIR / "tests" / "data" / "PGS000802_hmPOS_GRCh37.txt"
>>> sf = ScoringFile(testpath)
>>> for variant in sf.variants:
Expand Down Expand Up @@ -291,7 +293,8 @@ def normalise(
Takes care of quality control.
>>> from ..lib import GenomeBuild
>>> from pgscatalog.core.lib import GenomeBuild
>>> from pgscatalog.core.lib._config import Config
>>> testpath = Config.ROOT_DIR / "tests" / "data" / "PGS000001_hmPOS_GRCh38.txt.gz"
>>> variants = ScoringFile(testpath).normalise()
>>> for x in variants: # doctest: +ELLIPSIS
Expand Down Expand Up @@ -359,6 +362,7 @@ def read(self) -> Iterator[csv.DictReader]:
This method must be called with a context manager:
>>> from pgscatalog.core.lib._config import Config
>>> testpath = Config.ROOT_DIR / "tests" / "data" / "PGS000802_hmPOS_GRCh37.txt"
>>> sf = ScoringFile(testpath)
>>> with sf.read() as reader:
Expand Down Expand Up @@ -396,6 +400,7 @@ def read_variants(self) -> Generator[ScoreVariant, None, None]:
ScoreVariants are pydantic models with data validation (PGS Catalog standards)
>>> from pgscatalog.core.lib._config import Config
>>> testpath = Config.ROOT_DIR / "tests" / "data" / "PGS000802_hmPOS_GRCh37.txt"
>>> sf = ScoringFile(testpath)
>>> variants = sf.read_variants()
Expand Down

0 comments on commit f23e044

Please sign in to comment.