Last active
April 4, 2017 19:59
-
-
Save nievergeltlab/292328afdc1e5639bc7949deffb81f0b to your computer and use it in GitHub Desktop.
Analyze dosages data from Ricopili
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
#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};; | |
b) covariate=${OPTARG};; | |
o) outputfile=${OPTARG};; | |
p) probdir=${OPTARG};; | |
d) outdir=${OPTARG};; | |
esac | |
done | |
#Write the start and stop points of the file | |
jstart=$((($PBS_ARRAYID-1)*$nodeuse +1)) | |
jstop=$(($PBS_ARRAYID*$nodeuse)) | |
for j in $(seq -w $jstart 1 $jstop) | |
do | |
file_use=$(awk -v lineno=$j '{if(NR==lineno) print}' $outputfile) | |
# zcat "$probdir"/"$file_use" | awk -v s=$nsub '{ printf $1 "," $2 "," $3; for(i=1; i<=s; i++) printf "," $(i*2+2)*2+$(i*2+3); printf "\n" }' | gzip > "$outdir"/"$file_use".doscnt.gz & #Convert file to a single entry dosage format | |
$plink_location --fam "$probdir"/"$file_use".fam --dosage "$probdir"/"$file_use".gz format=2 --pheno $phenotype --covar $covariate --out "$outdir"/$file | |
done | |
wait |
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
#Bash version, no job script neded | |
cut -d " " -f1,2,4 /home/maihofer/vets/qc/pca/pts_vets_mix_am-qc-eur_pca.menv.mds_cov > ea_mds.cov | |
PHENO=pts_vets_mix_am-qc.pheno | |
cov=ea_mds.cov | |
#Specify where probability format genotypes are stored | |
probdir=/home/maihofer/vets/qc/imputation/dasuqc1_pts_vets_mix_am-qc.hg19.ch.fl/qc1 | |
#Specify where output will be stored | |
outdir=/home/maihofer/vets/qc/infoscores | |
#List dosages files | |
ls $probdir | grep .gz$ | sed 's/.gz//g' > files_to_analyze.txt | |
for file in $(head -n1 files_to_analyze.txt) | |
do | |
$plink_location --fam "$probdir"/"$file".fam --dosage "$probdir"/"$file".gz format=2 --pheno $PHENO --covar $cov --out "$outdir"/$file | |
done | |
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
#Job script version | |
cut -d " " -f1,2,4 /home/maihofer/vets/qc/pca/pts_vets_mix_am-qc-eur_pca.menv.mds_cov > ea_mds.cov | |
PHENO=pts_vets_mix_am-qc.pheno | |
cov=ea_mds.cov | |
#Specify where probability format genotypes are stored | |
probdir=/home/maihofer/vets/qc/imputation/dasuqc1_pts_vets_mix_am-qc.hg19.ch.fl/qc1 | |
#Specify where output will be stored | |
outdir=/home/maihofer/vets/qc/infoscores | |
#List dosages files | |
ls $probdir | grep .gz$ | sed 's/.gz//g' > files_to_analyze.txt | |
qsub analyze_dosages.pbs -t 1-$totjobs -d $workingdir -F "-a $PHENO -b $cov -d $outdir -p $probdir -n $nodeuse -o files_to_analyze.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment