From 133afed7dd538084d1f31a467f8403c34e4338d4 Mon Sep 17 00:00:00 2001 From: Martin Raden Date: Thu, 24 Feb 2022 21:00:58 +0100 Subject: [PATCH] minpair plot R script updated --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 87e9c59..7089b38 100644 --- a/README.md +++ b/README.md @@ -1774,6 +1774,24 @@ mfe-site in the second sequence and are thus less likely to occure. ![Minimal interaction energy index pair information](./doc/figures/pair-minE.png) +A more sophisticated plot can be done using `ggplot2` from the `tidyverse` package. + +```R +library(tidyverse) + +read_delim("pairMinE-t1q1.csv", delim=";") %>% + replace(is.na(.), 0) %>% + rename( target = minE ) %>% + pivot_longer( cols=-target, names_to = "query", values_to = "E" ) %>% + separate( query, into = c("qSeq","qIdx"), sep = "_") %>% + separate( target, into = c("tSeq","tIdx"), sep = "_") %>% + mutate(across(c(tIdx,qIdx,E),as.numeric)) %>% + mutate(E = ifelse( E>0, 0, E)) %>% + ggplot(aes(x=tIdx,y=qIdx, fill=E)) + + geom_tile() + + scale_fill_gradient(low="blue",high="red") +``` + [![up](doc/figures/icon-up.28.png) back to overview](#overview)