Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
BDS
GeneDER
ArrayUtils
Commits
947909fd
Commit
947909fd
authored
Jun 25, 2019
by
Leon-Charles Tranchevent
Browse files
Limma analysis: support of GPL files for getting gene annotations.
parent
bdb15ba2
Changes
2
Hide whitespace changes
Inline
Side-by-side
R/get_gene_annots_from_file.R
0 → 100644
View file @
947909fd
#' @title Get gene annotations from a text file.
#'
#' @description This function reads a TSV file and extract the relevant
#' information into a data-frame.
#'
#' So far, the key column (containing the probe_id) is always the first one and
#' the other colums are all considered to contain relevant annotations. The
#' first row is considered as the header row.
#'
#' @param folder A path to the folder where the file resides.
#' @param filename The name of the file.
#' @param entities The actual set of object ids for which we want gene annotations.
#' @return A data-frame of the provided entities, annotated.
get_gene_annots_from_file
<-
function
(
folder
,
filename
,
entities
)
{
# We define the full path.
file_path
<-
paste0
(
folder
,
filename
)
# We read the file into a data-frame.
gene_annots
<-
read.delim
(
file_path
,
row.names
=
NULL
,
stringsAsFactors
=
FALSE
)
# We do a bit of cleaning.
gene_annots
[
is.na
(
gene_annots
)]
<-
""
rownames
(
gene_annots
)
<-
gene_annots
$
PROBEID
gene_annots
<-
gene_annots
[
entities
,
]
rownames
(
gene_annots
)
<-
seq
(
1
,
length
(
rownames
(
gene_annots
)))
return
(
gene_annots
)
}
R/get_
affy
_annots.R
→
R/get_
gene
_annots
_from_package
.R
View file @
947909fd
#' @title Get
G
ene annotations f
or affy arrays
.
#' @title Get
g
ene annotations f
rom a BioConductor package
.
#'
#' @description This function reads the library defined by the array type and
#' extract the relevant information into a data-frame.
#'
#' @param array_type A string representing the array type.
#' @param affy_library_name A string representing the library name (usually the array
#' type followed by ".db".
#' @param entities The actual set of object ids for which we want gene annotations.
#' It can for instance be probe ids or gene ids. The parameter keytype has to be
#' modified accordingly. By default, the expected type is probe id.
...
...
@@ -12,11 +13,10 @@
#' @param keytype The type of key used. It will be used to map between the annotations
#' and the provided list of entities. The default is probe id.
#' @return A data-frame of the provided entities, annotated.
get_
affy
_annots
<-
function
(
a
r
ray_
typ
e
,
entities
,
get_
gene
_annots
_from_package
<-
function
(
a
ffy_lib
ra
r
y_
nam
e
,
entities
,
columns
=
c
(
"PROBEID"
,
"SYMBOL"
,
"ENSEMBL"
,
"ENTREZID"
),
keytype
=
"PROBEID"
)
{
# We define the library name (removing underscores and adding .db).
affy_library_name
<-
paste0
(
stringr
::
str_to_lower
(
stringr
::
str_remove
(
array_type
,
"_"
)),
".db"
)
# We load the library given its name.
cmd
<-
substitute
(
gene_annots
<-
AnnotationDbi
::
select
(
x
=
local_db
,
keys
=
entities
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment