-
Notifications
You must be signed in to change notification settings - Fork 6
Visualizing MAGeT Brain results on Mouse Average
There are two ways to get MAGeT-Brain results for mouse data
-
using an hanatLM
-
using an anatLM
-
using an hanatLM `abijson <- "/opt/quarantine/resources/Allen_Brain/Allen_hierarchy_definitions.json" defs <- "/opt/quarantine/resources/Dorr_2008_Steadman_2013_Ullmann_2013_Richards_2011_Qiu_2016_Egan_2015_40micron/mappings/DSURQE_40micron_R_mapping.csv" hdefs <- makeMICeDefsHierachical(defs, abijson) vols <- addVolumesToHierarchy(hdefs, data$vols)
model <- hanatLm(~group*sex, data, vols) FDR <- hanatFDR(model) thresholds(FDR)
##plotting
#hanatView(model, "tvalue.groupPFF", low=3.8, high=4.32, symmetric=T) #shows hierarchy
stats <- hanatToVolume(model, labelVol, "tvalue.groupPFF") t20 = 7.024384
#FDR20% sliceSeries(nrow = 6, ncol=6, begin=100, end=350) %>% anatomy(anatVol, low=700, high=1400) %>% overlay(stats, low=t20, high=8, symmetric = T) %>% legend("t-statistics") %>% draw() `
- using an anatLM `LMmodel<-anatLm(~ group * sex, data = data, anat = data$vols) FDR <- anatFDR(LMmodel) write.csv(FDR,"/data/chamal/projects/stephanie/cross-sect-asyn-PFF-project/analysis/FDR-sexbygroup.csv") # q values, which are corrected p values write.csv(LMmodel,"/data/chamal/projects/stephanie/cross-sect-asyn-PFF-project/analysis/anatLM-sexbygroup.csv")
attr(LMmodel,"definitions") <- "/opt/quarantine/resources/Dorr_2008_Steadman_2013_Ullmann_2013_Richards_2011_Qiu_2016_Egan_2015_40micron/mappings/DSURQE_40micron_R_mapping.csv" attr(LMmodel,"atlas") <- "/opt/quarantine/resources/Dorr_2008_Steadman_2013_Ullmann_2013_Richards_2011_Qiu_2016_Egan_2015_40micron/ex-vivo/DSURQE_40micron_labels.mnc"
#create new function that assigns a tscore of a region from the anatLM to its corresponding label anatCreateVolume2 <- function (anat, column = 1) { labels <- read.csv(attr(anat, "definitions")) volume <- mincGetVolume(attr(anat, "atlas")) newvolume <- volume for (i in 1:nrow(labels)) { if (labels$right.label[i] == labels$left.label[i] ) { newvolume[volume < labels$right.label[i] + 0.5 & volume > labels$right.label[i] - 0.5] <- anat[labels$Structure[i], column] } else { newvolume[volume < labels$right.label[i] + 0.5 & volume > labels$right.label[i] - 0.5] <- anat[paste0("right ",labels$Structure[i]), column] newvolume[volume < labels$left.label[i] + 0.5 & volume > labels$left.label[i] - 0.5] <- anat[paste0("left ",labels$Structure[i]), column] } } return(invisible(mincArray(newvolume))) }
stats2 <- anatCreateVolume2(LMmodel, '/data/chamal/projects/stephanie/cross-sect-asyn-PFF-project/analysis/DSURQE_labels_tscores_interaction.mnc', column='tvalue-groupPFF:sexM') #need to create 3D volume to view stats on anatVol for mincPlotSliceSeries
hist(LMmodel[,"tvalue-groupPFF:sexM"]) t20 = 2.2 tmax = 6 sliceSeries(nrow = 5, ncol=5, begin=50, end=350) %>% anatomy(anatVol, low=700, high=1400) %>% overlay(stats2, low=t10, high=tmax, symmetric = T) %>% legend("t-statistics") %>% draw()`