library(tidyverse)
## Warning: package 'ggplot2' was built under R version 4.4.3
## Warning: package 'tibble' was built under R version 4.4.3
## Warning: package 'tidyr' was built under R version 4.4.3
## Warning: package 'readr' was built under R version 4.4.3
## Warning: package 'purrr' was built under R version 4.4.3
## Warning: package 'dplyr' was built under R version 4.4.3
## Warning: package 'lubridate' was built under R version 4.4.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## âś” dplyr 1.2.0 âś” readr 2.2.0
## âś” forcats 1.0.1 âś” stringr 1.6.0
## âś” ggplot2 4.0.2 âś” tibble 3.3.1
## âś” lubridate 1.9.5 âś” tidyr 1.3.2
## âś” purrr 1.2.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## âś– dplyr::filter() masks stats::filter()
## âś– dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
SFX <- read.table('ENCFF166SFX.tsv', header = TRUE)
expression_groups <- SFX %>%
mutate(expression_level = case_when(
TPM == 0 ~ "Not expressed",
TPM < 1 ~ "Low",
TPM < 10 ~ "Moderate",
TPM >= 10 ~ "High")) %>%
count(expression_level)
ggplot(expression_groups, aes(x = expression_level, y = n)) +
geom_col(fill = "pink") +
labs(title = "Genes by Expression Level", x = "Expression Level", y = "Number of Genes") +
theme_classic()

The bar graph identifies the genes according to their level of
expression in the brain tissue. It shows that genes are expressed at
different levels. Many genes have little to no expression while few
genes were highly expressed. We can infer that some genes are much more
active in the brain tissue, and the activity is not evenly
distributed.
top20genes <- SFX %>%
arrange(desc(TPM)) %>%
slice_head(n = 20)
ggplot(top20genes, aes(x = reorder(gene_id, TPM), y = TPM)) +
geom_col(fill = "orange") +
coord_flip() +
labs( title = "Top 20 Most Highly Expressed Genes",x = "Gene", y = "TPM") +
theme_classic()

This plot shows the top 20 genes with the highest level of
expression in the brain tissue. Highly expressed genes might be more
involved in important cellular processes. This is not a clear connection
between the highly expressed genes and Alzheimer’s disease, just mearly
an observation based on this one brain tissue sample.
ggplot(SFX, aes(x = length, y = TPM)) +
geom_point(shape=4, alpha = 0.3) +
scale_y_log10() +
labs(title = "Gene Length and Gene Expression", x = "Gene Length", y = "TPM (log scale)") + theme_classic()
## Warning in scale_y_log10(): log-10 transformation introduced infinite values.

This plot shows if gene length is related to gene expression in the
brain tissue. Since the points are scattered everywhere (mainly
concentrated towards the lower gene length) it is clear that gene length
doesn’t drive gene expression alone. There may be other biological
factors such as gene regulation or type of brain cell.