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
| fo | |
| for study in brya ftca gsdc mrsc nhrv nhs2 nss1 nss2 onga pts1 psy2 psy3 | |
| do | |
| #cat "$study"/infoeur/*.dosage | awk '{if(NR == 1 || ($1 != "CHR" && $6 > 0 && $6 < 1)) print $2,$1,$3,$4,$5,$6,$7}' > "$study".mafinfo | |
| cat "$study"/infoeur/*.dosage | awk '{if(NR == 1 || ($1 != "CHR" && $6 > 0 && $6 < 1)) print $2,$4,$5,$6,$7}' | LC_ALL=C sort -k1b,1 > "$study".mafinfo | |
| done | |
| #Note: Assumes that the SNP is the first column of your gwas results file. If it is not, change "sort k1b,1" | |
| to the column number where the SNP is. e.g. if SNP is in column 2, change to sort k2b,2 gwas_results.assoc.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
| nAA=76 | |
| nAa=1501 | |
| naa=7823 | |
| n=nAA+nAa+naa | |
| pA=(2*nAA+nAa)/(2*n) | |
| pa=1-pA | |
| obs= c(nAA,nAa,naa) | |
| exp=c(n*pA^2,2*n*pA*pa,n*pa^2) | |
| val=sum(((obs-exp)^2)/exp) | |
| 1-pchisq(val,df=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
| library(mice) | |
| #Continuous and categorical variables should be defined prior to MI. This will prevent nonsensical imputations from happening - e.g. cohorts are 1,2,3,4, you impute, then suddenly someone is in cohort 1.5 | |
| #Note feb 5: Put other surrogate mobility variables in noting imputation | |
| #I prefer to make lists of all continuous and categorical variables going in | |
| contvars <- scan(what="character",sep="/n") | |
| AGE |
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
| expand.grid(study= c("pgc","hou"), imputation = c("unimputed","imputed"), subjs = c("pgbd","pgbd_va"), pheno = c("enter_M_v2","nonresponder","eventnonresponder")) |
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 commandz in $(ps aux | grep R | awk '{print $2}'); do kill $commandz;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
| zcat daner_pts_mrsc_mix_am-qc.hg19.ch.fl.gz | awk '{print $2,$11}' | grep -v NA > daner_pts_mrsc_mix_am-qc_short2 | |
| awk '{print $2,$12}' mrsc_gemma_pcs > mrsc_gemma_pcs_short2 | |
| gzip -d mrsc_gemma_pcs_short2.gz | |
| gzip -d daner_pts_mrsc_mix_am-qc_short2.gz | |
| LC_ALL=C join <(awk '{if (NR==1)$1="SNP", $2="P"; else print}' mrsc_gemma_pcs_short2 | LC_ALL=C sort -k1b,1 ) <(LC_ALL=C sort -k1b,1 daner_pts_mrsc_mix_am-qc_short2) > files_joined | |
| sort -g -k2 files_joined > files_joined2 | |
| grep -v P files_joined2 > files_joined3 |
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 files in $(ls *.txt) | |
| do | |
| samplename=$(awk 'NR==12{print $1}' $files) | |
| echo $files $samplename >> sample_ids.txt | |
| samplename="" | |
| 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
| #PBS -lnodes=1 | |
| #PBS -lwalltime=02:05:00 | |
| #!/bin/bash | |
| #Make walltime a function of N? | |
| while getopts i:f:o:p:d:n: option | |
| do | |
| case "${option}" |
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('C:/Users/adam/Desktop/starrs_cdrisc') | |
| dat <- read.csv('CD_RISC_v2.csv',header=T,stringsAsFactors=F,na.strings=c("NA","#N/A")) | |
| dat <- subset(dat,visit <= 3) | |
| library(plyr) | |
| cdr_max <- ddply(dat, ~studyid,colwise(.fun=max,'CDR_SUM',na.rm=T)) | |
| cdr_max <- cdr_max[-which(cdr_max$CDR_SUM == -Inf),] |
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
| #############################Begin Function############################# | |
| #First we define the function with required parameters and optional parameters with their defaults | |
| ManhattanPlot_AJS_cut <- function(chr, pos, pvalue, snp, genomesig = 0, genomesug = 0,photoname = "Manhattan Plot", outname = "ManhattanPlot_AJS", colors = c("navyblue","gray69"), sigcolor = "darkred", sugcolor = "indianred", ncex = .5, plotsymbol = 16, sugcex = 1, sigcex = 1.5, sigsnpcolor = "red", nonautosome = c(23,24,25,26),xlabel = "Chromosomal Positions",ylabel = "-log10(p-value)", pdf = "TRUE",topsnplabels = "FALSE", pvalue_miss = "NA",highlight_p=5e-8,highlightboundary=50000) { | |
| #bind the input data into one table and prune out missing data based on the pvalue_miss option and then | |
| #redefines the input variables chr, pos, pvalue, snp to reflect the cleaned data |