This file contains hidden or 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 | |
set -e | |
# This script extracts a list of SNPs from gzipped .gen files that are split into 23 chromosomes | |
# and outputs as a single gzipped .gen file containing all extracted SNPs that it can find | |
# To run use the command | |
# | |
# $ ./extractSnpsGenfiles.sh \ |
This file contains hidden or 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 | |
# name of binary plink filename (excluding .bed/.bim/.fam suffix) | |
plinkfile="" | |
# name of phenotype file in plink format (i.e. col1=fid, col2=iid, col3=phenotype | |
phenfile="" | |
# make up a name for the grm for all individuals | |
allfile="" |
This file contains hidden or 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
# SNP-disease association - need effect size and standard error, can use log(OR) instead of effect size | |
y_or <- 1.244 | |
y_upperconf <- 1.375 | |
y_lowerconf <- 1.126 | |
y_eff <- log(y_or) | |
y_se <- (log(y_upperconf) - log(y_lowerconf)) / (2*1.96) | |
# Alternative method from Shinn 2000, but uncertain what scale this transforms to | |
# y_eff <- log(y_or) / 1.81 |
This file contains hidden or 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 -N sleepgwas | |
#PBS -o sleepsnptest-output | |
#PBS -e sleepsnptest-error | |
#PBS -t 1-22 | |
#PBS -l walltime=24:00:00 | |
#PBS -l nodes=1:ppn=2 | |
#PBS -S /bin/bash |
This file contains hidden or 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
# Create some SNPs: | |
px <- 0.5 | |
py <- 0.3 | |
pz <- 0.2 | |
snpx <- rbinom(1000, 2, px) | |
snpy <- rbinom(1000, 2, py) | |
snpz <- rbinom(1000, 2, pz) |
This file contains hidden or 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
m <- data.frame(matrix(rnorm(1000*20), 1000, 20)) | |
y = rnorm(1000) | |
performScan <- function(y, dat) | |
{ | |
n <- ncol(dat) | |
res <- array(0, n) | |
for(i in 1:n) | |
{ |
This file contains hidden or 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
manhattanPlot <- function(p, | |
chromosome, | |
ylim = NULL, | |
trunc.lines = TRUE, | |
signif = 5e-8, | |
...) | |
{ | |
stopifnot(length(p) == length(chromosome)) | |
This file contains hidden or 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 | |
# set -e | |
snplistfile=${1} | |
plinkrt=${2} | |
outfile=${3} | |
touch ${outfile}_mergelist.txt | |
rm ${outfile}_mergelist.txt |
This file contains hidden or 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
# Initial parameters | |
sample_size <- 120000 | |
bmi_mean <- 25 | |
bmi_sd <- 4 | |
allele_freq <- 0.19 | |
effect_size <- -0.23 | |
proportion_smokers <- 0.5 | |
# The transformation of BMI to z^2 allows detection of variance heterogeneity, e.g.: |