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
<?php | |
/* Feeds a database with the content of a bibtex file parsed with bibtexbrowser | |
* See: http://www.monperrus.net/martin/feeding-mysql-database-with-bibtexbrowser | |
* Author: Martin Monperrus | |
* Date: Feb 2012 | |
*/ | |
/** MySQL database username */ | |
@define('DB_USER', 'root'); |
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
library(SNPlocs.Hsapiens.dbSNP.20120608) | |
library(plyr) | |
# Read in bim file | |
bimname <- "mnd_b37_flipped.bim" | |
bim <- read.table(bimname, colClasses=c("numeric", "character", "numeric", "numeric", "character", "character")) | |
bim$index <- 1:nrow(bim) | |
# For each chromosome download the SNP locations and match to bim file |
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
# Usage: | |
# R --no-save --args snplist.txt /ibscratch/wrayvisscher/imputation/arichu/data/imputed/chr\*/arichu_1kg_p1v3_\* outputfile < extractSnps.R | |
# - The first argument is the SNP list (just a list of rs SNP ids and nothing else) | |
# - The second argument specifies the root name for the genotype data (in binary plink format). Replace the chromosome number with "\*" | |
# - The third argument is the output file root name that you want to save everything to. | |
library(snpStats) |
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
library(ggbio) | |
library(grid) | |
library(gridExtra) | |
library(plyr) | |
library(GenomicRanges) | |
library(qgraph) | |
multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) | |
{ | |
require(grid) |
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
n <- 1000 | |
m <- 200 | |
X <- matrix(rbinom(m*n, 2, 0.5), n) | |
p <- apply(X, 2, mean)/2 | |
pv <- apply(X, 2, sd) | |
Xp <- t((t(X) - 2*p) / pv) | |
A <- Xp %*% t(Xp) / m | |
A[1:10,1:10] | |
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
readGRM <- function(rootname) | |
{ | |
bin.file.name <- paste(rootname, ".grm.bin", sep="") | |
n.file.name <- paste(rootname, ".grm.N.bin", sep="") | |
id.file.name <- paste(rootname, ".grm.id", sep="") | |
cat("Reading IDs\n") | |
id <- read.table(id.file.name, colClasses="character") | |
n <- dim(id)[1] | |
cat("Reading GRM\n") |
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
library(plyr) | |
library(ggbio) | |
library(TxDb.Hsapiens.UCSC.hg19.knownGene) | |
library(rtracklayer) | |
#=================================================# | |
#=================================================# | |
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
# 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.: |
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 | |
# set -e | |
snplistfile=${1} | |
plinkrt=${2} | |
outfile=${3} | |
touch ${outfile}_mergelist.txt | |
rm ${outfile}_mergelist.txt |
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
manhattanPlot <- function(p, | |
chromosome, | |
ylim = NULL, | |
trunc.lines = TRUE, | |
signif = 5e-8, | |
...) | |
{ | |
stopifnot(length(p) == length(chromosome)) | |
OlderNewer