In some cases you have certain genes of interest and you would like to find
other genes that are close to the genes of interest. This can be done using the
genefinder
function.
You need to specify either the index position of the genes you want (which row
of the expression array the gene is in) or the name (consistent with the
featureNames
of the ExpressionSet).
A vector of names can be specified and matches for all will be computed. The
number of matches and the distance measure used can all be specified. The
examples will be carried out using the artificial data set, sample.ExpressionSet
.
Two other options for genefinder
are scale
and method
. The scale
option
controls the scaling of the rows (this is often desirable), while the method
option controls the distance measure used between genes. The possible values and
their meanings are listed at the end of this document.
library("Biobase")
library("genefilter")
data(sample.ExpressionSet)
igenes <- c(300,333,355,419) ##the interesting genes
closeg <- genefinder(sample.ExpressionSet, igenes, 10, method="euc", scale="none")
names(closeg)
## [1] "31539_r_at" "31572_at" "31594_at" "31658_at"
The Affymetrix identifiers (since these were originally Affymetrix data) are
31539_r_at
, 31572_at
, 31594_at
and 31658_at
. We can find the nearest
genes (by index) for any of these by simply accessing the relevant component of
closeg
.
closeg$"31539_r_at"
## $indices
## [1] 220 425 457 131 372 137 380 231 161 38
##
## $dists
## [1] 70.30643 70.94069 71.66043 71.66962 73.55186 73.66967 74.77823 77.42745
## [9] 77.86960 83.57073
Nms1 <- featureNames(sample.ExpressionSet)[closeg$"31539_r_at"$indices]
Nms1
## [1] "31459_i_at" "31664_at" "31696_at" "31370_at"
## [5] "31611_s_at" "31376_at" "31619_at" "31470_at"
## [9] "31400_at" "AFFX-TrpnX-3_at"
You could then take these names (from Nms1
) and the annotate
package and explore them further. See the various HOWTO’s in annotate to see how
to further explore your data. Examples include finding and searching all PubMed
abstracts associated with these data. Finding and downloading associated
sequence information. The data can also be visualized using the
geneplotter package (again there are a number of HOWTO documents there).
The scale parameter can take the following values:
none No scaling is done.
range Scaling is done by \((x_{i} − x_{(1)})/(x_{(n)} − x_{(1)})\).
zscore Scaling is done by \((x_{i} − \bar{x})/s_{x}\). Where sx is the standard deviation.
The method
parameter can take the following values:
euclidean Euclidean distance is used.
maximum Maximum distance between any two elements of x and y (supremum norm).
manhattan Absolute distance between the two vectors (1 norm).
canberra The \(\sum(|x_{i} − y_{i}|/|x_{i} + y_{i}|)\). Terms with zero numerator and denominator are omitted from the sum and treated as if the values were missing.
binary (aka asymmetric binary): The vectors are regarded as binary bits, so non-zero elements are on and zero elements are off. The distance is the proportion of bits in which only one is on amongst those in which at least one is on.
The version number of R and packages loaded for generating the vignette were:
## R version 4.4.0 RC (2024-04-16 r86468)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.4 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.20-bioc/R/lib/libRblas.so
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] class_7.3-22 genefilter_1.87.0 Biobase_2.65.0
## [4] BiocGenerics_0.51.0 BiocStyle_2.33.0
##
## loaded via a namespace (and not attached):
## [1] sass_0.4.9 lattice_0.22-6 RSQLite_2.3.6
## [4] digest_0.6.35 evaluate_0.23 grid_4.4.0
## [7] bookdown_0.39 fastmap_1.1.1 blob_1.2.4
## [10] jsonlite_1.8.8 Matrix_1.7-0 AnnotationDbi_1.67.0
## [13] GenomeInfoDb_1.41.0 DBI_1.2.2 survival_3.6-4
## [16] BiocManager_1.30.22 httr_1.4.7 UCSC.utils_1.1.0
## [19] XML_3.99-0.16.1 Biostrings_2.73.0 jquerylib_0.1.4
## [22] cli_3.6.2 rlang_1.1.3 crayon_1.5.2
## [25] XVector_0.45.0 bit64_4.0.5 splines_4.4.0
## [28] cachem_1.0.8 yaml_2.3.8 tools_4.4.0
## [31] memoise_2.0.1 annotate_1.83.0 GenomeInfoDbData_1.2.12
## [34] vctrs_0.6.5 R6_2.5.1 png_0.1-8
## [37] matrixStats_1.3.0 stats4_4.4.0 lifecycle_1.0.4
## [40] zlibbioc_1.51.0 KEGGREST_1.45.0 S4Vectors_0.43.0
## [43] IRanges_2.39.0 bit_4.0.5 bslib_0.7.0
## [46] xfun_0.43 MatrixGenerics_1.17.0 knitr_1.46
## [49] xtable_1.8-4 htmltools_0.5.8.1 rmarkdown_2.26
## [52] compiler_4.4.0