Details for Sense Of Smell and 23andMe data (Known SNP).ipynb

Published by dnvrdavid

Description

This notebook explores the connection between genetics and sense of smell using one SNP known to be associated with floral scents.

1

Tags & Data Sources

smell rs6591536 23andMe Upload

Comments

Please log in to comment.

Notebook
Last updated 5 months, 1 week ago

Sense of Smell and 23andMe data (Known SNP)

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

Do people with genotypes like yours for a well known SNP have a similar smell sensitivity as you?

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: https://www.openhumans.org/activity/23andme-upload/

How it works

This compares your data to people participating in openSNP, where people have publicly shared genetic data along with responses to surveys - including one about sense of smell.

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

The notebook uses a single genetic location (rs6591536, known to be associated with sense of smell) and reported phenotypes from openSNP.

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 that is stored in Open Humans.

In [4]:
import os
import requests
import tempfile

print("Checking for 23andMe data in Open Humans...\n")

response = requests.get(
    "https://www.openhumans.org/api/direct-sharing/project/exchange-member/"
    "?access_token={}".format(os.environ.get('OH_ACCESS_TOKEN')))
for entry in response.json()['data']:
    if entry['source'] == "direct-sharing-128" and 'vcf' not in entry['metadata']['tags']:
        file_url_23andme = entry['download_url']
        break
        
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: https://www.openhumans.org/activity/23andme-upload/")
else:
    print("Great, you have 23andMe data in Open Humans! We'll retrieve this...\n")

file_23andme = tempfile.NamedTemporaryFile()
file_23andme.write(requests.get(file_url_23andme).content)
file_23andme.flush()

print("Done!")
Checking for 23andMe data in Open Humans...

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

Done!

Step 2: Find your data at the SNP location.

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

This notebook's smell sensitivity prediction method uses data from SNP location rs6591536. Individuals with genotype (A;A) are two orders of magnitude less able to detect floral scents (Beta-Ionone) than carriers of one or two 'G' alleles on this SNP. One study found that 96% of phenotypic variation is due to this one SNP. PUBMED 23910657 article

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

In [5]:
snps = {
    'rs6591536': None
}

file_23andme.seek(0)
for line in file_23andme:
    line = line.decode('utf-8').strip()
    if line.startswith('#'):
        continue
    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['rs6591536']))
rs6591536:	GG

Get an openSNP summary for your genotype

Summary statistics were generated using data downloaded from openSNP for various self-reported levels of smell sensitivity. Since it is known that having one or two 'G' alleles on rs6591536 allows detection of floral fragrance at much lower levels than having two 'A' alleles Ref: SNPedia, these results are one way to test the significance of rs6591536 in overall sense of smell. (Note: 'Above Average' data was consolidated into the 'Average' category in openSNP.)

For preliminary results using all available SNPs, see Notebook: Sense Of Smell and openSNP Data (New SNPs)

In [6]:
twoString = r'''
   14.4% ( 19 of 132) of people observed on openSNP had two "floral" alleles (GG) for SNP rs6591536.
   
Of those:
      47.4% reported     Average sense of smell
      21.1% reported  SuperPower sense of smell
      15.8% reported        Poor sense of smell
      10.5% reported        Good sense of smell
       5.3% reported       Great sense of smell
       0.0% reported LessWithAge sense of smell'''
oneString = r'''
   45.5% ( 60 of 132) of people observed on openSNP had one "floral" allele (AG) for SNP rs6591536.
   
Of those:
      48.3% reported     Average sense of smell
      15.0% reported  SuperPower sense of smell
      13.3% reported        Good sense of smell
      11.7% reported        Poor sense of smell
       6.7% reported       Great sense of smell
       5.0% reported LessWithAge sense of smell'''
zeroString = r'''
   40.2% ( 53 of 132) of people observed on openSNP had no "floral" alleles (AA) for SNP rs6591536.
   
Of those:
      49.1% reported     Average sense of smell
      18.9% reported       Great sense of smell
      11.3% reported        Poor sense of smell
       9.4% reported        Good sense of smell
       7.5% reported  SuperPower sense of smell
       3.8% reported LessWithAge sense of smell'''
summaries = [zeroString, oneString, twoString]
for snp in snps.keys():
     if snp == 'rs6591536':
            matchCount = snps[snp].count('G')
            print ('As of 17 June 2018...')
            print (summaries[matchCount])
As of 17 June 2018...

   14.4% ( 19 of 132) of people observed on openSNP had two "floral" alleles (GG) for SNP rs6591536.
   
Of those:
      47.4% reported     Average sense of smell
      21.1% reported  SuperPower sense of smell
      15.8% reported        Poor sense of smell
      10.5% reported        Good sense of smell
       5.3% reported       Great sense of smell
       0.0% reported LessWithAge sense of smell
In [ ]: