View source: R/array_reshaping.R
| gene_resample_resolution | R Documentation |
Resample gene expression to a different resolution
gene_resample_resolution( gene.expression, spacing = NULL, interpolation = "cubic" )
gene.expression |
Gene expression data read with read.raw.gene (can be 1-D vector or array). If 1-D vector, it must has the sizes attribute |
spacing |
new resolution to sample either as a vector (one component for each dimension) or scalar. If scalar, new resolution is isotropic. |
interpolation |
Default is 'cubic'. 'Linear' and 'nearest' are also currently supported. |
resampled gene expression
# read a gene expression file
filename=system.file('extdata/Pdyn_P56_coronal_71717084_200um.zip',package="ABIgeneRMINC")
gene.expression=read.raw.gene(filename)
# convert data from 1-D vector to 3-D array
gene.expression.array=array(gene.expression,rev(attr(gene.expression,'sizes')))
# synonymous with mincArray(gene.expression))
#Sagittal Slice
image(gene.expression.array[,,29], ylab='Superior-Inferior' ,xlab='Anterior-Posterior')
title('Native resolution', font.main=2)
# The current resolution is isotropic 200 microns
attributes(gene.expression)$ANTsRparam$spacing
# 200 200 200
# resample to isotropic 50 microns
resampled.gene.expression = gene_resample_resolution(gene.expression, c(50,50,50))
# The new resolution is
attributes(resampled.gene.expression)$ANTsRparam$spacing
# 50 50 50
# make sagittal slice
resampled.gene.expression.array=array(resampled.gene.expression,rev(attr(resampled.gene.expression,'sizes')))
image(resampled.gene.expression.array[,,29*4], ylab='Superior-Inferior' ,xlab='Anterior-Posterior')
title('4x super-sampling', font.main=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.