PATH_IN='/home/binsrv5/gtex/'
# PATH_IN='/u/laumontc/tsaPaper/test'
TISSUE='urinary_bladder'
TSA_FILE='/u/laumontc/tsaPaper/encode/natMed/tsaCandidates_pcrs_allSamples.txt'
#'/u/laumontc/tsaPaper/gtex/natMed/allCandidates_pcrs_allSamples.txt'
STAT_FILE='/u/laumontc/tsaPaper/gtex/stats.txt'
PATH_OUT='/u/laumontc/tsaPaper/gtex/natMed'


mkdir $PATH_OUT/$TISSUE'_tasks'

# if [ ! -d  $PATH_OUT/'res' ]; then
#     mkdir $PATH_OUT/'res'
# fi

for donor in $(find $PATH_IN/$TISSUE/ -mindepth 2 | grep ".*\.jf")
do
    echo $donor
    echo "python /u/laumontc/tsaPaper/scripts/gtex/queryHumanTSA.py ${TSA_FILE} ${STAT_FILE} ${donor} ${PATH_OUT}/res" \
    	 | qsub -V -l nodes=1:ppn=4,mem=24gb,walltime=48:00:00 -N gtex_${donor} -d $PATH_OUT/$TISSUE'_tasks'
done

# paste $TSA_FILE $PATH_OUT/$TISSUE_*.tmp >  $PATH_OUT/$TISSUE.count
