View source: R/interpolate.gene.r
interpolate.gene | R Documentation |
Missing gene expression data is interpolated with a marching average of nearest neighbours. Neighbours are averaged if they have gene expression. After several iterations it will cover the whole brain.
interpolate.gene( genevec, maskvec, dimensions = rev(attr(genevec, "sizes")), itermax = 1000 )
genevec |
1D vector of gene expression data. Missing data has value of -1. |
maskvec |
1D logical vector indicating which elements of genevec to consider for analysis. When function finishes running and converges, all genevec elements within the mask will have positive values. |
dimensions |
1D integer vector of length 3 specifying array dimensions (fastest to slowest dimensions) |
itermax |
Maximum number of iterations to run the marching average of nearest neighbours. |
1D vector of gene expression data, with missing data interpolated from nearest neighbours.
# In this example, we will download gene expression of Nrxn1 (Experiment 75988632). # Missing data will be interpolated using marching average of nearest neighbours # # Download and read Nrxn Data genetest=read.raw.gene("http://api.brain-map.org/grid_data/download/75988632?include=energy",url=TRUE) # Read label file and create a mask of elements in the brain labelfile=system.file('extdata/gridAnnotation.raw',package="ABIgeneRMINC") mask=read.raw.gene(labelfile,labels=TRUE)>0 # Make image of horizontal slice before interpolation image(array(genetest,rev(attributes(genetest)$sizes))[,25,],ylab='Left-Right' ,xlab='Anterior-Posterior') # Make image of sagittal slice before interpolation image(array(genetest,rev(attributes(genetest)$sizes))[,,25], ylab='Superior-Inferior' ,xlab='Anterior-Posterior') # Interpolate interp.gene=interpolate.gene(genetest,mask) # Make image of horizontal slice after interpolation image(array(interp.gene,rev(attributes(interp.gene)$sizes))[,25,],ylab='Left-Right' ,xlab='Anterior-Posterior') # Make image of sagittal slice before interpolation image(array(interp.gene,rev(attributes(interp.gene)$sizes))[,,25], ylab='Superior-Inferior' ,xlab='Anterior-Posterior')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.