An MDB (Modeled DataBase) based on files: fileMDB
Rename tables of a fileMDB object
Usage
# S3 method for chMDB
$(x, i)
fileMDB(
dataFiles,
dbInfo,
dataModel,
readParameters = DEFAULT_READ_PARAMS,
collectionMembers = NULL,
check = TRUE,
n_max = 10,
verbose = FALSE
)
# S3 method for fileMDB
names(x) <- value
# S3 method for fileMDB
rename(.data, ...)
# S3 method for fileMDB
[(x, i)
# S3 method for fileMDB
[[(x, i)
# S3 method for fileMDB
$(x, i)
Arguments
- x
a fileMDB object
- i
the index or the name of the tables to take
- dataFiles
a named vector of path to data files with
all(names(dataFiles) %in% names(dataModel))
- dbInfo
a list with DB information: "name" (only mandatory field), "title", "description", "url", "version", "maintainer".
- dataModel
a ReDaMoR::RelDataModel object
- readParameters
a list of parameters for reading the data file. (e.g.
list(delim='\t', quoted_na=FALSE,)
)- collectionMembers
the members of collections as provided to the collection_members<- function (default: NULL ==> no member).
- check
logical: if TRUE (default) the data are confronted to the data model
- n_max
maximum number of records to read for checks purpose (default: 10). See also
ReDaMoR::confront_data()
.- verbose
if TRUE display the data confrontation report (default: FALSE)
- value
new table names
- .data
a fileMDB object
- ...
Use new_name = old_name to rename selected tables
See also
MDB methods: db_info, data_model, data_tables, collection_members, count_records, dims, filter_with_tables, as_fileMDB
Additional general documentation is related to MDB.
Examples
hpof <- read_fileMDB(
path=system.file("examples/HPO-subset", package="ReDaMoR"),
dataModel=system.file("examples/HPO-model.json", package="ReDaMoR"),
dbInfo=list(
"name"="HPO",
"title"="Data extracted from the HPO database",
"description"=paste(
"This is a very small subset of the HPO!",
"Visit the reference URL for more information"
),
"url"="http://human-phenotype-ontology.github.io/"
)
)
#> HPO
#> SUCCESS
#>
#> Check configuration
#> - Optional checks:
#> - Maximum number of records: 10
count_records(hpof)
#> HPO_hp HPO_altId HPO_sourceFiles HPO_diseases
#> 500 89 2 1903
#> HPO_diseaseHP HPO_diseaseSynonyms HPO_parents HPO_descendants
#> 2594 2337 95 972
#> HPO_synonyms
#> 730
## The following commands take time on fileMDB object
if (FALSE) {
select(hpof, HPO_hp:HPO_diseases)
toTake <- "HPO_altId"
select(hpof, all_of(toTake))
hpoSlice <- slice(hpof, HPO_diseases=1:10)
count_records(hpoSlice)
if("stringr" %in% installed.packages()[,"Package"]){
epilHP <- filter(
hpof,
HPO_diseases=stringr::str_detect(
label, stringr::regex("epilepsy", ignore_case=TRUE)
)
)
count_records(epilHP)
label <- "Rolandic epilepsy"
cn <- sym("label")
reHP <- filter(
hpof,
HPO_diseases=!!cn==!!label
)
}
}