R包 2014年发表在MBE上, 至今已经被引129次!!! 为什么说这个R包很厉害呢? 可以做单基因的选择性信号检测,相比于绝大多数软件的滑动窗口,这也算是一大特点吧。 (也很可能是我用过的软件太少) 简单介绍一下: 文件准备: VCF:tabixed VCF files (htslib bgzip & tabix) GFF: 基因注释文件,不能有空格和##否则不能识别gene位置等等,切记格式; 群体信息(以2个群体为例):pop1,pop2 (tab分隔或者单行都行) ###PopGenome.R######VCF(after bgzip and tabix)###GFF(no blank line and \#)###population information:pop1(under selection),pop2(wild/natural)###Rscript $0 VCF_file gff_file pop1 pop2 chromosomesetwd('PATH');##加载popGenome包library(PopGenome);args<-commandargs(t);##read vcf="" and="">-commandargs(t);##read><>1],1000000,args[5],1,100000000,include.unknown=TRUE,gffpath=args[2]);##set populationpop1<>3],list(''));pop2<>4],list(''));GENOME.class<-set.populations(genome.class,>-set.populations(genome.class,>1]],pop2[[1]]),diploid=FALSE);##split to genesGENOME.class.split<-splitting.data(genome.class, subsites="">-splitting.data(genome.class,>'gene');##查看每一个区间sites##GENOME.class.split@n.sites##查看区间位置信息##GENOME.class.split@region.nameschromosome <>5],times=length(GENOME.class.split@region.names)));colnames(chromosome)<>'chromosome');##计算TajimaD等neural testGENOME.class.split <->-><>1]];tajima_pop2<>2]];tajima<-cbind(tajima_pop1,tajima_pop2);##linkage##genome.class.split>-cbind(tajima_pop1,tajima_pop2);##linkage##genome.class.split><->->1]];##FstGENOME.class.split <->->1]];Fst<-genome.class.split@nucleotide.f_st ##pop1&pop2="" nucleotide="">-genome.class.split@nucleotide.f_st><>1]);###Fst scaleFst<><>'Fst_nuc','Z(Fst_nuc)');##diveristyGENOME.class.split <->->1]]; ##pop1##get.diversity(GENOME.class.split)[[2]]; ##pop2diversity <-genome.class.split@nuc.diversity.within; ##pop1&pop2="" nucleotide="" diversity##rd="" relative="" diveristy(pop1="" diveristy="" pop2="" diveristy)rd="">-genome.class.split@nuc.diversity.within;><>2]/diversity[,1]);colnames(RD) <>'RD');Diversity <-cbind(diversity,rd);##几个参数合并在一起输出sum>-cbind(diversity,rd);##几个参数合并在一起输出sum><-cbind(scaffold, tajima,="" fst,="" diversity);output="">-cbind(scaffold,><->->5],'stat',sep='.');write.table(sum, file=output, sep='\t', quote=F); 对于多条染色体或者scaffold,for染色体数上面的脚本,最后合并到一起即可。 对于PopGenome和其他软件分析的结果差异并没有仔细研究,有兴趣的可以自己比较一下。 (https://cran./web/packages/PopGenome/index.html) 上期:群体选择性清除检测介绍 下期:vcftools检测选择性清除 |
|