popoolaon - storage.googleapis.com · calculate natural variaon for genes (allows subsequent go...

45
PoPoola%on Es%ma%ng natural varia%on in pooled popula%ons using next genera%on sequencing

Upload: others

Post on 25-Oct-2019

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

PoPoola%on

Es%ma%ngnaturalvaria%oninpooledpopula%onsusingnextgenera%on

sequencing

Page 2: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

WhatcanyoudowithPoPoola%on?

Page 3: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Genomewideoverviewofnaturalvaria%on;example:PiinD.mel.

Page 4: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Detailedinspec%onofcandidategenes;exampleCyp6g1inD.mel.

Page 5: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Calculatedivergencebetweenspecies

Page 6: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Calculatenaturalvaria%onforgenes(allowssubsequentGOanalysis)

Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327 CG8877-RA 17 0.985 0.001175603 CG13159-RA 1 1.000 0.001213136 CG8290-RB 12 0.987 0.001254184 CG8841-RC 9 0.859 0.001480358 CG8857-RA 4 0.981 0.001549875

Page 7: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Introduc%on

Page 8: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Quickupdateonposi%veselec%on

Whenanalleleincreasesinitspopula%onfrequency,nearbyvariantsalsoincreaseinitsfrequency‐>“Hitchhiking”

Thisleadstoaselec%vesweepwhicherasesvaria%onaroundaposi%velyselectedallele

Source: Sabeti P.C. et al. (2006) – Positive Natural Selection in the Human Lineage Robert Kofler

Page 9: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

ASerthesweepNewmuta%onsappearandrestorediversity,buttheyappear

veryslowly(muta%onsarerare)andtheyareini%allyoflowfrequency.

Positive selection thus creates a signature consisting of a region of low overall diversity with an excess of rare alleles => rare alleles are very important (SNP identification) -> Low Tajima’s D

Of course there are many more signatures of positive selection, like the proportion of functional change (McDonald Kreitman Test), length of the haplotypes (iHS and linkage disequilibrium) or differences in allele frequencies between populations (Fst)

Page 10: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

PoPoola%oncurrentlycalculates:

•  TajimasPi•  WaWersonsTheta

•  Tajima’sD

Page 11: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

MajorrequirementforPoPoola%on:

Apooledpopula%on!Disclaimer:Iexpectittoworkwithsequencedindividualsaswell,butIhavenottestedthis

Page 12: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Twomajorstrategiesforpopula%ongenomics

Page 13: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Whypooling?ProsandCons

Pros: •  More cost effective (less sequencing is required) •  Bioinformatics analysis is simpler (in my opinion..) •  Standard population genetic estimator’s (Tajima’s D) may easily be

assessed Cons: •  Haplotype information is not available •  All individuals should contribute equal amount of DNA!!•  Illumina reads have a high error rate it is necessary to introduce

minimum allele counts -> loosing singletons, doubletons etc •  thus: Pooling requires a correction of standard Population

Genetics estimators like Tajima’s π ( missing singletons and multiple samplings of identical sequences)

Page 14: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Wedevelopedcorrec%onfactorsforsomepopula%ongene%ces%mators:egTajima’sD

see also: Schloetterer and Futschik (2010):Massively Parallel Sequencing of Pooled DNA Samples--The Next Generation of Molecular Markers.

Page 15: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

PoPoola%onoverview

PoPoolation implements these correction factors

Genome wide pattern of variability may be assessed

Recent positive selection may be identified

Page 16: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Valida%ngPoPoola%on

Page 17: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Valida%onofPoPoola%onusingsimulateddata

•  SimulatedTajima’sPialongachromosomeofD.melanogasterusingms

•  Wecreatedar%ficialreadsandintroducedsequencingerrors

•  Wefedthesear%ficialreadsintothePoPoola%onpipeline

•  WecomparedtheobservedwiththeexpectedTajima’sPi

Page 18: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

DifferencebetweentheobservedandtheexpectedTajima’sPi

⇒  low error rate of 0.1% is necessary and a mac >=2 ⇒  Illumina has an error rate of ~1%

Page 19: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Howtodecreasetheerrorrate

•  Trimmingofreads;removelowqualitystretches

•  Requireaminimumquality

•  Requireaminimumallelecount(mac)

Page 20: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

TrimmingalgorithmofPoPoola%on

=>The algorithm finds the highest scoring substring of the read =>Individual bases may even be below the quality threshold, as long as a new high score can be achieved =>The algorithm is very similar to dynamic programming (Smith-Waterman) => handles single end as well as paired end reads!!

Page 21: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Trimmingsta%s%cwithdifferentqualitythresholds

Page 22: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Qualityandminorallelecount

Page 23: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Iden%fica%onoffalseposi%veSNPsusingPhiXandPoPoola%on

Page 24: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

novelerrorrate(aSertrimmingandqualitycontrol)•  Remember:therequirederrorrateis0.1‐0.2%•  Remember:Illuminahasanerrorrateof~1%

•  Trimmingandtherequirementforaminimumqualitydrama%callyreducetheerrorrate:

trim min.qual. Error rate 20 0 0.15% 20 20 0.07%

=> Error rate is sufficiently reduced by trimming and minimum quality

Page 25: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

DifferencebetweentheobservedandtheexpectedTajima’sPi

⇒  low error rate of 0.1% is necessary and a mac >=2 ⇒  Illumina has an error rate of ~1%

Page 26: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Influenceofcoverageandwindowsize

•  Wesequencechromosome3RofD.melto100xcoverage

•  Werandomlydrewasubsetsofthereadstoachievevaryingcoverages(5x‐>90x)

•  WecomparedPiofthesubset(eg.cov.:10x)withthePiofthefulldataset(cov.:100x)

•  Furthermoreweuseddifferentwindowsizes

Page 27: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Influenceofcoverageandwindowsize(averageof2000windows)

Page 28: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Walktrough

Page 29: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Precondi%ons:•  MacorLinux(Unix)

•  PerlandRinstalled•  bwa(Burrows‐WheelerAlignmentTool)•  samtools

•  IGV(Integra%veGenomicsViewer)•  PoPoola%on1.016hWp://code.google.com/p/popoola%on

=>bwaandsamtoolsneedtobeinthe$PATH

Page 30: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Getthedata:

Webpage:hWp://code.google.com/p/popoola%on

goto‘Downloads’anddownload:

popool‐teaching.sh

teaching‐data.zip

Page 31: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Prepara%ons:

•  Unzipteaching‐data.zip•  copythefilepopool‐teaching.shintotheunzipedfolder(data)

•  enterthecommandline

•  changedirectoryintotheunzipedfolder

Page 32: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Trimming

Enterthecommand:perl <local-popoolation-installation>/basic-

pipeline/trim-fastq.pl --input1 read_1.fastq --input2 read_2.fastq --output trim --quality-threshold 20 --min-length 50

<local‐popoola%on‐installa%on>...thisisthepathtoyourcopyofpopoola%on

e.g.:/Users/robertkofler/dev/popoola%on‐1.016

Page 33: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Trimsta%s%cs

Page 34: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Preparethereferencesequenceformapping

Commandline:mkdir wg mv dmel-2R-chromosome-r5.22.fasta wg awk '{print $1}' wg/dmel-2R-chromosome-r5.22.fasta >

wg/dmel-2R-short.fa bwa index wg/dmel-2R-short.fa

akw ‘{print $1}’ .. this only prints the first column. For a fasta file this removes anything after the first space. Therefore this command shortens the header for example: >2R name=blabla id=12345 transposons=many will be shortend to >2R => more reliable for mapping and downstream processing

Page 35: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

mappingusing‘BWA’

commandline:bwa aln wg/dmel-2R-short.fa trim_1 > trim_1.sai bwa aln wg/dmel-2R-short.fa trim_2 > trim_2.sai bwa sampe wg/dmel-2R-short.fa trim_1.sai trim_2.sai

trim_1 trim_2 > maped.sam

thesearesubotpimalparametersaswedonotwanttowaittherestofthedayforthemappingtofinish!

forop%malresultswerecommendthefollowing:bwa aln -l 100 -o 2 -d 12 -e 12 -n 0.01 wg/dmel-2R-

short.fa trim_1 > trim_1.sai

Page 36: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Checkthesam‐file

Commandline:less maped.sam

Page 37: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

createapileupfile

Firstremoveambiguouslymappedreads(minimummappingquality20)andcreateasortedbam‐file:

samtools view -q 20 -bS maped.sam| samtools sort - maped.sort

Thancreateapileupfile:samtools pileup maped.sort.bam > cyp6g1.pileup

Controlthepileupfile:less cyp6g1.pileup

Page 38: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

pileup?

Page 39: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

CalculateTajima’sPiusingaslidingwindowapproach

firstcheckouttheop%ons:perl <local-popoolation-installation>/Variance-

sliding.pl --help

andrunthetests(sanitycontrol):perl <local-popoolation-installation>/Variance-

sliding.pl --test

thancalculateTajima’sPiperl <local-popoolation-installation>/Variance-

sliding.pl --measure pi --input cyp6g1.pileup --min-count 2 --min-qual 20 --min-coverage 4 --max-coverage 70 --pool-size 500 --window-size 1000 --step-size 1000 --output cyp6g1.varslid.pi --region 2R:7800000-8300000

Page 40: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Output:

less cyp6g1.varslid.pi

Page 41: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

PrepareoutputforIGV

Commandline:perl <local-popoolation-installation>/

VarSliding2Wiggle.pl --input cyp6g1.varslid.pi --output cyp6g1.pi.wig --trackname "nat-pop-pi”

Indexthebamfile:samtools index maped.sort.bam

Whynotdirectlyawiggleasoutput??

youlooseinforma%oninwiggle,e.g.:snpcountorcoveredfrac%on

Page 42: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

VisualizeinIGV

•  openIGV(./igv_mac-intel.command)•  File‐>ImportGenome...Name:dmel‐2rSequenceFile:dmel‐short.fa

•  File‐>LoadfromFile...cyp6g1.gsmaped.sort.bamcyp6g1.pi.wig

Page 43: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Biology!HereIcome..

Page 44: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

Youmaytrythisathome!

TheWebPagecontainsthefullguide:

hWp://code.google.com/p/popoola%on/wiki/TeachingPoPoola%on

Page 45: PoPoolaon - storage.googleapis.com · Calculate natural variaon for genes (allows subsequent GO analysis) Gene ID SNPs cov-frac Tajima's Pi CG8493-RB 2 0.940 0.001171327

$PATH

vitheconfigfileforyourshell

BASH:~/.bash_profile

ZSH:~/.zshrc

addthefollowinglineadaptedtoyoursystem:

exportPATH=/Users/robertkofler/programs/bwa‐0.5.7:/Users/robertkofler/programs/samtools‐0.1.7_i386‐darwin:$PATH

loadthenewconfigura%on:

source~/.zshrc

test:

bwa