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
- Parse the PED file into individuals with parent references
- Build mating units (each unique father+mother pair with their children)
- Assign generations (founders = generation 0, children = max parent generation + 1)
- Layout individuals using Pedigree Studio's default spacing (partner gap = 104px, child height = 130px, sibling spacing = 104px)
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ped2studio-0.1.0.tar.gz.
File metadata
- Download URL: ped2studio-0.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca6f57b582f5fa98a77b20b7bdf8c704b6e39aa8f428e9534484e9fe0fce0c64
|
|
| MD5 |
f7c801c5e5701fb025a605e3acb25af3
|
|
| BLAKE2b-256 |
3927fcd087a24150c83e8ce1a0d7237a36649d73463cafc89da409eaeca0eca4
|
File details
Details for the file ped2studio-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ped2studio-0.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c86408eb3e450354a62b2935fe9c39d235c7fac1727a55fa9592bae8e2296c4
|
|
| MD5 |
af3a214cd7f7327a39feb330d3b94bca
|
|
| BLAKE2b-256 |
3b9a55d78c70ec46d53aed39e230cf70f5ee5f244414cd328a878d06063b9175
|