-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to generate a figure like the Supplementary figure 4C in your paper? #272
Comments
Hello, That figure is the result of an ATA from a series of KO vs WT comparisons. Here is an example for the test data. We make a copy of the test data to show how to do it for multiple samples, and because it is a copy, the log2 fold change will show as 0. library(GENOVA)
exp <- get_test_data("40k")
explist <- list(dat1 = exp, dat2 = exp)
# Call TADs with insulation score
ins <- insulation_score(explist)
tads <- call_TAD_insulation(ins, min_strength = 0)[[1]]
# Feed TADs to ATA
ata <- ATA(explist, tads)
visualise(ata, colour_lim = c(0, 600)) Created on 2021-07-08 by the reprex package (v1.0.0) |
I think @robinweide might now the exact details, but I presume it would have been something like the following. Example assumes you've run the previous chunk posted above. library(data.table)
library(ggplot2)
# Melt array
df <- data.table(
x = as.vector(slice.index(ata$signal, 1)),
y = as.vector(slice.index(ata$signal, 2)),
sample = as.vector(slice.index(ata$signal, 3)),
value = as.vector(ata$signal)
)
# Calculate distance (unit is arbitrary due to ATA)
df[, dist := x - y]
# Take averages per off-diagonal band
df <- df[, list(value = mean(value)), by = c("dist", "sample")]
# Split by sample
df <- split(df, df$sample)
# Adjust sample 2 a bit so that a difference will show
# Don't do this with real data!
df[[2]][, value := sqrt(value)]
# Recombine the two samples, if you have more, this needs to be repeated for all samples
df <- df[[1]][df[[2]], on = c("dist")]
# Convert distance to TAD units
df[, dist := scales::rescale(dist, to = c(-2, 2))]
# Plot stuff
ggplot(df, aes(dist, value / i.value)) +
geom_line(aes(colour = sample)) |
Bravo! Thank you very much. Now I understand the structure of |
Hi,
I would like to plot a figure like the Supplementary figure 4C in your bioRxiv paper? Could you please give me some guides to do that?
Thanks,
Yiwei
The text was updated successfully, but these errors were encountered: