Skip to content

Commit

Permalink
Visualize demographics for scans
Browse files Browse the repository at this point in the history
Signed-off-by: Zarrar Shehzad <czarrar@gmail.com>
  • Loading branch information
czarrar committed May 2, 2013
1 parent 1f8f067 commit 90848c6
Show file tree
Hide file tree
Showing 11 changed files with 381 additions and 0 deletions.
67 changes: 67 additions & 0 deletions nki/02_qc/20_choose_scans.R
@@ -0,0 +1,67 @@
#' This script does some quick comparisons of the scans following QC
#'

#+ setup, include=FALSE
library(ggplot2)
df <- read.csv("../subinfo/qc-2_usable_scans.csv")
df <- df[,colnames(df)!="subdir"] # remove the path column


###
# Examine 2 of the scans
###

#' # Two Scans

#' Here we examine subjects who have 645 and 1400ms TR scans that pass QC.
#' We look at the distribution of ages and the breakdown of sex and handedness.
#+ two-scans-subset
sdf <- subset(df, short==1 & medium==1)

#' Age appears to be bimodally distributed, is this an issue?
#+ two-scans-age
ggplot(sdf, aes(Age)) + geom_histogram(binwidth=5) + ggtitle("Age for Participants with 2 Scans")

#' Note there is one participant who doesn't have gender recorded.
#+ two-scans-sex
table(sdf$Sex)
ggplot(sdf, aes(Sex)) + geom_bar() + ggtitle("Sex for Participants with 2 Scans")

#' Woot, majority of people are right-handed.
#+ two-scans-handedness
table(sdf$Handedness)
ggplot(sdf, aes(Handedness)) + geom_bar() + ggtitle("Handedness for Participants with 2 Scans")


###
# Examine all three scans
###

#' # Three Scans

#' Here I will be seeing how the distribution of the subjects from above
#' will differ with the removal of subjects who don't have a 3rd scan.
#' Where color is shown, red means subjects with only two scans, while
#' blue means subjects with all three scans usable.

#' Subjects that would be lost if looking at three scans are in red (shown first)
#' Only subjects with three usable scans are shown second.
#+ three-scans-age
ggplot(sdf, aes(Age, fill=factor(all))) + geom_histogram(binwidth=5) + ggtitle("Age for Participants with 2/3 Scans")
ggplot(sdf[sdf$all==3,], aes(Age)) + geom_histogram(binwidth=5) + ggtitle("Age for Participants with 3 Scans")

#' The first table output is for 2 scans and the second is for 3 scans.
#+ three-scans-sex
table(sdf$Sex)
table(sdf$Sex[sdf$all==3])
ggplot(sdf, aes(Sex, fill=factor(all))) + geom_bar() + ggtitle("Sex for Participants with 2/3 Scans")
ggplot(sdf[sdf$all==3,], aes(Sex)) + geom_bar() + ggtitle("Sex for Participants with 3 Scans")

#' The first table output is for 2 scans and the second is for 3 scans.
#' Woot, majority of people are still right-handed.
#+ three-scans-handedness
table(sdf$Handedness)
table(sdf$Handedness[sdf$all==3])
ggplot(sdf, aes(Handedness, fill=factor(all))) + geom_bar() + ggtitle("Handedness for Participants with 2/3 Scans")
ggplot(sdf[sdf$all==3,], aes(Handedness)) + geom_bar() + ggtitle("Handedness for Participants with 3 Scans")

314 changes: 314 additions & 0 deletions nki/02_qc/20_choose_scans.html

Large diffs are not rendered by default.

Binary file added nki/02_qc/figure/three-scans-age1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nki/02_qc/figure/three-scans-age2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nki/02_qc/figure/three-scans-handedness1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nki/02_qc/figure/three-scans-handedness2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nki/02_qc/figure/three-scans-sex1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nki/02_qc/figure/three-scans-sex2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nki/02_qc/figure/two-scans-age.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nki/02_qc/figure/two-scans-handedness.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nki/02_qc/figure/two-scans-sex.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 90848c6

Please sign in to comment.