Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hypothalamus_light_7TfMRI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GIGA-CRC Human Imaging
Public
FASST
Hypothalamus_light_7TfMRI
Commits
6887ea40
Commit
6887ea40
authored
9 months ago
by
Vandewalle Gilles
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
8d662580
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Statistical_scripts/Hypo_Graphs.R
+191
-0
191 additions, 0 deletions
Statistical_scripts/Hypo_Graphs.R
with
191 additions
and
0 deletions
Statistical_scripts/Hypo_Graphs.R
0 → 100644
+
191
−
0
View file @
6887ea40
### Script for elife Paper - 18/04/2024
### Install Packages
install.packages
(
"GGally"
)
install.packages
(
"ggplot2"
)
install.packages
(
"ggpubr"
)
install.packages
(
"readxl"
)
install.packages
(
"viridis"
)
install.packages
(
"dplyr"
)
install.packages
(
"viridis"
)
install.packages
(
"plotrix"
)
### Load Packages
library
(
viridis
)
library
(
"GGally"
)
library
(
"ggplot2"
)
library
(
ggpubr
)
library
(
readxl
)
library
(
dplyr
)
library
(
RColorBrewer
)
library
(
"plotrix"
)
### Figure 2 - B, C
# Emotinal Task
E_beta
<-
read.csv
(
"EMO_hypo_analysis_5areas.csv"
)
EmoM
<-
ggplot
(
E_beta
,
aes
(
x
=
as.factor
(
Hypo
),
y
=
Beta_EDI
,
fill
=
as.factor
(
Emo
)))
+
geom_boxplot
()
+
geom_point
(
alpha
=
0.6
,
position
=
position_dodge
(
0.75
))
+
xlab
(
"Hypothalamus Subparts"
)
+
ylab
(
"Betas (a.u.)"
)
+
labs
(
tag
=
"C"
)
+
labs
(
fill
=
"Stimuli"
)
+
geom_hline
(
aes
(
yintercept
=
0
),
colour
=
"azure4"
,
linetype
=
"dashed"
)
+
theme_classic
()
+
theme
(
plot.title
=
element_text
(
size
=
16
),
text
=
element_text
(
size
=
24
,
face
=
"bold"
),
legend.text
=
element_text
(
size
=
18
,
face
=
"bold"
),
legend.key.size
=
unit
(
1
,
'cm'
),
legend.title
=
element_text
(
size
=
18
),
legend.position
=
c
(
0.7
,
0.92
),
legend.box
=
"horizontal"
,
legend.background
=
element_rect
(
size
=
0.5
,
linetype
=
"solid"
,
colour
=
"black"
))
+
scale_fill_brewer
(
palette
=
"Purples"
)
### Nback Task
N_beta
<-
read.csv
(
"Nback_hypo_Analysis_Mel_5areas_Nback.csv"
)
NbackM
<-
ggplot
(
N_beta
,
aes
(
x
=
as.factor
(
Hypo
),
y
=
Beta_EDI_Nback
,
fill
=
as.factor
(
Nback
)))
+
geom_boxplot
()
+
scale_fill_manual
(
values
=
c
(
'#F7FCF5'
,
"#A1D99B"
))
+
geom_point
(
alpha
=
0.6
,
position
=
position_dodge
(
0.75
))
+
xlab
(
"Hypothalamus subparts"
)
+
ylab
(
"Betas (a.u.)"
)
+
labs
(
tag
=
"B"
)
+
labs
(
fill
=
"Task"
)
+
theme_classic
()
+
theme
(
plot.title
=
element_text
(
size
=
16
),
text
=
element_text
(
size
=
24
,
face
=
"bold"
),
legend.text
=
element_text
(
size
=
18
,
face
=
"bold"
),
legend.key.size
=
unit
(
1
,
'cm'
),
legend.title
=
element_text
(
size
=
18
),
legend.box
=
"horizontal"
,
legend.position
=
c
(
0.7
,
0.92
),
legend.background
=
element_rect
(
size
=
0.5
,
linetype
=
"solid"
,
colour
=
"black"
))
+
geom_hline
(
aes
(
yintercept
=
0
),
colour
=
"azure4"
,
linetype
=
"dashed"
)
+
scale_y_continuous
(
limits
=
c
(
-0.005
,
0.006
))
# Combine Graphs
ggarrange
(
NbackM
,
EmoM
,
ncol
=
2
,
nrow
=
1
)
### Figure 2 - I, J, K, L
### Load executive task data
Nback2
<-
read.csv
(
"Hypothalamus_paper_Nback2_mEDIchange.csv"
)
#mEDI changed from 0.16 to 10
Nback0
<-
read.csv
(
"Hypothalamus_paper_Nback0_mEDIchange.csv"
)
#mEDI changed from 0.16 to 10
### Load emotional task data
Emo
<-
read.csv
(
"Hypo_5Con_analysis_all_hypo_Emotional_mEDIchange.csv"
)
#mEDI changed from 0.16 to 10
Neut
<-
read.csv
(
"Hypo_5Con_analysis_all_hypo_Neutral_mEDIchange.csv"
)
#mEDI changed from 0.16 to 10
### create graph error bars
data2
<-
Nback2
%>%
group_by
(
Hypo
,
mEDI
)
%>%
summarise
(
mean_beta
=
mean
(
Beta
),
se
=
std.error
(
Beta
),
Min
=
min
(
Beta
),
Max
=
max
(
Beta
),
sd
=
sd
(
Beta
),
ci
=
mean_cl_normal
(
Beta
)
%>%
rename
(
mean
=
y
,
lwr
=
ymin
,
upr
=
ymax
))
data0
<-
Nback0
%>%
group_by
(
Hypo
,
mEDI
)
%>%
summarise
(
mean_beta
=
mean
(
Beta
),
se
=
std.error
(
Beta
),
Min
=
min
(
Beta
),
Max
=
max
(
Beta
),
sd
=
sd
(
Beta
),
ci
=
mean_cl_normal
(
Beta
)
%>%
rename
(
mean
=
y
,
lwr
=
ymin
,
upr
=
ymax
))
dataE
<-
Emo
%>%
group_by
(
Hypo
,
Light
)
%>%
summarise
(
mean_beta
=
mean
(
Betas_Emo
),
se
=
std.error
(
Betas_Emo
),
Min
=
min
(
Betas_Emo
),
Max
=
max
(
Betas_Emo
),
sd
=
sd
(
Betas_Emo
),
ci
=
mean_cl_normal
(
Betas_Emo
)
%>%
rename
(
mean
=
y
,
lwr
=
ymin
,
upr
=
ymax
))
dataN
<-
Neut
%>%
group_by
(
Hypo
,
Light
)
%>%
summarise
(
mean_beta
=
mean
(
Betas_Emo
),
se
=
std.error
(
Betas_Emo
),
Min
=
min
(
Betas_Emo
),
Max
=
max
(
Betas_Emo
),
sd
=
sd
(
Betas_Emo
),
ci
=
mean_cl_normal
(
Betas_Emo
)
%>%
rename
(
mean
=
y
,
lwr
=
ymin
,
upr
=
ymax
))
### Create Plots
# 2-back
F2I
<-
ggplot
(
data2
,
aes
(
x
=
mEDI
,
y
=
mean_beta
,
color
=
as.factor
(
Hypo
)))
+
geom_line
(
aes
(
group
=
Hypo
),
linewidth
=
0.8
)
+
scale_color_manual
(
values
=
c
(
'#EEEE00'
,
'#00008B'
,
"#00F5FF"
,
"#CDB79E"
,
"#00FF00"
))
+
geom_point
(
alpha
=
0.6
)
+
xlab
(
"Melanopic EDI"
)
+
ylab
(
"2-back Betas (a.u.)"
)
+
labs
(
tag
=
"I"
)
+
labs
(
col
=
"Hypothalamus Subpart"
)
+
theme_classic
()
+
theme
(
text
=
element_text
(
size
=
16
,
face
=
"bold"
),
legend.text
=
element_text
(
size
=
16
,
face
=
"bold"
),
legend.title
=
element_text
(
size
=
16
),
legend.box
=
"horizontal"
,
legend.position
=
'none'
)
+
geom_linerange
(
aes
(
ymin
=
mean_beta
-
se
,
ymax
=
mean_beta
+
se
))
+
scale_x_continuous
(
breaks
=
c
(
0
,
10
,
37
,
92
,
190
))
# 0-back
F2J
<-
ggplot
(
data0
,
aes
(
x
=
mEDI
,
y
=
mean_beta
,
color
=
as.factor
(
Hypo
)))
+
geom_line
(
aes
(
group
=
Hypo
),
linewidth
=
0.8
)
+
scale_color_manual
(
values
=
c
(
'#EEEE00'
,
'#00008B'
,
"#00F5FF"
,
"#CDB79E"
,
"#00FF00"
))
+
geom_point
(
alpha
=
0.6
)
+
xlab
(
"Melanopic EDI"
)
+
ylab
(
"0-back Betas (a.u.)"
)
+
labs
(
tag
=
"J"
)
+
labs
(
col
=
"Hypothalamus Subpart"
)
+
theme_classic
()
+
theme
(
text
=
element_text
(
size
=
16
,
face
=
"bold"
),
legend.text
=
element_text
(
size
=
16
,
face
=
"bold"
),
legend.title
=
element_text
(
size
=
16
),
legend.box
=
"horizontal"
,
legend.position
=
'none'
)
+
geom_linerange
(
aes
(
ymin
=
mean_beta
-
se
,
ymax
=
mean_beta
+
se
))
+
scale_x_continuous
(
breaks
=
c
(
0
,
10
,
37
,
92
,
190
))
F2K
<-
ggplot
(
dataE
,
aes
(
x
=
Light
,
y
=
mean_beta
,
color
=
as.factor
(
Hypo
)))
+
geom_line
(
aes
(
group
=
Hypo
),
linewidth
=
0.8
)
+
scale_color_manual
(
values
=
c
(
'#EEEE00'
,
'#00008B'
,
"#00F5FF"
,
"#CDB79E"
,
"#00FF00"
))
+
geom_point
(
alpha
=
0.6
)
+
xlab
(
"Melanopic EDI"
)
+
ylab
(
"Emotional Betas (a.u.)"
)
+
labs
(
tag
=
"K"
)
+
labs
(
col
=
"Hypothalamus Subpart"
)
+
theme_classic
()
+
theme
(
text
=
element_text
(
size
=
16
,
face
=
"bold"
),
legend.text
=
element_text
(
size
=
16
,
face
=
"bold"
),
legend.title
=
element_text
(
size
=
16
),
legend.box
=
"horizontal"
,
legend.position
=
'none'
)
+
geom_linerange
(
aes
(
ymin
=
mean_beta
-
se
,
ymax
=
mean_beta
+
se
))
+
scale_x_continuous
(
breaks
=
c
(
0
,
10
,
37
,
92
,
190
))
# Neut
F2L
<-
ggplot
(
dataN
,
aes
(
x
=
Light
,
y
=
mean_beta
,
color
=
as.factor
(
Hypo
)))
+
geom_line
(
aes
(
group
=
Hypo
),
linewidth
=
0.8
)
+
scale_color_manual
(
values
=
c
(
'#EEEE00'
,
'#00008B'
,
"#00F5FF"
,
"#CDB79E"
,
"#00FF00"
))
+
geom_point
(
alpha
=
0.6
)
+
xlab
(
"Melanopic EDI"
)
+
ylab
(
"Neutral Betas (a.u.)"
)
+
labs
(
tag
=
"L"
)
+
labs
(
col
=
"Hypothalamus Subpart"
)
+
theme_classic
()
+
theme
(
text
=
element_text
(
size
=
16
,
face
=
"bold"
),
legend.text
=
element_text
(
size
=
16
,
face
=
"bold"
),
legend.title
=
element_text
(
size
=
16
),
legend.box
=
"horizontal"
)
+
geom_linerange
(
aes
(
ymin
=
mean_beta
-
se
,
ymax
=
mean_beta
+
se
))
+
scale_x_continuous
(
breaks
=
c
(
0
,
10
,
37
,
92
,
190
))
### Combine plots
ggarrange
(
F2I
,
F2J
,
F2K
,
F2L
,
ncol
=
2
,
nrow
=
2
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment