NgsRelate: Difference between revisions

From software
Jump to navigation Jump to search
No edit summary
 
(134 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Brief description=
= NEW VERSION =  
This page contains information about the program called NgsRelate, which can be used to infer relatedness coefficients for pairs of individuals for low coverage nags data by using genotype likelihoods. To be able to infer the relatedness you will need to know the population frequencies and have genotype likelihoods. This can be done e.g. using the program ANGSD as shown in the example.
For the NEW version of ngsRelate that coestimates relatedness and inbreeding go to this link https://github.com/ANGSD/NgsRelate


=Installation=
Primary repository is github.
== Download Installation of C program ==
<pre>
curl https://raw.githubusercontent.com/ANGSD/fastlate/master/fastlate.cpp >fastlate.cpp
g++ fastlate.cpp -O3 -lz -o fastlate
</pre>


= Run example using C =
= OLD VERSION =  
Assume we have file containing paths to 100 BAM/CRAM files, then we can use ANGSD to estimate frequencies calculate genotype likelihoods while doing SNP calling and dumping the input files needed for the NgsRelate program
For the old version please use this link: http://www.popgen.dk/software/index.php?title=NgsRelate&oldid=694
<pre>
./angsd -b filelist -gl 1 -domajorminor 1 -snp_pval 1e-6 - domaf 1 -minmaf 0.05 -doGlf 3
#this generates an angsdput.mafs.gz and a angsdput.glf.gz.
#we will need to extract the frequency column from the mafs file and remove the header
cut -f5 angsdput.mafs.gz |sed 1d >freq
./ngsrelate -g angsdput.glf.gz -n 100 -f freq >gl.res
</pre>
 
== Output file format==
Example of output
<pre>
Pair k0 k1 k2 loglh nIter coverage
(0,1) 0.673213 0.326774 0.000013 -1710940.769941 19 0.814658
(0,2) 0.448790 0.548298 0.002912 -1666189.356801 25 0.809546
(0,3) 1.000000 0.000000 0.000000 -1743992.363193 -1 0.816997
(0,4) 1.000000 0.000000 0.000000 -1759202.971213 -1 0.819589
(0,5) 1.000000 0.000000 0.000000 -1550475.615322 -1 0.753337
(1,2) 0.006249 0.993750 0.000001 -1580989.961356 13 0.807634
(1,3) 1.000000 0.000000 0.000000 -1728859.988212 -1 0.815001
(1,4) 1.000001 -0.000001 0.000000 -1744055.203870 9 0.817618
(1,5) 1.000000 0.000000 0.000000 -1536858.187440 -1 0.751590
(2,3) 1.000000 0.000000 0.000000 -1705157.832621 -1 0.810021
(2,4) 1.000000 0.000000 0.000000 -1719681.338365 -1 0.812530
(2,5) 1.000000 0.000000 0.000000 -1517388.260612 -1 0.747571
(3,4) 0.566608 0.432927 0.000464 -1743752.165847 33 0.820009
(3,5) 0.265799 0.483006 0.251195 -1467343.087693 8 0.755312
(4,5) 0.004655 0.995345 -0.000000 -1473415.049411 8 0.756410
</pre>
 
 
The first two columns are the individuals number. The next three columns are the estimated relatedness coefficients and the last column is the number of iterations used.
 
 
=== Input file format ===
 
The input consists of three files describignt the genotype data, a file with admixture proportions for each individual and a file with
allele frequencies for each SNP for each source population. The genotype data files are plink bed/bim/fam files. And the remaining two files
are in the output format for the program [http://www.genetics.ucla.edu/software/admixture/ ADMIXTURE]: 
 
Example of the content of an admixture proportion file (for 3 populations)
<pre>
0.531631 0.468359 0.000010
0.564461 0.435529 0.000010
0.850660 0.149330 0.000010
0.630527 0.369463 0.000010
0.747429 0.219346 0.033225
0.999980 0.000010 0.000010
0.999980 0.000010 0.000010
0.682072 0.317918 0.000010
0.000010 0.999980 0.000010
0.793133 0.206857 0.000010
</pre>
Each row is an individual and each column is a population. The admixture proportions for each individual must sum to 1
 
Example of the allele frequency file (for 3 populations)
<pre>
0.312722 0.208605 0.999990
0.881352 0.999990 0.966966
0.708206 0.838869 0.932119
0.427789 0.620694 0.532966
0.411998 0.622253 0.534072
0.427789 0.620694 0.532966
0.440817 0.581630 0.618751
0.733733 0.985281 0.953523
0.724083 0.451452 0.784607
0.811161 0.578612 0.787782
</pre>
Each row is an SNP and each column is a population. When using plink files the allele frequency is the MAJOR allele frequency.
 
= Citing and references =
=== relateAdmix ===
Moltke, I, Albrechtsen, A (2013). RelateAdmix: a software tool for estimating relatedness between admixed individuals. Bioinformatics.
[http://www.ncbi.nlm.nih.gov/entrez?Db=pubmed&Cmd=ShowDetailView&uid=24215025 pubmed]
[http://www.bioinformatics.org/texmed/cgi-bin/list.cgi?PMID=24215025 bibtex]
 
=== ADMIXTURE ===
D.H. Alexander, J. Novembre, and K. Lange. Fast model-based estimation of ancestry in unrelated individuals. Genome Research, 19:1655–1664, 2009.
 
 
= change log =
* 0.14 made more MAC usable (I think). Thanks to Paul Lott for reporting it and for suggestions and Thorfinn Sand for changing it
* 0.13 added extra check for file exists to give instant errors + changes all printf to fprintf(stderr,
* 0.11 changed threading to a fixed pool of threads
* 0.10 optimized code
* 0.09 added error for when the number of sites and individuals does not match between files
* 0.08 fixed a bug that would sometimes print an extra line when multiple threaded
* 0.07 fixed a small leak

Latest revision as of 14:59, 5 October 2018

NEW VERSION

For the NEW version of ngsRelate that coestimates relatedness and inbreeding go to this link https://github.com/ANGSD/NgsRelate


OLD VERSION

For the old version please use this link: http://www.popgen.dk/software/index.php?title=NgsRelate&oldid=694