Skip to main content

Phenofhy cover

Project Status: Active Issues Purpose: Research Python 3.9 License: BSD-3-Clause DOI

Phenofhy: The Python package to process phenotype data in Our Future Health

phenofhy (pronounced, fee-no-fi) Python package for phenotype analysis in the Our Future Health (OFH) trusted research environment (TRE). phenofhy is designed to make extraction, processing, and reporting of OFH phenotype data quick and repeatable inside DNAnexus. It is user-friendly, efficient and easy to install. Built for the OFH DNAnexus trusted research environment.

Why phenofhy

  • Purpose-built for the OFH TRE and DNAnexus tooling.
  • Easily extract and preprocess phenotype data in a few lines of intuitive code.
  • Quick summaries and basic phenotype profile reporting to validate data early.

The phenofhy package is developed by Vincent Straub within the Leverhulme Centre for Demographic Science at the University of Oxford and is not affiliated with the Our Future Health research programme

Target users

  • Researchers and students wanting to get started with analysing OFH phenotypes.
  • Teams working inside the OFH TRE who need a repeatable preprocessing workflow.
  • Analysts creating quick QA summaries and phenotype profile reports before GWAS.

Environment

phenofhy is designed to run inside the OFH TRE with DNAnexus tooling and JupyterLab. It can be used on simulated data outside the TRE for local testing, but the main workflows assume access to OFH datasets and the dx toolkit.

Installation

If testing out the package locally, install the released package with pip:

python -m pip install phenofhy

For development from a source checkout:

python -m pip install -e .

Recommended runtime: Python 3.9+ (tested in OFH TRE JupyterLab).

Initialize a TRE project

To use the package inside a configured DNAnexus TRE JupyterLab session, initialize Phenofhy once for the project:

import phenofhy

phenofhy.init()

Initialization discovers the current project and dataset, extracts the OFH metadata dictionaries, uploads those files to the project, and creates a project configuration. The configuration is uploaded to the remote phenofhy/ folder. Later sessions can simply import and use Phenofhy; the configuration is downloaded automatically when it is not present locally.

Initialization requires:

  • Python 3.9 or newer;
  • the DNAnexus dx toolkit installed and authenticated;
  • DX_PROJECT_CONTEXT_ID set by the TRE environment;
  • permission to read the selected dataset and upload files to the project.

Documentation

Explore the full phenofhy documentation here: https://studiovincentstraub.github.io/phenofhy/

Where to start on the documentation website?

  • New to phenofhy or OFH phenotype analysis? Begin with "Getting Started" and then the "Quickstart" for a smooth introduction, followed by "Key Concepts".
  • Got your own data? After "Getting Started" and "Key Concepts", you are ready to dive in and start analyzing but can use the "Tutorials" to help.
  • Looking for more? Check out "API reference" to deepen your understanding and the "Community & Support" section to request features and join the discussion"

Example workflow

from phenofhy import extract, process, calculate, profile, utils

# 1) Extract a small set of fields
extract.fields(
    output_file="outputs/raw/phenos.csv",
    fields=[
        "participant.registration_year",
        "participant.registration_month",
        "participant.birth_year",
        "participant.birth_month",
        "participant.demog_sex_2_1",
        "questionnaire.smoke_status_2_1",
    ],
)

# 2) Process participant data (derives age, sex, age_group)
df = process.participant_fields("outputs/raw/phenos.csv")

# 3) Summaries
summary = calculate.summary(
    df,
    traits=["derived.age_at_registration", "derived.sex"],
    stratify="derived.sex",
)

# 4) Profile report
report = profile.phenotype_profile(
    df,
    phenotype="derived.age_at_registration",
    output="outputs/reports/age_profile.pdf",
)

# 5) Upload your results
report = utils.upload_files(
   files="outputs/reports/age_profile.pdf",
   dx_target="results"
)

Example output

Below is a phenotype profile report (using simulated data).

Phenofhy profile report

Contributing

If you find a bug or want to suggest an improvement, open an issue or start a discussion in the repository.

Metadata

Release files for phenofhy 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phenofhy 1.0.5
File Size Uploaded Provenance
phenofhy-1.0.5.tar.gz 5.0 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for phenofhy 1.0.5
File Interpreter ABI Platform
phenofhy-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 MB

Release files / phenofhy-1.0.5.tar.gz

Download URL phenofhy-1.0.5.tar.gz
Size 5.0 MB
Tags Source
SHA-256 checksum
How to use checksums
65573e0a016901e4e5c501466cf5df30eaecdef8e1065e37c22ff0cf15218745
BLAKE2b-256 checksum
How to use checksums
3e01935b95fa3606e496eccd87c5e177026789cb88007e606094e41e049645e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / phenofhy-1.0.5-py3-none-any.whl

Download URL phenofhy-1.0.5-py3-none-any.whl
Size 5.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
137a68a6d47465e9d740fd4b19bc019c558cb8e5034c01160dd60594135c1270
BLAKE2b-256 checksum
How to use checksums
9e5c6b15421b0e7a0135b6b87bbb886ac3d7d1323dd1e5b0333eae7809ddbec3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for phenofhy 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page