The CorrDrugTumorMSI package contains different functions to analyze untargeted drug Mass Spectrometry Imaging data. The main objective of package is to provide methods to link observed drug distribution with unsupervised clusters identified.

Preprocessing of MSI data

PreprocessingMSIData

Function does preprocessing of MSI data available in analyze 7.5 format. The function first creates adaptive bins based on the peaks size in maximum intensity reference spectrum from given MSI data. Inside created bins, peaks selection performed using local maxima search approach. Apart from peaks selection, there is an option to exclude high intensity peaks from the edge of the tissue and/or remove peaks with small coverage area.

folderpath <- 'path of folder contains MSI data'\ mat <- PreprocessingMSIData('folderpath')\

IonInensityMatrix <- mat[[1]][[1]] ## Ion intensity matrix \ ycord <- mat[[1]][[3]] ## y-coordinate of MSI data \
xcord <- mat[[1]][[2]] ## x-coordinate of MSI data \

Clustering of input data matrix

library(CorrDrugTumorMSI)
data('spdata')
par(mar=c(1, 1, 1, 1))

clusteredImg <- BisectKmeansClustering(spdata,cluster.size = 0.5)
dim(clusteredImg) <- c(41,40)
image(clusteredImg,axes=FALSE)

Creates a spatial correlogram of spatial data

xycoord  <- as.matrix(expand.grid(1:41,1:40))
spcor <- CreateSpatialCorrelogram(xycoord,spdata[,1])

Creates a LISA map

par(mar=c(1, 1, 1, 1))
ionImg <- spdata[,1]
dim(ionImg) <- c(41,40)
LISAmap <- CreateLISAmap(ionImg,distthrs = 3)

Quantitative analysis of LISA map

par(mar=c(1, 1, 1, 1))
Qlisa <- ClusteredLISAimgQA(clusteredImg,LISAmap)

Variables selection

The function variablesSelection selects important variables from identified clusters. With spatial methods (SL, SE) the xycoord of the data also required as an input.

par(mar=c(1, 1, 1, 1))
xycoord  <- as.matrix(expand.grid(1:41,1:40))  # Create spatial co-ordinates of the data
cl <- clusteredImg   # cluster label

#varselect <- VariablesSelection(spdata,cl,method = 'SL',xycoord = xycoord,lagdist = 1) # variables selection using spatial lag method

#SelectedVariables <- which(p.adjust(varselect[[2]],"holm")<0.05) # The index of selected variabels after p-value adjustment

# Plot selected variables on mean spectrum 
#plot(c(1:100),apply(spdata[c(1:820),],2,sum),type='h',xlab="variables",ylab="",ylim=c(0,2000))
#lines(c(1:100),apply(spdata[c(821:1620),],2,sum),type='h',xlab="variables",ylab="",ylim=c(0,2000),col='blue')
#points( which(p.adjust(varselect[[2]],"holm")<0.05),rep(2200,22),col='red',pch=16)


mridulaprasad/CorrDrugTumorMSI documentation built on Oct. 26, 2020, 5:45 a.m.