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(Hmisc) | |
library(data.table) | |
cormethod="pearson" | |
windowsize=300000 # | |
windowjump=10000 #Jump over this increment for correlation analysis | |
minR=0.6 #minimum correlation to report | |
#GeMes https://www.cell.com/ajhg/pdfExtended/S0002-9297(14)00069-X | |
#http://www.sthda.com/english/wiki/correlation-matrix-a-quick-start-guide-to-analyze-format-and-visualize-a-correlation-matrix-using-r-software | |
flattenCorrMatrix <- function(cormat, pmat) { |
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
for chr in 10 # X # 2 6 11 # {7..20} # {2..20} # {1..20} #22 # {1..8} # {1..22} X MT XY Y | |
do | |
echo $chr | |
date | |
mkdir temporary_files/chr"$chr"_baf1 | |
mkdir temporary_files/chr"$chr"_baf2 | |
mkdir temporary_files/chr"$chr"_baf3 | |
mkdir temporary_files/chr"$chr"_baf4 | |
mkdir temporary_files/chr"$chr"_l2r1 |
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
#!/usr/bin/env python | |
import math | |
######################################################## | |
# plink2metasoft.py | |
# Convert Plink .assoc files to Metasoft input file | |
# Free license -- you are free to use it in any ways | |
# Buhm Han (2012) | |
######################################################## | |
import sys, subprocess, os |
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
BOLT-LMM_v2.3.2/bolt \ | |
--bed=pca/UKB_tinnitus_eur_unrelated_{1..22}.bed \ | |
--bim=pca/UKB_tinnitus_eur_unrelated_{1..22}.bim \ | |
--fam=pca/UKB_tinnitus_eur_unrelated_1.fam \ | |
--LDscoresFile=BOLT-LMM_v2.3.2/tables/LDSCORE.1000G_EUR.tab.gz \ | |
--geneticMapFile=BOLT-LMM_v2.3.2/tables/genetic_map_hg19_withX.txt.gz \ | |
--lmmForceNonInf \ | |
--numThreads=6 \ | |
--bgenFile=/mnt/ukbb/adam/bgen/ukb_imp_chr{1..22}_v3.bgen \ | |
--bgenMinMAF=1e-3 \ |
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
nsub=30000 | |
nr=nsub | |
ncol=nsub | |
dummy_datamatrix <- data.frame(pc1=rnorm(nsub), pc2=rnorm(nsub),studytype=round(runif(nsub))) | |
distmat <- matrix(rnorm(nsub^2),ncol=nsub,nrow=nsub) | |
library(vegan) |
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
args <- commandArgs(TRUE) | |
parmfile <- args[1] | |
linestart <- args[2] | |
linestop <- args[3] | |
run_no <- args[4] | |
library(lmtest) | |
nrep=100 #Number of simulation repetitions per parameter set |
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
for chr in {1..22} | |
do | |
for pwd in $(cat /mnt/sdb/genetics/hrv_2/umichpwds.txt) #supply a file with umich password, i can never keep track of these | |
do | |
echo $pwd | |
unzip -P $pwd chr_"$chr".zip | |
done | |
#rm chr_"$chr".zip | |
done |
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
args = commandArgs(trailingOnly=TRUE) | |
#Rscript p2_phenocode.r mrsc > test.txt | |
study <- args[1] | |
#study='mrsc' | |
library(psych) | |
dat <- read.csv(paste(study,'_p2.csv',sep=''),stringsAsFactors=F,header=T,na.strings=c(NA,"#N/A","-9")) |
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
# Will Rayner provides a great toolbox to prepare data: HRC or 1000G Pre-imputation Checks. | |
# The main steps for HRC are: | |
# Download tool and sites | |
#wget http://www.well.ox.ac.uk/~wrayner/tools/HRC-1000G-check-bim-v4.2.7.zip | |
#wget ftp://ngs.sanger.ac.uk/production/hrc/HRC.r1-1/HRC.r1-1.GRCh37.wgs.mac5.sites.tab.gz | |
# Convert ped/map to bed |
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
##Part 1: If final report is not split into 1 subject per file, this will split it up. Otherwise don't run this part! | |
#User: List name of final report file here | |
final_report=Akesogen_Cohen_FC_CNV_V.1_FinalReport.txt | |
#Creates a header | |
head -n10 $final_report > header.txt | |
#Column $1 is the default here, but the number should correspond to whatever number the subjects are named in | |
awk 'NR>10{print >$1}' $final_report |