Forked from
GIGA-CRC Human Imaging / Public / FASST / MRS-GABA-NMM
3 commits ahead of the upstream repository.
-
Paparella Ilenia authoredPaparella Ilenia authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
RegressionPlots.R 3.71 KiB
#### STR7T_HS -- CORRELATION ANALYSIS TMS-EEG DERIVED GABA MEASURES AND MRS ONES
## -------------------------------------------------------------------------------------------------------------------
## Created: Thursday Dec 21 14:37 2023 -- author: ipaparella@uliege.be
# To check citation (for referencing) for any of the package used in this script just run citation("package")
## -------------------------------------------------------------------------------------------------------------------
### WHAT IS THIS SCRIPT DOING?
## 1. Regression plots of the relationships shown by PEB analysis.
## --------------------------------------------------------------------------------------------------------------------
## --------------------------------------------------------------------------------------------------------------------
## --------------------------------------------------------------------------------------------------------------------
## --------------------------------------------------------------------------------------------------------------------
# Import Libraries
library("ggpubr")
library("tidyverse")
library("ggplot2")
library(viridis)
# Import data
GABAmetrix_onlyFem <- read.csv("/mnt/data/STR7T_HS/Prepared/STR7T_NMM_perSess_DefaultCodes_AllSubjects.txt")
### 1.
EI_MRS = GABAmetrix_onlyFem$MRS_GABA/GABAmetrix_onlyFem$MRS_GLU
data.frame(EI_MRS)
GABAmetrix_onlyFem = cbind(GABAmetrix_onlyFem, EI_MRS)
# Average of tonic and phasic inhib (just the significant values)
TonicInhib_sign = rowMeans(subset(GABAmetrix_onlyFem, select = c(SC, II, DP)), na.rm = TRUE)
PhasicInhib_sign = rowMeans(subset(GABAmetrix_onlyFem, select = c(II.DP)), na.rm = TRUE)
# Add this to table
GABAmetrix_onlyFem = cbind(GABAmetrix_onlyFem, TonicInhib_sign, PhasicInhib_sign)
# Check colors in virdis palette
# library(scales)
# v_colors = viridis(30, option = 'D') -> number means how many colors you want to see
# show_col(v_colors)
# Plots
ggplot(GABAmetrix_onlyFem, aes(x=MRS_GABA, y=GABAa)) +
geom_point(alpha=0.7, color="#3C508BFF", size = 4) +
geom_smooth(method=lm , color="#3C508BFF", fill="#3C508BFF", se=TRUE)+
theme_classic()+
xlab("GABA:Cr") +
ylab("GABAa")+
font("xy.text", size = 20, color = "black")+
scale_y_continuous(labels = scales::label_number(accuracy = 0.1))
#
GABA_MRS_Tonic = cor.test(GABAmetrix_onlyFem$TonicInhib_sign, GABAmetrix_onlyFem$MRS_GABA,
method="spearman",exact=FALSE)
GABA_MRS_Tonic
ggplot(GABAmetrix_onlyFem, aes(x=MRS_GABA, y=TonicInhib_sign)) +
geom_point(alpha=0.7, color="#1F948CFF", size = 4) +
geom_smooth(method=lm , color="#1F948CFF", fill="#1F948CFF", se=TRUE)+
theme_classic()+
xlab("GABA:Cr") +
ylab("Tonic Inhibition")+
font("xy.text", size = 20, color = "black")
#### -> 3rd round revision menstrual cycle effect. Plot linear regression with menstrual cycle category
# Create extra column with cycle factor
Cycle=c('M', 'M', 'M', 'M', 'L', 'L', 'M', 'F', 'L', 'F', 'None', 'M', 'F', 'F', 'M', 'F', 'F', 'M', 'L', 'L')
data.frame(Cycle)
GABAmetrix_onlyFem_cycle = cbind(GABAmetrix_onlyFem, Cycle)
# Plots
ggplot(GABAmetrix_onlyFem_cycle, aes(x=MRS_GABA, y=GABAa, col=Cycle)) +
geom_point(alpha=0.7, size = 4) +
geom_smooth(method=lm , color="#3C508BFF", fill="#3C508BFF", se=TRUE)+
theme_classic()+
xlab("GABA:Cr") +
ylab("GABAa")+
font("xy.text", size = 20, color = "black")+
scale_y_continuous(labels = scales::label_number(accuracy = 0.1))
#
ggplot(GABAmetrix_onlyFem_cycle, aes(x=MRS_GABA, y=TonicInhib_sign, col=Cycle)) +
geom_point(alpha=0.7, size = 4) +
geom_smooth(method=lm , color="#1F948CFF", fill="#1F948CFF", se=TRUE)+
theme_classic()+
xlab("GABA:Cr") +
ylab("Tonic Inhibition")+
font("xy.text", size = 20, color = "black")