Details for 23andme-preeclampsia.ipynb

Published by M_P


Checks one SNP associated with preeclampsia


Tags & Data Sources

pregnancy 23andMe Upload


Please log in to comment.

Last updated 3 months, 2 weeks ago

Eye color and 23andMe data

This notebook explores the connection between genetics and eye color. It compares your genetic data to public data from openSNP to ask this question:

Do you have the same eye color as people with a similar genotype?

Data you need

This notebook was designed to work with data from 23andMe. If you have 23andMe data, you can add it to Open Humans using this tool:

How it works

This compares your data to people participating openSNP, where people have publicly shared genetic data along with responses to surveys - including one about eye color.

(Do you have an openSNP account? You can use connect it to Open Humans!)

The notebook uses three genetic locations known to be associated with eye color: rs12913832, rs16891982, and rs12203592.

Hit "Run" to start!

Hit the "Run" button above to run each step in the code below. (Or select "Run All" from the "Cell" menu above to run everything at once.) First, we'll get your genetic data stored in Open Humans.

In [2]:
import os
import requests
import tempfile
from ohapi import api
print("Checking for 23andMe data in Open Humans...\n")

user = api.exchange_oauth2_member(os.environ.get('OH_ACCESS_TOKEN'))
for entry in user['data']:
    if entry['source'] == "direct-sharing-128" and 'vcf' not in entry['metadata']['tags']:
        file_url_23andme = entry['download_url']
if 'file_url_23andme' not in locals():
    print("Sorry, you first need to add 23andMe data to Open Humans!\n"
          "You can do that here:")
    print("Great, you have 23andMe data in Open Humans! We'll retrieve this...\n")

file_23andme = tempfile.NamedTemporaryFile()

Checking for 23andMe data in Open Humans...

Great, you have 23andMe data in Open Humans! We'll retrieve this...


Step 2: Find your data at three genetic locations.

Each line of 23andMe data represents your genetic information at a particular location, called a single nucleotide polymorphism (SNP).

This notebook's skin & color prediction method uses data from three locations. These three SNPs have been reported on as associated with eye color, and used by various eye color prediction algorithms in the literature: rs12913832, rs16891982, rs12203592.

Keep hitting "Run" to continue running the notebook. The code below will scan your data and get your genetic information at these locations.

In [4]:
snps = {
    'rs11646213': None,
for line in file_23andme:
    line = line.decode('utf-8').strip()
    if line.startswith('#'):
    line_data = line.split('\t')
    if line_data[0] in snps.keys():
        snps[line_data[0]] = line_data[3]

for snp in snps.keys():
    print('{}:\t{}'.format(snp, snps[snp] if snps[snp] else 'Unknown'))

your_genotype = ('{}'.format(snps['rs11646213']))
rs11646213:	TT