Skip to content

Instantly share code, notes, and snippets.

@allaway
Last active July 2, 2025 19:01
Show Gist options
  • Select an option

  • Save allaway/d43acc756b8d4bbe64a595e1907933fc to your computer and use it in GitHub Desktop.

Select an option

Save allaway/d43acc756b8d4bbe64a595e1907933fc to your computer and use it in GitHub Desktop.
Plot cumulative size of NF Data Portal over time
library(synapser)
library(tidyverse)
synLogin()
metadata <- synTableQuery("select createdOn, dataFileSizeBytes from syn16858331 where type = 'file'")$filepath %>%
read_csv() %>% filter(!is.na(dataFileSizeBytes)) %>%
mutate(cumulative_size=cumsum(dataFileSizeBytes)/1e12) %>%
mutate(cumulative_count=row_number()) %>%
mutate(date = createdOn/1000) %>%
mutate(date = lubridate::as_date(lubridate::as_datetime(date, origin = lubridate::origin)))
sf <- 1500
ggplot(metadata) +
geom_line(aes(x=date, y=cumulative_size), color = "red") +
geom_line(aes(x=date, y=cumulative_count/sf), color = "blue") +
scale_x_date(date_breaks = "1 year", date_labels = "%Y") +
scale_y_continuous(sec.axis = sec_axis(trans = ~.*sf, name = "# of files", labels = scales::comma)) +
labs(x = "Year", y = "Cumulative Size (TB)") +
theme_minimal() +
theme(
axis.title.y.left=element_text(color="red"),
axis.text.y.left=element_text(color="red"),
axis.title.y.right=element_text(color="blue"),
axis.text.y.right=element_text(color="blue")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment