forked from VUmcCGP/sanefalcon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepSamples.sh
executable file
·36 lines (31 loc) · 906 Bytes
/
prepSamples.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
INDIR=$1
OUTDIR=$2
mkdir $OUTDIR
export DIR_FETALFRAC=~/fetalfrac
export SCRIPT_RETRO=$DIR_FETALFRAC/retro.py
export DIR_SCRIPTS=/illumina/diagnostics/bin
export SCRIPT_PYTHON=/illumina/diagnostics/bin/Python-2.7.3/bin/python
export SCRIPT_SAMTOOLS=$DIR_SCRIPTS/samtools-0.1.19/samtools
for SAMPLE in `find $INDIR -name "*.bam"`
do
SHORT=`echo $SAMPLE | rev | cut -d"/" -f1 | rev`
OUTFILE="$OUTDIR/${SHORT//".sort.bam"/}"
echo "IN:$SAMPLE, OUT:$OUTFILE"
for ARG_TASKID in `seq 1 22` # or "X"
do
$SCRIPT_SAMTOOLS view \
$SAMPLE \
chr$ARG_TASKID \
-F 20 -q 1 | \
$SCRIPT_PYTHON $SCRIPT_RETRO | \
awk '{print $4}' \
> $OUTFILE.$ARG_TASKID.start.fwd &
$SCRIPT_SAMTOOLS view \
$SAMPLE \
chr$ARG_TASKID \
-f 16 -F 4 -q 1 | \
$SCRIPT_PYTHON $SCRIPT_RETRO | \
awk '{print ($4 + length($10) - 1)}' \
> $OUTFILE.$ARG_TASKID.start.rev
done
done