Skip to content

Visualizing MAGeT Brain results on Mouse Average

tulste edited this page Aug 20, 2019 · 13 revisions

There are two ways to get MAGeT-Brain results for mouse data

  1. Runnning hierarchical MAGeT using an hanatLM

  2. Running a non-hierarchical MAGeT using an anatLM

Below are two examples for visualizing MAGeT results for the DSURQE atlas from hanatLM and anatLM

  1. Running a non-hierarchical MAGeT

This is done using anatLM:

LMmodel<-anatLm(~ group * sex, data = data, anat = data$vols)`
FDR <- anatFDR(LMmodel)

In order to visualize the results, need to create a 3D volume incorporating the tscores from the anatLM:

Normally the command to do so is, anatCreateVolume, however there are several bugs in the code that prevent this and so while this is being fixed, use the function anatCreateVolume2 in the meantime.

#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)))
}

Then you need to modify the attributes of the anatLM model (LMmodel) using the following commands in which incorporate the region names and their corresponding label number.

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"

Finally, create the 3D stats volume using this command:

stats2 <- anatCreateVolume2(LMmodel, '/data/chamal/projects/stephanie/cross-sect-asyn-PFF-project/analysis/DSURQE_labels_tscores_interaction.mnc', column='tvalue-groupPFF:sexM') 

The next step is to visualize the tscores onto an average mouse brain (here we use the DSURQE ex-vivo MRI)

anatVol <- mincArray(mincGetVolume("/opt/quarantine/resources/Dorr_2008_Steadman_2013_Ullmann_2013_Richards_2011_Qiu_2016_Egan_2015_40micron/ex-vivo/DSURQE_40micron.mnc"))

tFDR20 = 2.2
tmax = 6
sliceSeries(nrow = 5, ncol=5, begin=50, end=350) %>% 
  anatomy(anatVol, low=700, high=1400) %>% 
  overlay(stats2, low=tFDR20, high=tmax, symmetric = T) %>%
  legend("t-statistics") %>%
  draw()`

For other ways to visualize the data, please see: https://htmlpreview.github.io/?https://github.com/Mouse-Imaging-Centre/MRIcrotome/blob/master/vignettes/figures.html

Clone this wiki locally