Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jianhuig authored Mar 17, 2021
1 parent 827f97d commit 5102d50
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Type I error/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,27 @@ We obtain pre-cleaned 1000 Genome Project PLINK file for indepdent samples from
wget http://tcag.ca/documents/tools/omni25_indep.tar.gz
tar -xzvf
```


```r
library(bigsnpr)
rds <- snp_readBed("indep.bed")
library(dplyr)

# read PLINK file into R
snp_readBed("indep.bed")
bigSNP <- snp_attach("indep.rds")

n = nrow(bigSNP$fam) # Sample Size
sum_stat <- data.frame(SNP = bigSNP$map$marker.ID, A1 = bigSNP$map$allele1, A2 = bigSNP$map$allele2) %>% mutate( N = n)
load("cadd.RData")
id <- intersect(sum_stat$SNP, cadd$rsid) # only 545028 SNPs left
sum_stat <- sum_stat %>% filter(SNP %in% id)

# simulate 1000 sets
for ( i in 1:1000){
sum_stat <- sum_stat %>% mutate(Z = rnorm(1))
gz1 <- gzfile(paste0("summary_statistics/1kg_sim",i,".tsv.gz"), "w")
write.table(sum_stat, gz1, row.names=F, quote=F, sep= " ")
close(gz1)
}
```

0 comments on commit 5102d50

Please sign in to comment.