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 extractdata | |
#PBS -o extractdata-output | |
#PBS -e extractdata-error | |
#PBS -t 1-23 | |
#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
#!/bin/bash | |
cd /panfs/panasas01/shared/alspac/studies/latest/alspac/genetic/variants/arrays/gwas/imputed/1000genomes/released/27Feb2015/data/derived | |
mkdir -p ~/updated_ids | |
mkdir -p ~/updated_ids/kinships | |
mkdir -p ~/updated_ids/principal_components/all | |
mkdir -p ~/updated_ids/principal_components/unrelateds | |
mkdir -p ~/updated_ids/exclusion_ids | |
mkdir -p ~/updated_ids/unrelated_ids |
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 | |
for i in {1..9} | |
do | |
plink1.90 --bfile ~/data/alspac_1kg/data/genotypes/bestguess/subset_maf0.01_info0.8/data_chr0${i} --extract ~/data/1kg_scratch/hapmap3_autosome.snplist --make-grm-bin --out data_chr0${i} --maf 0.01 | |
done | |
for i in {10..22} | |
do | |
plink1.90 --bfile ~/data/alspac_1kg/data/genotypes/bestguess/subset_maf0.01_info0.8/data_chr${i} --extract ~/data/1kg_scratch/hapmap3_autosome.snplist --make-grm-bin --out data_chr${i} --maf 0.01 |
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
setwd("/I/DON\'T/KNOW/YOUR/COMPUTER") | |
# Install pdftotext from here: | |
# http://mac.softpedia.com/get/Word-Processing/pdftotext-Installer-Package.shtml | |
# Find pdf files in a directory | |
get_pdf_files <- function(wd="./") | |
{ |
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
two_sample_iv <- function(b_exp, b_out, se_exp, se_out, n=10000) | |
{ | |
b <- sum(b_exp*b_out / se_out^2) / sum(b_exp^2/se_out^2) | |
se <- sqrt(1 / sum(b_exp^2/se_out^2)) | |
pval <- pt(b / se, df = n, low=FALSE) | |
return(list(b=b, se=se, pval=pval)) | |
} | |
two_sample_iv_delta <- function(b_exp, b_out, se_exp, se_out, n=10000, cov=1) | |
{ |
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 | |
# From https://forums.plex.tv/index.php/topic/153446-this-server-is-not-powerful-enough-to-convert-video/page-3 | |
cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/WebClient.bundle/Contents/Resources/js | |
sudo sed -i 's/validateTranscoder:function(e,t){if/validateTranscoder:function(e,t){return false;if/g' plex.js |
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
calculate_mean_squared_error <- function(dati, samplesize, numberofbootstraps) | |
{ | |
squared_error <- array(0, numberofbootstraps) | |
mean_dati <- mean(dati) | |
for(i in 1:numberofbootstraps) | |
{ | |
squared_error[i] <- (mean_dati - mean(sample(dati, samplesize)))^2 | |
} | |
return(mean(squared_error)) | |
} |
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
library(MASS) | |
#' Simulate two traits with shared genetic and environmental effects | |
#' | |
#' @param nid sample size | |
#' @param nsnp number of snps | |
#' @param hsq1 h2 of trait 1 | |
#' @param hsq2 h2 of trait 2 | |
#' @param rg genetic correlation |
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
library(dplyr) | |
arguments <- commandArgs(T) | |
splits <- as.numeric(arguments[1]) | |
outdir <- arguments[2] | |
savefile <- arguments[3] | |
l <- list() | |
for(i in 1:splits) | |
{ |
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
arguments <- commandArgs(T) | |
codefile <- arguments[1] | |
bimfile <- arguments[2] | |
chr <- arguments[3] | |
codes <- read.table(codefile, colClass=c("character", "numeric", "character", "character")) | |
index <- codes$V1 == "." | |
codes$V1[index] <- paste("chr", chr, ":", codes$V2[index], sep="") | |
dim(codes) |