This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
R | |
new_beta_se <- function(x ,phi=0.153) | |
{ | |
#Input should be a vector consisting of beta, p, maf. phi should be a value for the proportion of cases | |
B=x[1] | |
P=x[2] | |
theta=x[3] | |
B2=B/(phi*(1 - phi) + .5*(1-2*phi)*(1-2*theta)*B - (0.084 + 0.9*phi*(1 - 2*phi)*theta*(1-theta))/(phi*(1-phi))*B^2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar xvzf dnhs_qc_v2_mar7_2017.tgz --wildcards '*-qc.fam' --wildcards '*.header' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Script to convert dosage data to GMMAT format. Requires also a list of usuable SNPs as input, but this list does not need to be filtered. | |
#Create a valid SNPlist | |
info=0.9 | |
maf=0.01 | |
zcat /home/maihofer/vets/qc/imputation/distribution/vets_eur_analysis_run2/daner_vets_eur_analysis_run2.gz | awk -v info=$info -v maf=$maf '{if (($8 > info) && ($6 > maf) && ($7 > maf) && ($6 < 1-maf) && ($7 < 1-maf) && ($11 != "NA")) print $2}' > european_valid_snps.snplist | |
echo "SNP" > snp.txt | |
cat snp.txt european_valid_snps.snplist | LC_ALL=C sort -k 1b,1 > european_valid_snps.sorted.snplist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Merge data in PLINK, using merge mode 6 or 7 | |
./plink --bfile YEHUDA --bmerge YEHUDA.bed YEHUDA.bim YEHUDA.fam --merge-mode 7 --out yehude-merge | |
R | |
setwd('F:/rutgers_2') | |
dat <- read.table('yehude-merge.diff', header=T,nr=800000,stringsAsFactors=F) | |
library(plyr) | |
#Determine general amount of disagreement for each SNP. Ones that have especially high disagreement may be badly genotyped | |
quantile(table(dat$SNP)) | |
#Plot it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#PBS -V | |
while getopts l:d: option | |
do | |
case "${option}" | |
in | |
l) snplocations=${OPTARG};; | |
d) lzresults_list=${OPTARG};; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setwd('C:/Users/adam/Desktop/roycepower') | |
library(plyr) | |
dat0 <- read.csv('me_power.csv', header=T) | |
dat <- dat0 | |
#Fill in the blanks | |
for (i in 1:dim(dat)[1]) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
famfile <- read.table('/home/cnieverg/MEG2/qc/pts_meg2_mix_am.fam',header=F,stringsAsFactors=F) | |
names(famfile) <- c("FID","IID","F","M","Gender","Pheno") | |
mds <- read.table('/home/cnieverg/MEG2/qc/pca/pts_meg2_mix_am-qc-eu1_pca.menv.mds_cov',header=T,stringsAsFactors=F) | |
dat <- merge(famfile,mds,by=c("FID","IID")) | |
#Number of analyzed subjects of European ancestry | |
dim(dat)[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls ../bgn | sed 's/.bed//g' | sed 's/.bim//g' | sed 's/.fam//g' | sort -u | awk '{print "../bgn/"$1".bed","../bgn/"$1".bim","../bgn/"$1".fam"}' > mergelist.txt | |
../plink --merge-list mergelist.txt --maf 0.00000001 --geno 0.02 --make-bed --out pgbd_nomono_goodgeno | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pdf('h2_mf_perstudy.pdf',7,7) | |
par(mar=c(5, 4, 4, 2) + 0.5) | |
plot(dat$case,dat$SE,cex.axis=1.45,cex.lab=1.5,xlab="N Cases", ylab="Standard Error of SNP Based Heritability",main="",cex=1.5,pch=19) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LC_ALL=C sort -k1b,1 file1.txt > file1.txt.sorted | |
LC_ALL=C sort -k1b,1 file2.txt > file2.txt.sorted | |
LC_ALL=C join file1.txt.sorted file2.txt.sorted > joined.txt |