LDdecay使用介绍

介绍:使用PopLDdecay软件生成群体的LD衰减图。从大群体中提取subgroup的vcf作为PopLDdecay的输入。
#!/bin/bash

SamLst=$1   ##- 每个样本名一行
Prefix=$2

gvcf=$3

vcftools  --gzvcf  ${gvcf}  --recode --recode-INFO-all --stdout  --keep  ${SamLst}  > ${Prefix}.snp.vcf

bgzip  ${Prefix}.snp.vcf

tabix -p vcf  ${Prefix}.snp.vcf.gz

/data/mg1/caix/src/biosoft/PopLDdecay/PopLDdecay  -InVCF  ${Prefix}.snp.vcf.gz  -OutStat  ${Prefix}.LD.stat.gz

rm ${Prefix}.snp.vcf.gz  ${Prefix}.snp.vcf.gz.tbi

使用PopLDdecay中程序Plot_MultiPop.pl绘图

perl  /data/mg1/caix/src/biosoft/PopLDdecay/bin/Plot_MultiPop.pl  -inList  Stat.Sp.Lst  -output  oilseed  -keepR

Stat.Sp.Lst文件格式:

/data/mg1/caix/works/Bra_reSeqProject_2022/Pop_analysis_0411/oilseed/LD_decay/plot/CAturnips.LD.stat.gz CAoilseed
/data/mg1/caix/works/Bra_reSeqProject_2022/Pop_analysis_0411/oilseed/LD_decay/plot/Oilseed.LD.stat.gz   ChineseOilseed
/data/mg1/caix/works/Bra_reSeqProject_2022/Pop_analysis_0411/oilseed/LD_decay/plot/sarson.LD.stat.gz    sarson

结果图展示:

image.png

PS: 计算 the length of half-maximum decay of LD (calculate_LDlength.pl):

#!/usr/bin/perl -w
use strict;

my $in0 = $ARGV[0]; ##- sarson.LD.stat.gz

open IN0, "gzip -dc $in0 | ";
<IN0>;
my $firstLine = <IN0>;
chomp($firstLine);
my @firstLine = split(/\t/, $firstLine);
my $max = $firstLine[1];
close IN0;

my %dis2Value = ();
open IN1, "gzip -dc $in0 | ";
<IN1>;
while(<IN1>){
  chomp;
  my @temp = split(/\t/, $_);
  $dis2Value{$temp[0]} = $temp[1];
}
close IN1;

my $halfValue = $max/2;

for my $key1(sort {$a<=>$b} keys %dis2Value){

    my $next = $key1 + 1;
    
    if(exists $dis2Value{$next}) { 

       my $currentValue = $dis2Value{$key1};
       my $nextValue = $dis2Value{$next};
      
       if($currentValue >= $halfValue && $nextValue < $halfValue){
          print "Processing ", $in0, "\n";
          print "max LD: r2: ", $max, "\n";
          print "half LD:  r2: ", $halfValue, "\t", "LD length: ", $key1, "\n"; 
          last;
       } 

    }

}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在群体遗传学分析中,我们经常会碰到关于连锁不平衡的问题,当然计算连锁不平衡的软件有很多,包括plink2、hapl...
    杨博士聊生信阅读 14,647评论 1 25
  • 1 安装PopLDdecay,优点:方便不需要转换格式(plink需要) ## 下载 git clone http...
    铃_0d92阅读 6,970评论 0 5
  • 1.连锁不平衡(LD)概念 连锁不平衡(LD)是指不同位点等位基因的非随机关联。LD 的衰减是受重组率和重组代数影...
    DumplingLucky阅读 13,127评论 0 11
  • 群体进化与选择信号:●生活在世界不同区域的生物群体在历史长河中经历千万年的自然选择、人工驯化、迁徙、遗传漂变等事件...
    琴酒martini阅读 26,743评论 6 98
  • 一次简化基因组数据分析实战 尽管目前已经有大量物种基因组释放出来,但还是存在许多物种是没有参考基因组。使用基于酶切...
    xuzhougeng阅读 15,187评论 10 40