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 -V | |
| while getopts l:d: option | |
| do | |
| case "${option}" | |
| in | |
| l) snplocations=${OPTARG};; | |
| d) lzresults_list=${OPTARG};; | |
| esac |
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
| #Merge data in PLINK, using merge mode 6 or 7 | |
| ./plink --bfile YEHUDA --bmerge YEHUDA.bed YEHUDA.bim YEHUDA.fam --merge-mode 7 --out yehude-merge | |
| R | |
| setwd('F:/rutgers_2') | |
| dat <- read.table('yehude-merge.diff', header=T,nr=800000,stringsAsFactors=F) | |
| library(plyr) | |
| #Determine general amount of disagreement for each SNP. Ones that have especially high disagreement may be badly genotyped | |
| quantile(table(dat$SNP)) | |
| #Plot it |
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
| #Script to convert dosage data to GMMAT format. Requires also a list of usuable SNPs as input, but this list does not need to be filtered. | |
| #Create a valid SNPlist | |
| info=0.9 | |
| maf=0.01 | |
| zcat /home/maihofer/vets/qc/imputation/distribution/vets_eur_analysis_run2/daner_vets_eur_analysis_run2.gz | awk -v info=$info -v maf=$maf '{if (($8 > info) && ($6 > maf) && ($7 > maf) && ($6 < 1-maf) && ($7 < 1-maf) && ($11 != "NA")) print $2}' > european_valid_snps.snplist | |
| echo "SNP" > snp.txt | |
| cat snp.txt european_valid_snps.snplist | LC_ALL=C sort -k 1b,1 > european_valid_snps.sorted.snplist |
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
| tar xvzf dnhs_qc_v2_mar7_2017.tgz --wildcards '*-qc.fam' --wildcards '*.header' |
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
| R | |
| new_beta_se <- function(x ,phi=0.153) | |
| { | |
| #Input should be a vector consisting of beta, p, maf. phi should be a value for the proportion of cases | |
| B=x[1] | |
| P=x[2] | |
| theta=x[3] | |
| B2=B/(phi*(1 - phi) + .5*(1-2*phi)*(1-2*theta)*B - (0.084 + 0.9*phi*(1 - 2*phi)*theta*(1-theta))/(phi*(1-phi))*B^2) |
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
| #Requires a list of SNPs written into snplist.txt | |
| dosage_directory=write_path_to_dosage_files_here | |
| for snp in $(cat snplist.txt) | |
| do | |
| filename=$(grep -w -m1 -l $snp "$dosage_directory"/*.map | sed 's/.map/.gz/g' ) | |
| zgrep -w -m1 $snp $filename > "$snp".dosage | |
| 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=0:05:00 | |
| #!/bin/bash | |
| while getopts a:b:o:p:d: option | |
| do | |
| case "${option}" | |
| in | |
| a) phenotype=${OPTARG};; |
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
| bimfile=pts_meg2_mix_am-qc.bim | |
| grep -P "A\tT" $bimfile > ambiguous_snps.txt | |
| grep -P "T\tA" $bimfile >> ambiguous_snps.txt | |
| grep -P "C\tG" $bimfile >> ambiguous_snps.txt | |
| grep -P "G\tC" $bimfile >> ambiguous_snps.txt | |
| #filer out ambiguous | |
| $plink_location --bfile pts_meg2_mix_am-qc --exclude ambiguous_snps.txt --make-bed --out pts_meg2_mix_am-qc-ambig |
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
| chunknum=$(echo $chunk | sed 's/.*\(chr[0-9]*_[0-9]*_[0-9]*\).*/\1/') | |
| chrnum=$(echo $chunk | sed 's/.*\(chr[0-9]*\).*/\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
| args <- commandArgs(trailingOnly = TRUE) | |
| scriptloc <- args[1] | |
| results <- args[2] | |
| outfile <- args[3] | |
| snpcol <- args[4] | |
| chrcol <- args[5] | |
| bpcol <- args[6] | |
| pcol <- args[7] | |