SNP calling with ANGSD and ngsLD. How many SNPs?
Entering edit mode
4 weeks ago

Hello community,

I think I run in something of a non-concordant result and I wanted to check out here for some advice. Starting at the SNP calling with ANGSD, I used the following script (notice I changed file names):

#SBATCH --account my_account
#SBATCH -c 40
#SBATCH --mem 64g
#SBATCH --time 60:00:00
#SBATCH --output output.out
#SBATCH --error error.err

 # Locations

 N_IND=`cat /home/my_user/my_account/10-19_Data/16_Lists/bam-final-list.txt | wc -l`

 angsd \
-bam $BAMLIST \
-ref $REF \
-out $OUTDIR/minMapQ20minQ20_minInd145.25_setMinDepthInd2_setMinDepth150setMaxDepth600 \
-uniqueOnly 1 -remove_bads 1 -only_proper_pairs 1 -trim 0 -C 50 -baq 1 \
-minMapQ 20 -minQ 20 -minInd $((N_IND*1/4)) -setMinDepthInd 2 -setMinDepth 150 -setMaxDepth 600 \
-doCounts 1 -dumpCounts 2 \
-GL 1 -doGlf 2 \
-doMajorMinor 1 -doMaf 1 -SNP_pval 1e-6 -minMaf 0.05 -rmTriallelic 0.05 -doPost 1 -doGeno 8 \
-doIBS 1 -doCov 1 -makeMatrix 1 \
-nThreads 40

Forgive the long names, I should stop doing that and just create an index or README files.

After that I have my outputs, including a beagle file (with the maximum likelihood genotypes) and a pos file (the coordinates). These two files I use for estimating linkage disequilibrium (after removing headers). For that goal I used this script:

#SBATCH --account my_account
#SBATCH -c 40
#SBATCH --mem 128g
#SBATCH --time 72:00:00
#SBATCH --output ngsLD_script.out
#SBATCH --error ngsLD_script.err


ngsLD \
--geno $GENO \
--pos $POS \
--probs \
--n_ind 162 \
--n_sites 2106812 \
--max_kb_dist 100 \
--min_maf 0.05 \
--n_threads 40 \
--out $OUTDIR/ANGSD_SNPcalls.ld

And here is where I start to doubt the process. The output is enormous, perhaps there is one way to split this by chromosomes. But the one think that bothers me is that the number of SNPs is about 2 million, but when I check how many SNPs there are in one part of chromosome 1 (with this script, which is part of the code in



awk -v chr=$CHR -v min=$START_POS -v max=$END_POS 'BEGIN{print "snp1\tsnp2\tdist\tr2p\tD\tDp\tr2"} {split($1,pos1,":"); split($2,pos2,":")} pos1[1]==chr && pos1[2]>=min && pos1[2]<=max && pos2[1]==chr && pos2[2]>=min && pos2[2]<=max' | cut -f 1-7 > $TMP_FILE
N=$((`cat $TMP_FILE | wc -l`-1))

echo $N

By the way, I run this script like this in the terminal:

cat ANGSD_SNPcalls.ld | bash ../../../20-29_Scripts/25_ngsLD/

N was about 15 million, which exceeds the number of sites retained. I have little to no skill with awk (sorry for this), so perhaps is something in the code there I have not noticed.

Apologies for a rather lengthy post. I hope you have some input into this.

Thank you very much :)

lcwgs ngsTools ANGSD genomics • 215 views

Login before adding your answer.

Traffic: 2318 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6