ANGSD: Analysis of next generation Sequencing Data

Latest tar.gz version is (0.938/0.939 on github), see Change_log for changes, and download it here.

Major Minor: Difference between revisions

From angsd
Jump to navigation Jump to search
No edit summary
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
We allow the major and minor to be determined from either the counts of nucleotides, based on genotype likelihoods, specified by the ancestral/reference or even force both major minor to specific bases [[Sites]], which can be useful if you compare with HapMap data etc.
Many method assume that polymorphic sites are diallelic. For these methods one needs to define what is the major and minor allele. We allow the major and minor to be determined from either the counts of nucleotides, based on genotype likelihoods, specified by the ancestral/reference or even force both major minor to specific [[Sites|bases]], which can be useful if you compare with HapMap data etc.


=Brief Overview=
=Brief Overview=
<pre>
<pre>
../angsd0.567/angsd -doMajorMinor
-> angsd version: 0.910-19-g8b9b43a-dirty (htslib: 1.2.1-251-g2072527) build(Dec  4 2015 11:37:02)
-> angsd version: 0.567 build(Dec  7 2013 17:25:57)
-> Analysis helpbox/synopsis information:
-> Analysis helpbox/synopsis information:
-> Command:
./angsd -domajorminor -> Fri Dec  4 13:56:10 2015
-------------------
-------------------
analysisMajorMinor.cpp:
abcMajorMinor.cpp:
-doMajorMinor 0
-doMajorMinor 0
1: Infer major and minor from GL
1: Infer major and minor from GL
2: Infer major and minor from allele counts
2: Infer major and minor from allele counts
3: use major and minor from bim file (requires -sites afile.bim)
3: use major and minor from a file (requires -sites file.txt)
4: Use reference allele as major (requires -ref)
4: Use reference allele as major (requires -ref)
5: Use ancestral allele as major (requires -anc)
5: Use ancestral allele as major (requires -anc)
-rmTrans: remove transitions 0
-skipTriallelic 0
</pre>
</pre>


=Details=
=Details=
==From counts of data==
; -doMajorMinor 2
If you input sequencing data like the bam format you can choose to infer the major and minor allele by picking the two most frequently observed bases across individuals. This is the approach from here: [[Li2010|citation]]. To use this appraoch choose
==From genotype likelihood data==
==From genotype likelihood data==
; -doMajorMinor 1
; -doMajorMinor 1


From input for either sequencing data like bam files or from genotype likelihood data like glfv3 the major and minor allele can be inferred directly from likelihoods. We use a maximum likelihood approach to choose the major and minor alleles. Details of the method can be found in the theory section of this page and for citation use this publication [[Skotte2012]].
From input for either sequencing data like bam files or from genotype likelihood data like glfv3 the major and minor allele can be inferred directly from likelihoods. We use a maximum likelihood approach to choose the major and minor alleles. Details of the method can be found in the theory section of this page and for citation use this publication [[Skotte2012]] and is briefly described [[MajorMinor_Method|here]].


==Forcing Major/minor==
==From counts of data==
You can force the major and minor according to your reference or ancestral states if you have defined those '''-ref/-anc'''. We first estimate the major/minor from the data using '''-doMajorMinor 1/-doMajorMinor 2''', and swap these accordingly with the major we are trying to force. If that is not the case the site will be discarded from downstream analysis.
; -doMajorMinor 2
 
If you input sequencing data like the bam format you can choose to infer the major and minor allele by picking the two most frequently observed bases across individuals. This is the approach from here: [[Li2010|citation]].
=Theory=
==From Genotype Likelihoods==
Assuming that the considered site is diallelic, we infer those two alleles using the genotype likelihoods. Let <math>\{M,m\}</math> denote the two possible alleles at the diallelic site, then the maximum likelihood estimate of this pair is found using the likelihood function
 
<math>
  P(D|\{m,M\}) =  \prod_i P(D_i|\{m,M\})
=\prod_i \sum_{A_1,A_2 \in \{m,M\}} P(D_i|G=A_1A_2)p(G=A_1A_2|\{m,M\}),
</math>


where <math>P(D_i|G=A_1A_2)</math> is the genotype likelihood. We then assume that the two alleles within an individual are independent and randomly drawn from the set <math>\{m,M\}</math> with equal probability, ignoring the fact that the two alleles at a diallelic site are not observed equally frequent. This gives us <math>p(G=A_1A_2|\{m,M\})=1/4</math> for all four possible combinations of <math>A_1,A_2 \in \{m,M\}</math>. Therefore we estimate the two possible alleles at the diallelic site by


<math>
==Pre specified Major and Minor==
argmax_{\{m,M\}}\prod_i \sum_{A_1,A_2 \in \{m,M\}} P(D_i|G=A_1A_2)p(G=A_1A_2|\{m,M\}).
Using the [[Sites|-sites]] option the major and minor allele can be predefined for the desired sites. The is very useful when comparing with other data sources e.g. SNP chips where the major and minor allele is known.
</math>
; -doMajorMinor 3
; -sites [filename]


To infer which of these two alleles is the minor allele, we estimate the allele frequencies (only one iteration of the EM algorithm is needed if the starting point is frequencies of 0.5).
==Pre specified Major using a reference==
You can force the major allele according to the reference states if you have defined those '''-ref'''. The minor allele will be inferred based on the genotype likelihood (see do major minor 1). This is the approach used by both GATK and Samtools
; -doMajorMinor 4
; -ref [fasta.fa]


This is the approach described in [[Skotte2012]].
==Pre specified Major using the ancestral state==
You can force the major allelel according to your ancestral states if you have defined those '''-anc'''. The minor allele will be inferred based on the genotype likelihood (see do major minor 1)
; -doMajorMinor 5
; -anc [fasta.fa]

Latest revision as of 13:56, 4 December 2015

Many method assume that polymorphic sites are diallelic. For these methods one needs to define what is the major and minor allele. We allow the major and minor to be determined from either the counts of nucleotides, based on genotype likelihoods, specified by the ancestral/reference or even force both major minor to specific bases, which can be useful if you compare with HapMap data etc.

Brief Overview

	-> angsd version: 0.910-19-g8b9b43a-dirty (htslib: 1.2.1-251-g2072527) build(Dec  4 2015 11:37:02)
	-> Analysis helpbox/synopsis information:
	-> Command: 
./angsd -domajorminor 	-> Fri Dec  4 13:56:10 2015
-------------------
abcMajorMinor.cpp:
	-doMajorMinor	0
	1: Infer major and minor from GL
	2: Infer major and minor from allele counts
	3: use major and minor from a file (requires -sites file.txt)
	4: Use reference allele as major (requires -ref)
	5: Use ancestral allele as major (requires -anc)
	-rmTrans: remove transitions 0
	-skipTriallelic	0

Details

From genotype likelihood data

-doMajorMinor 1

From input for either sequencing data like bam files or from genotype likelihood data like glfv3 the major and minor allele can be inferred directly from likelihoods. We use a maximum likelihood approach to choose the major and minor alleles. Details of the method can be found in the theory section of this page and for citation use this publication Skotte2012 and is briefly described here.

From counts of data

-doMajorMinor 2

If you input sequencing data like the bam format you can choose to infer the major and minor allele by picking the two most frequently observed bases across individuals. This is the approach from here: citation.


Pre specified Major and Minor

Using the -sites option the major and minor allele can be predefined for the desired sites. The is very useful when comparing with other data sources e.g. SNP chips where the major and minor allele is known.

-doMajorMinor 3
-sites [filename]

Pre specified Major using a reference

You can force the major allele according to the reference states if you have defined those -ref. The minor allele will be inferred based on the genotype likelihood (see do major minor 1). This is the approach used by both GATK and Samtools

-doMajorMinor 4
-ref [fasta.fa]

Pre specified Major using the ancestral state

You can force the major allelel according to your ancestral states if you have defined those -anc. The minor allele will be inferred based on the genotype likelihood (see do major minor 1)

-doMajorMinor 5
-anc [fasta.fa]