gpf.tools package
Submodules
gpf.tools.dae2vcf module
gpf.tools.dataset_helpers module
- class gpf.tools.dataset_helpers.DatasetHelpers(gpf_instance: GPFInstance | None = None)[source]
Bases:
objectHelper class for work with studies in impala genotype storage.
- disable_study_config(dataset_id: str, *, dry_run: bool | None = None) None[source]
Disable dataset.
- find_genotype_data_config(dataset_id: str) Box | None[source]
Find and return configuration of a dataset.
- find_genotype_data_config_file(dataset_id: str) str | None[source]
Find and return config filename for a dataset.
- get_genotype_storage(dataset_id: str) GenotypeStorage | None[source]
Find the genotype storage that stores a dataset.
gpf.tools.denovo2vcf module
gpf.tools.draw_pedigree module
Tool to draw pedigrees defined in a file.
- gpf.tools.draw_pedigree.build_families_report(families: FamiliesData) FamiliesReport[source]
Build a family report based on affected status.
- gpf.tools.draw_pedigree.draw_families(families: FamiliesData) Generator[Figure, None, None][source]
Draw families.
- gpf.tools.draw_pedigree.draw_families_report(families: FamiliesData) Generator[Figure, None, None][source]
Draw families from families report.
gpf.tools.families_withdrawal_common module
Shared helpers for the families-withdrawal CLI tools.
Two purpose-specific tools build on this module:
families_withdrawal_genotypesrewrites the pedigree Parquet file of aduckdb_parquetgenotype study via DuckDB (the family-variant files are left untouched; withdrawn families become inaccessible at query time).families_withdrawal_phenotypesremoves families from a phenotype study via SQLDELETE.
Both back up every file they modify by default. A backup is an in-place
sibling named <stem>.<stamp>.<ext>.bak where <stamp> is a single
UTC timestamp shared across every file modified in one run. To restore a
backup manually, move (or copy) it back over the original, e.g.:
mv pedigree.20260625T143000Z.parquet.bak pedigree.parquet
cp test_pheno.20260625T143000Z.db.bak test_pheno.db
The terminal .bak suffix keeps backups out of the *.parquet scan,
so a study can be processed repeatedly without re-processing prior backups.
- gpf.tools.families_withdrawal_common.backup_path(path: Path, stamp: str) Path[source]
Return the
<stem>.<stamp>.<ext>.baksibling of path.stemis the filename without its final extension andextis the final suffix (without the leading dot). The terminal.bakkeeps the backup out of any*.parquetglob scan.
- gpf.tools.families_withdrawal_common.build_arg_parser(description: str) ArgumentParser[source]
Build the argument parser shared by both families-withdrawal tools.
- gpf.tools.families_withdrawal_common.make_run_stamp() str[source]
Return a single UTC stamp for one run, e.g.
20260625T143000Z.
- gpf.tools.families_withdrawal_common.require_study_kind(gpf_instance: GPFInstance, study_id: str, *, kind: Literal['genotypes', 'phenotypes']) None[source]
Validate that study_id is of the expected kind.
Exits with code 1 if the study is of the other kind (pointing at the matching tool) or if it is unknown to the instance entirely.
gpf.tools.families_withdrawal_genotypes module
CLI tool to withdraw families from a duckdb_parquet genotype study.
Only the study’s pedigree Parquet file is rewritten (via DuckDB), dropping
every row whose family ID is one of the requested families. The family-variant
Parquet files are deliberately left untouched: at query time a family-variant
row whose family is absent from the pedigree is simply skipped, so the
withdrawn families’ variants become inaccessible without rewriting the (large)
variant files. Summary-variant frequencies/counts and cached artifacts
(common reports, denovo gene sets, family counts) are NOT recomputed —
regenerate them with the dedicated tools (e.g. generate_common_report)
if needed.
By default the pedigree is backed up first, as an in-place sibling named
<stem>.<stamp>.<ext>.bak, e.g. pedigree.20260625T143000Z.parquet.bak.
Pass --no-backup to skip the backup, or --dry-run to report the
intended row changes without touching any file. To restore a backup manually,
move it back over the original:
mv pedigree.20260625T143000Z.parquet.bak pedigree.parquet
- gpf.tools.families_withdrawal_genotypes.main(argv: list[str] | None = None, *, gpf_instance: GPFInstance | None = None) None[source]
Remove families from a duckdb_parquet genotype study.
gpf.tools.families_withdrawal_phenotypes module
CLI tool to withdraw families from a phenotype study.
The phenotype PhenoDb is updated via SQL DELETE of every person,
instrument-value row, and family record belonging to the requested families.
By default the database file is backed up first, as an in-place sibling named
<stem>.<stamp>.<ext>.bak (one shared UTC stamp per run), e.g.
test_pheno.20260625T143000Z.db.bak. Pass --no-backup to skip the
backup, or --dry-run to report the intended row changes without touching
the database. To restore a backup manually, copy it back over the original:
cp test_pheno.20260625T143000Z.db.bak test_pheno.db
- gpf.tools.families_withdrawal_phenotypes.main(argv: list[str] | None = None, *, gpf_instance: GPFInstance | None = None) None[source]
Remove families from a phenotype study.
gpf.tools.generate_common_report module
- gpf.tools.generate_common_report.main(argv: list[str] | None = None, *, gpf_instance: GPFInstance | None = None) None[source]
Command line tool to generate dataset statistics.
gpf.tools.generate_denovo_gene_sets module
- gpf.tools.generate_denovo_gene_sets.main(argv: list[str] | None = None, *, gpf_instance: GPFInstance | None = None) None[source]
Generate denovo gene sets CLI.
gpf.tools.gpf_convert_study_config module
- gpf.tools.gpf_convert_study_config.load_study_config(study_config_filename: str) dict[source]
Load study config.
- gpf.tools.gpf_convert_study_config.main(gpf_instance: GPFInstance | None = None, argv: list[str] | None = None) None[source]
Convert GPF genotype data configuration to YAML.
gpf.tools.gpf_validation_runner module
- class gpf.tools.gpf_validation_runner.AbstractRunner(expectations: dict[str, Any], gpf_instance: GPFInstance)[source]
Bases:
objectThe base class for test runners.
- counter(status: TestStatus) int[source]
- property error_case_count: int
- property failed_case_count: int
- property passed_case_count: int
- class gpf.tools.gpf_validation_runner.BaseGenotypeBrowserRunner(expectations: dict[str, Any], gpf_instance: GPFInstance)[source]
Bases:
AbstractRunnerBase class for Genotype Browser Runners.
- class gpf.tools.gpf_validation_runner.GenotypeBrowserRunner(expectations: dict[str, Any], gpf_instance: GPFInstance, *, detailed_reporting: bool, skip_columns: set)[source]
Bases:
BaseGenotypeBrowserRunnerRun Genotype Browser tests.
- class gpf.tools.gpf_validation_runner.MainRunner(gpf_instance: GPFInstance, outfilename: str, *, detailed_reporting: bool, skip_columns: list[Any])[source]
Bases:
objectMain runner.
- static collect_expectations(expectations: str) Iterator[dict[str, Any]][source]
Collect expectations.
- counter(status: TestStatus) int[source]
- property errors_case_count: int
- property failed_case_count: int
- make_validation_runner(expectations: dict[str, Any]) GenotypeBrowserRunner[source]
Create a validation runner.
- property passed_case_count: int
- static store_junit_results(runners: list[AbstractRunner], outfilename: str) None[source]
Store junit results.
- class gpf.tools.gpf_validation_runner.TestResult(expectation: dict[str, Any] | None = None, case: dict[str, Any] | None = None, test_for: str | None = None, params: dict[str, Any] | None = None, result: str | None = None)[source]
Bases:
objectEncapsulate the result of a test.
- class gpf.tools.gpf_validation_runner.TestStatus(*values)[source]
Bases:
Enum- ERROR = 4
- FAIL = 2
- NOTSET = 0
- PASSED = 1
- class gpf.tools.gpf_validation_runner.TestSuite(study: str, target: str, name: str)[source]
Bases:
objectA collection of tests.
- append(case: TestResult) None[source]
- cases: list[TestResult]
gpf.tools.liftover_tools module
- class gpf.tools.liftover_tools.CNVLiftoverTool[source]
Bases:
LiftoverToolCNV liftover tool class.
- class gpf.tools.liftover_tools.DaeLiftoverTool[source]
Bases:
LiftoverToolDAE liftover tool class.
- class gpf.tools.liftover_tools.DenovoLiftoverTool[source]
Bases:
LiftoverToolDenovo liftover tool class.
- class gpf.tools.liftover_tools.LiftoverTool(description: str, default_output: str)[source]
Bases:
ABCLiftover tools base class.
- build_liftover_pipeline(grr: GenomicResourceRepo) AnnotationPipeline[source]
Build liftover annotator based on the selected mode.
- class gpf.tools.liftover_tools.VCFLiftoverTool[source]
Bases:
LiftoverToolVCF liftover tool class.
- gpf.tools.liftover_tools.cnv_liftover_main(argv: list[str] | None = None, grr: GenomicResourceRepo | None = None) None[source]
CNV liftover tool main function.
- gpf.tools.liftover_tools.dae_liftover_main(argv: list[str] | None = None, grr: GenomicResourceRepo | None = None) None[source]
DAE liftover tool main function.
gpf.tools.ped2ped module
Tool to convert pedigree file into cannonical GPF pedigree file.
gpf.tools.reannotate_instance module
- class gpf.tools.reannotate_instance.ReannotateInstanceTool(raw_args: list[str] | None = None, *, gpf_instance: GPFInstance | None = None)[source]
Bases:
objectAnnotation tool to reannotate the configured GPF instance
gpf.tools.simple_study_import module
- gpf.tools.simple_study_import.build_import_project(args: Namespace, gpf_instance: GPFInstance) ImportProject[source]
Build an import project based on the CLI arguments.
- gpf.tools.simple_study_import.cli_arguments(dae_config: Box, argv: list[str] | None = None) Namespace[source]
Create and return CLI arguments parser.
- gpf.tools.simple_study_import.main(argv: list[str] | None = None, gpf_instance: GPFInstance | None = None) None[source]
Run the simple study import procedure.
gpf.tools.vcf2tsv module
gpf.tools.verify_parquet module
Tool to verify file-level structural integrity of parquet files.
- class gpf.tools.verify_parquet.FileResult(path: str, ok: bool, error_class: str | None = None, message: str | None = None, row_group: int | None = None)[source]
Bases:
objectOutcome of verifying a single parquet file.
- error_class: str | None = None
- message: str | None = None
- ok: bool
- path: str
- row_group: int | None = None
- gpf.tools.verify_parquet.main(argv: list[str] | None = None) int[source]
CLI entry point. Returns process exit code.
- gpf.tools.verify_parquet.verify_parquet_file(path: str, *, deep: bool = False) FileResult[source]
Verify file-level structural integrity of a single parquet file.
Default check opens the file and parses footer + row-group metadata.
deep=Trueadditionally decodes every row group, catching data-page corruption that the metadata pass cannot see.