Skip to content

Commit

Permalink
fix: changed the figure 1 and 3
Browse files Browse the repository at this point in the history
  • Loading branch information
iaradsouza1 committed May 8, 2024
1 parent 3476857 commit 831b88e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
4 changes: 4 additions & 0 deletions scripts/metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ ann$rin <- scale(ann$rin)[,1]
rownames(ann) <- ann$sample_id
ann$sample_id <- NULL

# Keep the full dataframe
ann_full <- ann

# Remove samples "SRR5961961" and "SRR5961809" that appeared as outliers on robust pca analysis
ann <- ann %>%
filter(!(rownames(ann) %in% c("SRR5961961", "SRR5961809")))

# Save (this metadata will be used in all future models)
save(ann, file = "results/important_variables/ann.rda")
save(ann_full, file = "results/important_variables/ann_full.rda")



11 changes: 4 additions & 7 deletions scripts/network.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ addGraph(rdp, g)
nodes <- read_tsv("results/networks/model_nodes.txt")
edges <- read_delim("results/networks/model_edges.txt")

nodes <- read_tsv("~/model_nodes.txt")
edges <- read_delim("~/model_edges.txt")

# Import nodes coordinates determined by vivagraph
layout <- read.csv("results/networks/layout.csv")

Expand All @@ -109,16 +106,16 @@ ggraph(g, x = x, y = y) +
data = as_data_frame(g, "vertices") %>% filter(gwas == "gwas"),
colour = NA,
n = 5,
pie_scale = 0.5,
pie_scale = 0.9,
show.legend = F) +
geom_scatterpie(
cols = c("a", "b", "c"),
data = as_data_frame(g, "vertices") %>% filter(gwas == "not_gwas"),
colour = NA,
pie_scale = 0.2,
pie_scale = 0.3,
show.legend = F
) +
geom_node_text(aes(label = alias), size = 0.9, nudge_x = 2, nudge_y = 4) +
#geom_node_text(aes(label = alias), size = 1.7, nudge_x = 2, nudge_y = 4) +
#geom_node_label(aes(label = alias)) +
scale_fill_manual(values = c("#0ac80aff", "#4f4affff", "#ff822fff")) +
coord_fixed() +
Expand All @@ -130,7 +127,7 @@ if(!dir.exists("results/plots_paper/")) {
dir.create("results/plots_paper")
}

svg(filename = "results/plots_paper/network.svg", height = 10, width = 10)
pdf(file = "~/Área de Trabalho/network.pdf", height = 15, width = 15)
print(p)
dev.off()

Expand Down
40 changes: 38 additions & 2 deletions scripts/plots.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,45 @@ ggsave("results/plots_paper/fig2C_2.png", height = 4, width = 5, dpi = 300)
```

## Figure 3
# Figure 3

Figure 3 was produced on the biotype analysis, in the `summarise_biotypes.R` script.
```{r}
# Load enrichment data
load("results/tx_enrich/go_terms_tx_by_group.rda")
# Create a dataframe with results from OFC (female) and CG25 (male) enrichment
df_enrich <- bind_rows(enriched_df_diff[["OFC_female"]], enriched_df_diff[["Cg25_male"]])
# Parse gene ratio column
df_enrich <- df_enrich %>% mutate(
n_tag = as.numeric(sapply(strsplit(GeneRatio, split = "\\/"), "[[", 2)),
GeneRatio = as.numeric(Count) / n_tag
)
# Plot
df_enrich %>%
ggplot(aes(x = fct_reorder2(Description, -p.adjust, -Count), y = GeneRatio, size = Count, col = p.adjust)) +
geom_point() +
facet_grid(rows = vars(group), scales = "free_y", space = "free_y",
labeller = as_labeller(c(
"Cg25_male" = "Cg25 (male)",
"OFC_female" = "OFC (female)"
))) +
force_panelsizes(rows = c(0.17, 1)) +
scale_color_continuous(limits = c(0, 0.05), breaks = seq(0, 0.05, 0.01)) +
labs(x = "", y = "Gene ratio", color = "FDR", size = "Intersection") +
coord_flip() +
theme_bw() +
theme(axis.text.y = element_text(size = 9),
strip.text.y = element_text(size = 9))
ggsave(filename = "results/plots_paper/fig3.pdf", width = 9, height = 6)
ggsave(filename = "results/plots_paper/fig3.png", width = 9, height = 6)
```

## Figure 4

Figure 4 was produced on the biotype analysis, in the `summarise_biotypes.R` script.


# Supplementary Figures
Expand Down

0 comments on commit 831b88e

Please sign in to comment.