本腳本適用于GAPIT產生的GWAS結果:
library(dplyr) #子集的包
tmp<-data.frame() #創(chuàng)建空的數(shù)據(jù)集
myfiles <- Sys.glob("GAPIT*.Results.csv") #搜索文件夾內所有的gwas結果文件
print(paste(myfiles,"has been found")) #顯示所有找到的結果文件
for(i in myfiles) #循環(huán)開始
{new_trait<-read.csv(file=i,header = TRUE,sep = ",") #讀取文件
newdata <- subset(new_trait, P.value < 1e-6) #篩選pvalue列中小于1e-6的行,提取至新的文檔newdata
newdata$trait<-i #創(chuàng)建新的列,標注該表型名稱
tmp<-rbind(tmp,newdata) #與之前的文件合并
}
匯總文件在tmp中桐筏,輸出為csv即可。
提取的僅僅是顯著位點(閾值自己調整)