This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Heatmap / Gene List Similarity

I have a file with Transcription Factors (TF) and the predicted Target Genes (TG) they regulate, followed by the regulation score of the transcription factor on the target gene:

TF  TG  Score
SOX2    STMN2   0.34215
SOX2    SALL1   0.124431
SOX2    PDPN    0.0443292
SOX2    UGT8    0.0371112
PRDM1   APLNR   0.0197349

I have a file like this for two samples. Each file has different transcription factors, target genes, and regulation scores. I would like to find the % similarity between the files.

Ideally the % similarity would reflect if the same transcription factor / target gene pair is present in both files, and if the regulation score is close to the same value or not (ie if regulation score 1 - regulation score 2 is large then less similarity, if small then more similarity). How best to code this in R?

I use these files to make heatmaps, so if there is a tool for comparing heatmaps, that could also work.

r

1 answer

if file be:

TF  TG  Score
SOX2    STMN2   0.34215
SOX2    SALL1   0.84431
SOX2    PDPN    0.743292
SOX2    UGT8    0.471112
PRDM1   APLNR   0.0197349
NP  NQ  0.25555
SD  TY  0.588

and file1 be:

TF  TG  Score
SOX2    STMN2   0.34215
SOX2    SALL1   0.124431
SOX2    PDPN    0.0443292
SOX2    UGT8    0.0371112
PRDM1   APLNR   0.0197349
SD  TY  0.255

and R code be:

f1 <- read.delim("file.txt")
f2 <- read.delim("file1.txt")
mergedTable <- merge(f1, f2, by = c("TF","TG"))
mergedTable["diffencePercentage"] = abs(mergedTable["Score.x"] - mergedTable["Score.y"]) / mergedTable["Score.x"] * 100
mergedTable[order(mergedTable$diffencePercentage),]

The result will be :

  TF    TG   Score.x   Score.y diffencePercentage
1 PRDM1 APLNR 0.0197349 0.0197349            0.00000
5  SOX2 STMN2 0.3421500 0.3421500            0.00000
2    SD    TY 0.5880000 0.2550000           56.63265
4  SOX2 SALL1 0.8443100 0.1244310           85.26240
6  SOX2  UGT8 0.4711120 0.0371112           92.12264
3  SOX2  PDPN 0.7432920 0.0443292           94.03610

Log in to answer this question.