nievergeltlab
8/29/2017 - 3:17 PM

Dosage to best guess, handler for ricopili script, to correct best guess to include low freq variants

Dosage to best guess, handler for ricopili script, to correct best guess to include low freq variants



#Specify where probability format genotypes are stored
probdir=/home/maihofer/yehuda/WRBY/qc/imputation/dasuqc1_pts_wrby_mix_am-qc.hg19.ch.fl/qc1

#Specify where output will be stored 
outdir=/home/maihofer/yehuda/WRBY/test

#Specify working directory (error logs will go here)
workingdir=/home/maihofer/yehuda/WRBY


ls $probdir | grep .gz$ > files_to_make_dose.txt

#Number of commands to run is a function of the number of files
ncommands=$(wc -l files_To_make_dose.txt | awk '{print $1}' )

#Make a job code, where 'nodesize' processes will run on each node simultaneously
 nodesize=16
 nodeuse=$(($nodesize - 1))

#Total number of jobs = Number of commands / number of commands used per job, rounded up 
totjobs=$(( ($ncommands + $nodeuse - 1 ) / $nodeuse ))


qsub bg_fix.pbs  -t 1-$totjobs -d $workingdir -F "-f files_To_make_dose.txt -d $outdir -i $probdir -n $nodeuse -p /home/maihofer/yehuda/plink"

#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}"
    in
      i) indir=${OPTARG};;
      f) file_list=${OPTARG};;
      p) plinkloc=${OPTARG};;
      d) outdir=${OPTARG};;
      n) nodeuse=${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}' $file_list)
  perl /home/maihofer/ricopili/rp_bin_manc/daner_bg3_am  $file_use --freq_th 0 --info_th 0.02  --ploc $plinkloc --indir $indir  --outdir $outdir &
 done
wait