Hi I have two tables which are related in the following way :
Table1
gene goterms
ape 1a
ape 1b
ape 1c
boy 2a
boy 1a
cat 1a
cat 1c
Table2
gene gene count
ape ape 3
ape boy 1
ape cat 2
boy ape 1
boy boy 2
boy cat 1
cat ape 2
cat boy 1
cat cat 2
now,i need value that corresponds to second row of table2 as = (count)/(count of ape from table 1 + count of boy from table 1) - count
for [ape boy 1] row , value = 1 / ((3 + 2) - 1 ) = 0.25
similarly for all the other rows in table2.
The output must be like
Table3 gene gene count calc ape ape 3 1 ape boy 1 .25 ape cat 2 .5 boy ape 1 .25 boy boy 2 1 boy cat 1 .2 cat ape 2 .5 cat boy 1 .2 cat cat 2 1
I need a sql query for this , i attempted in many ways but in vain.
Thank you...