Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from Haji's fork into main fork #125

Open
wants to merge 117 commits into
base: analysis
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
233ee58
1/3 of 40
JiyeongHa Apr 6, 2022
6e1c456
2/3 of 40
JiyeongHa Apr 6, 2022
90d848b
3/3 of the 40
JiyeongHa Apr 12, 2022
eb0dd7a
sn 134627
JiyeongHa May 19, 2022
c9bcae5
up to 158035
JiyeongHa May 24, 2022
a4acd3f
up to 169343
JiyeongHa May 25, 2022
6d20697
up to 195041
JiyeongHa May 25, 2022
c8d7813
up to 263436
JiyeongHa May 26, 2022
2ae6b5c
up to 878877
JiyeongHa May 27, 2022
d9b187c
~973770
JiyeongHa Jun 2, 2022
b404ad3
~172130
JiyeongHa Jul 25, 2022
529989f
Merge branch 'noahbenson:main' into main
JiyeongHa Jan 30, 2023
f89d59f
100610,102311,102816,104416,105923
JiyeongHa Jan 30, 2023
ed3ff6d
~116726
JiyeongHa Jan 30, 2023
5a1dcc6
~177645
JiyeongHa Jan 30, 2023
21384d1
~180533
JiyeongHa Jan 31, 2023
18e2251
~197348
JiyeongHa Jan 31, 2023
3d4a3c5
~381038
Feb 1, 2023
8e8c0a1
~725751
JiyeongHa Feb 15, 2023
f18597d
995174
JiyeongHa Feb 17, 2023
70b8763
re-adding the final batch
JiyeongHa Feb 17, 2023
4fb58f7
add surface file
Mar 7, 2023
c8c5436
plot relative surface area between hV4-VO2
JiyeongHa Mar 7, 2023
e6e3f14
add notebooks/ folder
JiyeongHa Mar 7, 2023
0dd057a
plot correlation heatmap
JiyeongHa Mar 15, 2023
bd510e3
plot correlation heatmap
JiyeongHa Mar 15, 2023
27a97cd
heatmap for each hemisphere
JiyeongHa Mar 15, 2023
a4768c1
fix some errors due to variable name changes
JiyeongHa Mar 20, 2023
2dfc506
refactoring the folder structure
JiyeongHa Mar 27, 2023
82c4a3b
move notebooks/ outside
JiyeongHa Mar 27, 2023
492f593
refactoring functions for plotting surface size
JiyeongHa Mar 27, 2023
d33ea47
Merge branch 'main' into analysis
JiyeongHa Mar 28, 2023
adbd5b4
merge contours-on-flatmaps.ipynb to main branch
JiyeongHa Mar 28, 2023
70cf9de
init files for plot-mean-contours-across-subjects.ipynb
JiyeongHa Mar 28, 2023
096f571
make wrapper functions for plotting mean contours across subjects
JiyeongHa Apr 3, 2023
0d40d9a
make wrapper functions for plotting mean contours across subjects
JiyeongHa Apr 3, 2023
3d01075
add VO to the column and draw a boundary between lh and rh on heatmaps
JiyeongHa Apr 3, 2023
936c818
remove xticks in violinplots
JiyeongHa Apr 3, 2023
ad82147
plot mean contours across subjects
JiyeongHa Apr 3, 2023
46b0b9b
add cache process
JiyeongHa Apr 5, 2023
ce30c2c
Merge branch 'noahbenson:main' into main
JiyeongHa Apr 6, 2023
a4be221
edit import part
JiyeongHa Apr 18, 2023
f6b406f
Merge branch 'main' of github.com:JiyeongHa/hcp-annot-vc into main
JiyeongHa Apr 18, 2023
5476c43
add contour plotting functions
JiyeongHa Apr 18, 2023
f8a0933
add contour plotting functions
JiyeongHa Apr 18, 2023
a0dfee8
run trace functions through snakemake
JiyeongHa Apr 24, 2023
c8fc036
add config to gitignore
JiyeongHa Apr 24, 2023
eebd087
use config variable
JiyeongHa Apr 24, 2023
3210e85
use config variable
JiyeongHa Apr 24, 2023
0bbda24
use config variable
JiyeongHa Apr 24, 2023
e1b1b5a
use config variable
JiyeongHa Apr 24, 2023
b2a57dd
use config variable
JiyeongHa Apr 24, 2023
0de299d
use config variable
JiyeongHa Apr 24, 2023
39fbd64
use config variable
JiyeongHa Apr 24, 2023
2b419a3
use config variable
JiyeongHa Apr 24, 2023
dee6543
use config variable
JiyeongHa Apr 24, 2023
61fa87d
remove unnecessary variable
JiyeongHa Apr 24, 2023
baf3b7a
remove unnecessary variable
JiyeongHa Apr 24, 2023
75f9d3b
remove unnecessary variable
JiyeongHa Apr 24, 2023
94f16b5
try except edit
JiyeongHa Apr 24, 2023
9be3d57
try except edit
JiyeongHa Apr 24, 2023
9bc6610
try except edit
JiyeongHa Apr 24, 2023
254a13c
edit global variable
JiyeongHa Apr 24, 2023
e556dac
edit global variable
JiyeongHa Apr 24, 2023
d2fe7c4
edit global variable
JiyeongHa Apr 24, 2023
9325aaa
change directory for tapas
JiyeongHa Apr 25, 2023
ff67066
update path
JiyeongHa Apr 25, 2023
3048bca
remove redundant path
JiyeongHa Apr 25, 2023
811c349
update plot mean contours
JiyeongHa May 30, 2023
db5048d
edit code for a new config file
JiyeongHa May 31, 2023
4e4d38b
contours with confidence interval as width
JiyeongHa May 31, 2023
c20e8da
contours with confidence interval as width
JiyeongHa Jun 2, 2023
c8461a4
contours with confidence interval as width
JiyeongHa Jun 2, 2023
2af4368
edit and add contours for incorrect/missing files
JiyeongHa Jun 12, 2023
1d13c4c
contours with confidence interval as width
JiyeongHa Jun 12, 2023
fff3d7d
Merge branch 'analysis'
JiyeongHa Jun 12, 2023
b3a8bdf
.idea to be deleted later
JiyeongHa Jun 13, 2023
3479171
Merge pull request #1 from JiyeongHa/main
JiyeongHa Jun 13, 2023
2512f21
update .gitignore
JiyeongHa Jun 13, 2023
e693e5c
conclude merge
JiyeongHa Jun 13, 2023
30b8f57
update check_sids fig related functions
JiyeongHa Jul 20, 2023
03e3bff
Merge branch 'noahbenson:analysis' into analysis
JiyeongHa Sep 6, 2023
eda9ab7
change path making functions with proc()
JiyeongHa Sep 9, 2023
37e8b13
plot sides_check figures (contours and paths)
JiyeongHa Sep 9, 2023
b6dcf24
plot sides_check figures (contours and paths)
JiyeongHa Sep 11, 2023
c9f8f6f
edit annot_properties code
JiyeongHa Nov 8, 2023
85dfcb1
edit on plot_contours
JiyeongHa Nov 9, 2023
2f414b0
working on plot_contours
JiyeongHa Nov 9, 2023
5ebf1db
working on plot_contours
JiyeongHa Nov 10, 2023
f1893e4
editing plot_contgours based on new files
JiyeongHa Jan 25, 2024
e300cf7
add codes making mean contours across subjects and raters based on th…
JiyeongHa Jan 26, 2024
0775684
update surface area size correlation and distribution figures
JiyeongHa Feb 2, 2024
e9d3649
update seaborn package to solve annotation bug
JiyeongHa Feb 2, 2024
a4d784f
update contour plotting functions based on proc()
JiyeongHa Feb 2, 2024
d01533a
working on plotting averages across subjects..
JiyeongHa Feb 4, 2024
eefab1d
heriability analysis - icc calculation
JiyeongHa Feb 15, 2024
651259d
heriability analysis - icc calculation
JiyeongHa Feb 15, 2024
6e2a874
heriability analysis - icc plots
JiyeongHa Feb 15, 2024
8c8d481
commit before merge
JiyeongHa Feb 15, 2024
8a7dd81
adding meeting notes
JiyeongHa Feb 15, 2024
350309f
Merge remote-tracking branch 'upstream/analysis' into analysis
JiyeongHa Feb 15, 2024
55f6436
heriability bootstraps
JiyeongHa Feb 29, 2024
56fe7bf
heriability bootstraps and addiing some notes
JiyeongHa Feb 29, 2024
4dd339b
notebook names changed and functions edited for hemi=sum
JiyeongHa Mar 12, 2024
51e7782
bootstraps
JiyeongHa Mar 21, 2024
423f9a5
contours for sub-999999
JiyeongHa Apr 10, 2024
bdc33f3
mean contours
JiyeongHa Apr 11, 2024
5cebc08
delete hemi-seperated figures
JiyeongHa Apr 11, 2024
268b3d3
cleaning up the figure generating parts
JiyeongHa May 9, 2024
780980c
removing jt researcher, and replacing errobars as ci
JiyeongHa May 29, 2024
9604f10
Merge branch 'noahbenson:analysis' into analysis
JiyeongHa Oct 1, 2024
c5b400b
removing unncessary notebooks
JiyeongHa Oct 17, 2024
ed0bbdd
Merge branch 'analysis' of github.com:JiyeongHa/hcp-annot-vc into ana…
JiyeongHa Oct 17, 2024
67dd5f7
Merge commit '6baad91b' into analysis
JiyeongHa Oct 24, 2024
98010de
added package under load_allreports
JiyeongHa Nov 14, 2024
64ae5a3
clean up for surface size correlation and distribution
JiyeongHa Nov 14, 2024
71eb4c9
clean ups; adding more documentation
JiyeongHa Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ target/

# Jupyter Notebook
.ipynb_checkpoints
./visualization/notebooks/.ipynb_checkpoints/*

# IPython
profile_default/
Expand Down Expand Up @@ -135,3 +136,6 @@ docker/local_cache/*
# Mac OS files
.DS_Store
._.DS_Store

.snakemake
.idea
87 changes: 87 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import os
import sys
import numpy as np
import pandas as pd
import matplotlib as mpl
configfile:
"config.json"
os.environ['HCPANNOT_LOAD_PATH'] = config['CACHE_DIR']

# The cache directories:
from visualization import *
RATERS = ['BrendaQiu', 'bogengsong', 'JiyeongHa', 'lindazelinzhao', 'nourahboujaber', 'jennifertepan']
ROIS = ['hV4', 'VO1', 'VO2']
HEMIS = ['lh','rh']


rule get_subj_ids_for_rater:
output:
subj_ids = os.path.join(config['CACHE_DIR'], 'subj_ids', "rater-{rater}_hemi-{hemi}_roi-{roi}.txt")
params:
trace_save_path = config['OUTPUT_DIR']
run:
subj_ids = viscontours.get_trace_list_drawn_by_rater(params.trace_save_path, wildcards.hemi, wildcards.roi, wildcards.rater)
with open(output.subj_ids,'w') as fp:
for item in subj_ids:
# write each item on a new line
fp.write("%s," % item)

rule save_trace_cache:
output:
os.path.join(config['PROC_DIR'],'fsaverage', "{rater}", "{sid}", "{hemi}.roi-{roi}_space-fsaverage_npoints-{n_points}.mgz")
params:
data_dir = config['DATA_DIR'],
proc_dir = config['PROC_DIR']
run:
x, y = viscontours.make_fsaverage_coords(rater=wildcards.rater,
hemi=wildcards.hemi,
roi=wildcards.roi,
subject=int(wildcards.sid),
n_points=int(wildcards.n_points),
data_dir=params.data_dir,
proc_dir=params.proc_dir,
save_path=output[0])


def get_subj_ids(wildcards, all=False):
if all is False:
subj_ids = viscontours.get_trace_list_drawn_by_rater(config['TRACE_DIR'],
wildcards.hemi,
wildcards.roi,
wildcards.rater)
else:
import neuropythy as ny
subj_ids = ny.data['hcp_lines'].subject_list
return subj_ids


rule all:
input:
lambda wildcards: expand(os.path.join(config['PROC_DIR'],'fsaverage', "{rater}", "{sid}", "{hemi}.roi-{roi}_space-fsaverage_npoints-{n_points}.mgz"), rater=['JiyeongHa', 'BrendaQiu'], hemi=HEMIS, roi=ROIS, sid=get_subj_ids(wildcards, all=True), n_points=[500])


def convert_txt_to_list(wildcards):
text_file = os.path.join(config['PATH_SAVE_DIR'], f"rater-{wildcards.rater}_hemi-{wildcards.hemi}_roi-{wildcards.roi}.txt")
with open(text_file,'r') as fp:
fd_list = fp.read().split(',')
return fd_list[:-1]

def get_trace_file_names(wildcards, all):
ids_list = get_subj_ids(wildcards, all)
all_files = []
for sid in ids_list:
f = os.path.join(config['PATH_SAVE_DIR'], f"contour-path_space-fsaverage_rater-{wildcards.rater}_sid-{sid}_hemi-{wildcards.hemi}_roi-{wildcards.roi}_npoints-{wildcards.n_points}.mgz")
all_files.append(f)
return all_files


rule save_hcp_subject_list:
input:
all_files = lambda wildcards: get_trace_file_names(wildcards, all=True)
output:
os.path.join(config['OUTPUT_DIR'], "subject_list", "hcp_subject_list.txt")
run:
import neuropythy as ny
test = ny.data['hcp_lines'].subject_list
with open(output[0],'w') as f:
f.write('\n'.join(str(i) for i in test))
6 changes: 6 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"CACHE_DIR": "/Volumes/server/Projects/annot-vc/hcpannot-cache",
"DATA_DIR": "/Volumes/server/Projects/annot-vc/data_branch/save",
"PROC_DIR": "/Volumes/server/Projects/annot-vc/derivatives/proc",
"OUTPUT_DIR": "/Volumes/server/Projects/annot-vc/derivatives"
}
2,535 changes: 2,535 additions & 0 deletions derivatives/surface_areas_2022-02-27.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker/roi-tool/jupyter_notebook_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
# - originate from pages served by this server (validated with XSRF cookie and
# token), or - authenticate with a token
#
# Some anonymous compute resources still desire the ability to run code,
# Some anonymous compute resources still desire the ability to run visualization,
# completely without authentication. These services can disable all
# authentication and security checks, with the full knowledge of what that
# implies.
Expand Down
2 changes: 1 addition & 1 deletion hcpannot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'''
The hcpannot package contains code for annotating the HCP 7 Tesla Retinotopy
The hcpannot package contains visualization for annotating the HCP 7 Tesla Retinotopy
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this got here, but not needed.

Dataset (DOI: 10.1167/18.13.23).

These tools are intended to be run using a Docker container; for information
Expand Down
9 changes: 6 additions & 3 deletions hcpannot/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os, json
from collections.abc import Mapping
from pathlib import Path

import pandas
import numpy as np
import neuropythy as ny

Expand Down Expand Up @@ -929,23 +929,26 @@ def load_report(region, rater, sid, h, reports_path=None):
except Exception as e:
pass
return data

def load_allreports(region,
reports_path=None,
include_mean=True,
sids=subject_list):
sids=None):
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sids=None is a good way to set up the argument, but there needs to be an if statement inside the function:

if sids is None:
    sids = subject_list

"""Loads all reports for a region and returns a dataframe of them.

This runs `load_report` over all raters, subjects, and hemispheres and
returns a dataframe of all the reports. If a report file is not found,
then the row is left with NaNs indicating missing data.
"""
from .config import raters_by_region
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!


if include_mean:
if include_mean == True:
include_mean = 'mean'
include_mean = [include_mean]
else:
include_mean = []
raters = (region_raters[region] + include_mean)
raters = (raters_by_region[region] + include_mean)
return pandas.DataFrame(
[load_report(region, rater, sid, h, reports_path=reports_path)
for rater in raters
Expand Down
Loading