Skip to main content

Convert PED pedigree files to Pedigree Studio session JSON

Project description

ped2studio

Convert standard PED pedigree files into Pedigree Studio session JSON files.

Installation

pip install ped2studio

Or use the standalone script (ped2studio_standalone.py) with no installation required — it needs only Python 3.9+.

Usage

Command line

# Basic conversion (default: full solid black fill for affected)
ped2studio family.ped family.json

# Use a specific colour for affected individuals
ped2studio family.ped family.json --colour "#c0392b"

# Use left-half fill instead of full shape
ped2studio family.ped family.json --fill half

# Combine half fill with a colour
ped2studio family.ped family.json --fill half --colour "#c0392b"

# Use shading pattern instead of colour
ped2studio family.ped family.json --shading --pattern stripes

# Use half-shape dot shading
ped2studio family.ped family.json --shading --pattern dots --fill half

Python API

import ped2studio

# From a PED string (default: full solid black)
session = ped2studio.convert(ped_text)

# From file to file
ped2studio.convert_file("family.ped", "family.json")

# With options
session = ped2studio.convert(
    ped_text,
    affected_color="#c0392b",   # colour for affected (when not using shading)
    fill_type="half",           # 'full' or 'half'
    use_shading=True,           # use pattern instead of colour
    shading_pattern="stripes",  # 'stripes' or 'dots'
)

Standalone script

python ped2studio_standalone.py family.ped family.json
python ped2studio_standalone.py family.ped family.json --fill half --colour "#c0392b"
python ped2studio_standalone.py family.ped family.json --shading --pattern dots --fill half

PED file format

The tool reads the standard 6-column PED format:

FamilyID  IndividualID  FatherID  MotherID  Sex  Phenotype
Column Description
FamilyID Family identifier (preserved but not used for grouping)
IndividualID Unique identifier for the individual
FatherID Father's IndividualID, or 0 if unknown
MotherID Mother's IndividualID, or 0 if unknown
Sex 1 = male, 2 = female, 0 = unknown
Phenotype 2 = affected, 1 = unaffected, 0 or -9 = unknown

Additional columns beyond column 6 (e.g. genotype data) are ignored. Lines starting with # are treated as comments. Both tab and space delimiters are supported.

How it works

  1. Parse the PED file into individuals with parent references
  2. Build mating units (each unique father+mother pair with their children)
  3. Assign generations (founders = generation 0, children = max parent generation + 1)
  4. Layout individuals using Pedigree Studio's default spacing (partner gap = 104px, child height = 130px, sibling spacing = 104px)
  5. Emit a Pedigree Studio v4 session JSON with persons, partnerships, child links, and legend

The output can be imported directly into Pedigree Studio via the Import JSON button. Positions may need manual adjustment for complex pedigrees.

Mapping to Pedigree Studio features

PED field Pedigree Studio feature
Sex = 1 male shape (square)
Sex = 2 female shape (circle)
Sex = 0 unknown shape (diamond)
Phenotype = 2 Solid colour fill, half colour fill, or shading pattern (configurable via --fill, --color, --shading, --pattern)
Phenotype = 1 No fill
Father+Mother pair Partnership line
Child of a pair Child link from partnership to individual

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ped2studio-0.1.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ped2studio-0.1.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file ped2studio-0.1.1.tar.gz.

File metadata

  • Download URL: ped2studio-0.1.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for ped2studio-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9b9a0b64a6540b2c75b4470c1575e974f78aebb39af95ec2674630809f00902f
MD5 92a165b197b1770fdc7e582061cd4fbc
BLAKE2b-256 0d0142230bc23c5e9966d5d7b05d2360bac8d015d9fd2f0caaed7323e15cd95a

See more details on using hashes here.

File details

Details for the file ped2studio-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ped2studio-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for ped2studio-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c04b87622b902ed7359d904cc97b3f0151f897d446271dd58405acd22512ae0d
MD5 d83a92485dfcfb2896d4d941f31d7477
BLAKE2b-256 15075220e9042f66f3d3afd1cc672d09dee37002bcf50026a267be920cefa2cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page