
lineage¶
tools for analyzing and exploring genetic relationships 🧬
lineage strives to be an easy-to-use and accessible open-source library for genetic genealogy
Features¶
Synthetic Data Generation¶
Generate realistic synthetic genotype data for related individuals
Create parent-child pairs with proper single-allele inheritance
Create sibling pairs with realistic meiotic recombination patterns
Supported Genotype Files¶
lineage supports all genotype files supported by snps.
Installation¶
lineage is available on the
Python Package Index. Install lineage (and its required
Python dependencies) via pip:
$ pip install lineage
Examples¶
The examples below demonstrate the core features of lineage. For detailed explanations of
genetic concepts like IBD (Identity By Descent), centiMorgans, and how to interpret results,
see the Concepts Guide.
Optional: To see file save notifications, configure logging before running examples:
import logging
logging.basicConfig(level=logging.INFO, format='%(message)s')
To try these examples, first generate some sample data:
>>> from lineage import Lineage
>>> l = Lineage()
>>> paths = l.create_example_datasets()
Load Individuals¶
Load genotype files and create Individual objects:
>>> parent = l.create_individual('Parent', paths['parent'])
>>> child = l.create_individual('Child', paths['child'])
Each Individual inherits from snps.SNPs,
providing access to all SNPs properties and methods:
>>> parent.build
37
>>> parent.assembly
'GRCh37'
>>> parent.count
899992
Find Discordant SNPs¶
Identify SNPs inconsistent with Mendelian inheritance between parent and child:
>>> discordant_snps = l.find_discordant_snps(parent, child, save_output=True)
The example datasets include a small number of simulated genotyping errors (~0.01%) to demonstrate discordant SNP detection.
Documentation¶
Documentation is available here.
Acknowledgements¶
Thanks to Whit Athey, Ryan Dale, Binh Bui, Jeff Gill, Gopal Vashishtha, CS50. This project was historically validated using data from openSNP.
lineage incorporates code and concepts generated with the assistance of various
generative AI tools (including but not limited to ChatGPT,
Grok, and Claude). ✨
License¶
lineage is licensed under the MIT License.

