-
Notifications
You must be signed in to change notification settings - Fork 1
/
finalsample_PNC.Rmd
77 lines (56 loc) · 2.98 KB
/
finalsample_PNC.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
title: "PNC Final Sample Selection: Thalamocortical Development"
author: "Valerie Jill Sydnor"
output:
html_document:
code_folding: show
highlight: haddock
theme: lumen
toc: yes
toc_depth: 4
toc_float: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
require(dplyr)
```
# Initial Participant List
```{r}
#list of RBC ids with processed, non-variant diffusion MRI data, N = 1358
participants <- read.csv("/cbica/projects/thalamocortical_development/sample_info/PNC/PNC_NonVariantDWI_participantlist.txt", header=F)
colnames(participants) <- c("rbcid")
```
# Match rbcid, bblid, and scanid
```{r}
id.key <- read.csv("/cbica/projects/thalamocortical_development/sample_info/PNC/bblid_scanid_reid.csv") #bblid-scanid-rbcid match
id.key$rbcid <- paste0("sub-", id.key$rbcid)
participants <- left_join(participants, id.key, by="rbcid")
```
# Construct Final Sample
Health Exclusion
```{r}
healthexclude <- read.csv("/cbica/projects/thalamocortical_development/sample_info/PNC/n1601_health_20170421.csv")
healthinclude <- healthexclude %>% filter(healthExcludev2 == 0) %>% dplyr::select(scanid)
participants.final <- participants[participants$scanid %in% healthinclude$scanid,] #remove 118 health exclude participants from the initial sample of 1358 with non-variant diffusion data, remaining N = 1240
```
T1 Quality Exclusion
```{r}
T1exclude <- read.csv("/cbica/projects/thalamocortical_development/sample_info/PNC/n1601_t1QaData_20170306.csv")
T1include <- T1exclude %>% filter(t1Exclude == 0) %>% dplyr::select(scanid)
participants.final <- participants.final[participants.final$scanid %in% T1include$scanid,] #remove 25 participants with bad T1 data, remaining N = 1215
```
Diffusion Quality Exclusion
```{r}
dwi.qc <- read.csv("/cbica/projects/thalamocortical_development/sample_info/PNC/PNC_DWI_QCmetrics.csv") #diffusion scan acquisition parameters and quality metrics, generated by sample_construction/PNC/diffusion_qcmetrics_PNC.py
qualityexclude <- dwi.qc %>% filter(t1_neighbor_corr < 0.9) %>% select(subject_id) #participants to exclude from the final study sample based on processed diffusion MRI T1 neighborhood correlation
participants.final <- participants.final[!participants.final$rbcid %in% qualityexclude$subject_id,] #remove 57 participants from the sample of 1215 due to diffusion data quality, remaining N = 1158
```
Diffusion Scan Head Motion Exclusion
```{r}
motionexclude <- dwi.qc %>% filter(mean_fd > 1) %>% select(subject_id) #participants to exclude from the final study sample based on high in-scanner head motion during the diffusion runs #kids are wiggly
participants.final <- participants.final[!participants.final$rbcid %in% motionexclude$subject_id,] #remove 13 participants from the sample of 1158 due to in-scanner head motion, remaining N = 1145
```
# Save Final Sample
```{r}
write.csv(participants.final, "/cbica/projects/thalamocortical_development/sample_info/PNC/PNC_thalamocortical_finalsample_N1145.csv", quote = F, row.names = F)
```