SpatialPRo - spatial proteomics analysis
Using devtools call install_github("kieranrcampbell/SpatialPRo")
SpatialPRo
contains two different classes - SPData
that represents a single (tissue) sample and SPExp
that represents the entire experiment, storing a list of SPData
s, the sample ids and the directory and filenames of the original files.
There is an example dataset included - to load it first load the library via library(SpatialPRo)
then call data(sp5)
. This loads an example object of class SPData
called sp
. The following can then be used to access data elements:
channels(sp)
returns the channel namesnChannel(sp)
returns the number of channelsnCells(sp)
returns the number of cellsrawData(sp)
returns a cell by channel matrix of the raw datacells(sp)
returns a cell by channel matrix with the readouts for each cell, normalised wrt cell size & concentrationneighbours(sp)
returns a list of length nCells, where entry i is an n by channel matrix for cell i having n neighboursneighbourIDs(sp)
returns a list of the nearest neighbour cell identifierssize(sp)
returns a vector containing the cell sizes (in pixels)weight(sp)
returns the boundary sizes for each cell to its nearest neighboursID(sp)
returns the sample IDcellClass(sp)
returns a vector of length nCells where each cell is assigned a class. Here there are 2 classes, with 1 corresponding to stromal and 2 corresponding to tumour.xy(sp)
returns a nCell by 2 matrix of centre-of-mass locations for each cellsp[1:2, c(3,5,7)]
returns a new SPData object
using cells 1 & 2 and channels 3, 5 and 7cellClass(sp)
returns a vector of length nCells(sp) with a numeric classification for each cell (currently only 2 types are supported)neighbourClass(sp, cell.class)
functions similarly to cellClass but returns a list similar to neighbours(sp) but with only neighbours of class cell.class remainingneighbourChannel(sp, c(1,3,5)
returns the neighbour list as in neighbours(sp) but including only channels 1,3 and 5findBoundary(sp)
returns the (numeric identifiers of) cells that lie on the boundary between 2 different classesThe class SPData
also contains several plotting routines:
boxplots(sp,4,8)
plots the ranges of each of the 32 channels (in 4 rows by 8 columns)channelPlot(sp, 1:4)
provides boxplots of the first 4 channels but highlighting differences between different classes of data (class1 vs class2)An SPExp has four slots:
dir
Directory location of experiment filesfiles
List of files used in the experimentspdata
List containing objects of class SPData
ids
Vector of sample idsfiles(spe)
shows the experiment filesgetDir(spe)
experiment directoryIDs(spe)
sample IDsspe[2:3]
subset samples 2-3spe[[4]]
return an SPData
object of the fourth sampleSPlist(spe)
the underlying list holding the SPData
objectslength(spe)
number of samplesDownload all the original matlab files from https://s3.amazonaws.com/supplemental.cytobank.org/report_data/report_113/Figure_5/Figure_5_raw_image_files.zip and extract to ~/myfolder
We can then initialise an empty SPE
with
spe <- SPExperimentfromDir("~/myfolder")
If the files
option is left blank then all files are used.
We can then load all the files into the object using
spe <- loadExp(spe)
(this may take some time for matlab -> R conversion)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.