-
Notifications
You must be signed in to change notification settings - Fork 4
/
add_expressions_to_receptors
executable file
·50 lines (44 loc) · 1.58 KB
/
add_expressions_to_receptors
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
NULL=0
ONES=1
seven=7
cosmic=`cat $WORKDIR/cosmic`
> $WORKDIR/receptors_contracted.tmp
while read -r line #add z_score and normalized gene exp factor to receptors_contracted file (5th and 6th column)
do
flag=`echo $line | awk '{print $4}'`
Uniprot_ID=`echo $line | awk '{print $3}'` #check if entry is protein or compound
nochars=`echo -n $Uniprot_ID | wc -c`
if [ $nochars -gt $seven ]
then
entry=`echo $Uniprot_ID | head -c 7`
else
entry=protein
fi
if [ $entry != pubchem ]
then #we have a protein
> $WORKDIR/tmp
grep $Uniprot_ID ./genes/expression_scores.csv > $WORKDIR/tmp
lines=`wc -l < $WORKDIR/tmp`
if [[ $lines -eq $NULL ]] || [[ $flag == "F" ]]
then
z_score=0.000
else
if [ $lines -ne $ONES ]
then
head -1 $WORKDIR/tmp > $WORKDIR/tmp2 ; mv $WORKDIR/tmp2 $WORKDIR/tmp
fi
if [ $cosmic == y ]
then
z_score=`cat $WORKDIR/tmp | awk -F',' '{print $2}'`
else
z_score=0.000
fi
fi
else #we have a compound
z_score=0.000
fi
nge=`echo ${z_score} ${ONES} | awk '{printf "%.9f \n", $1 + $2}'`
echo $line $z_score $nge >> $WORKDIR/receptors_contracted.tmp
done < $WORKDIR/receptors_contracted
tr -d $'\r' < $WORKDIR/receptors_contracted.tmp > $WORKDIR/receptors_contracted
rm $WORKDIR/receptors_contracted.tmp