Title: | Database for Experiment Dataset |
---|---|
Description: | A 'SQLite' database is designed to store all information of experiment-based data including metadata, experiment design, managements, phenotypic values and climate records. The dataset can be imported from an 'Excel' file. |
Authors: | Bangyou Zheng [aut, cre] |
Maintainer: | Bangyou Zheng <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2025-02-06 03:10:56 UTC |
Source: | https://github.com/byzheng/expdb |
Add design for a trial
dbAddDesigns(con, data, extra_design = NULL)
dbAddDesigns(con, data, extra_design = NULL)
con |
a connection object as produced by dbConnect |
data |
Trial design |
extra_design |
The extra columns for design |
no return values
Insert or Update fertilization into expDB
dbAddFertilization(con, data)
dbAddFertilization(con, data)
con |
a connection object as produced by dbConnect |
data |
A data frame includes all columns |
no return values
Add gene information into database
dbAddGene(con, genes)
dbAddGene(con, genes)
con |
a connection object as produced by dbConnect |
genes |
A data.frame of genes |
No return values
Add gene allele information into database
dbAddGeneAllele(con, genes)
dbAddGeneAllele(con, genes)
con |
a connection object as produced by dbConnect |
genes |
A data.frame of genes |
No return values
Add genotypes into expDB
dbAddGenotype(con, genotypes)
dbAddGenotype(con, genotypes)
con |
a connection object as produced by dbConnect |
genotypes |
A string vector of genotypes |
No return values
Insert or Update irrigation into expDB
dbAddIrrigatons(con, data)
dbAddIrrigatons(con, data)
con |
a connection object as produced by dbConnect |
data |
A data frame includes all columns |
no return values
Add log from expDB
dbAddLog(con, msg, date = format(Sys.time(), format = "%Y-%m-%d"))
dbAddLog(con, msg, date = format(Sys.time(), format = "%Y-%m-%d"))
con |
a connection object as produced by dbConnect |
msg |
Add message into expdb |
date |
Create time of message |
No return values
Insert or Update methods into expDB
dbAddMethods(con, data)
dbAddMethods(con, data)
con |
a connection object as produced by dbConnect |
data |
A data frame includes all columns |
no return values
Insert and update met into expDB
dbAddMets(con, data)
dbAddMets(con, data)
con |
a connection object as produced by dbConnect |
data |
Met design |
no return values
Add nodes into expDB
dbAddNodes(con, data)
dbAddNodes(con, data)
con |
a connection object as produced by dbConnect |
data |
phenotype value |
no return values
Add design for a trial
dbAddPhenotype(con, data)
dbAddPhenotype(con, data)
con |
a connection object as produced by dbConnect |
data |
phenotype value |
no return values
Insert and update researcher into expDB
dbAddResearcher(con, data)
dbAddResearcher(con, data)
con |
A connection object as produced by dbConnect |
data |
A data frame includes all columns |
no return values
Insert or update site into expDB
dbAddSites(con, data)
dbAddSites(con, data)
con |
a connection object as produced by dbConnect |
data |
A data frame includes all columns |
no return values
Insert and update source into expDB
dbAddSource(con, data)
dbAddSource(con, data)
con |
A connection object as produced by dbConnect |
data |
A data frame includes all columns |
no return values
Insert or update trait into expDB
dbAddTraits(con, data)
dbAddTraits(con, data)
con |
a connection object as produced by dbConnect |
data |
A data frame includes all columns |
no return values
Insert or Update trial into expDB
dbAddTrials(con, data)
dbAddTrials(con, data)
con |
a connection object as produced by dbConnect |
data |
A data frame includes all columns |
no return values
Add soil for a trial
dbAddTrialSoil( con, data, units = list(thickness = "cm", no3 = "kg/ha", nh4 = "kg/ha") )
dbAddTrialSoil( con, data, units = list(thickness = "cm", no3 = "kg/ha", nh4 = "kg/ha") )
con |
a connection object as produced by dbConnect |
data |
Soil profiles for trials |
units |
a list for the unit |
no return values
Add weather records into expDB
dbAddWeather(con, data, name = NULL)
dbAddWeather(con, data, name = NULL)
con |
a connection object as produced by dbConnect |
data |
A string character for the path to met file, a WeaAna object, or a data frame. |
name |
The met name in the database if data is a data frame. |
no return values
Append a table into db and check the column name
dbAppendTable(con, table, data)
dbAppendTable(con, table, data)
con |
A connection object as produced by dbConnect |
table |
The target table name |
data |
A data frame to write into table |
Export trials weather records to met file
dbExportMet(con, output, na = NA, ...)
dbExportMet(con, output, na = NA, ...)
con |
a connection object as produced by dbConnect |
output |
The folder of output files |
na |
The character for missing value with default NA |
... |
All other arguments to define range of export trials. All trials will be export if there are not arguments. Supported arguments include trial (or trialcode) |
Write weather records into files. No return values.
Check genotype names
dbGenotypeCheckName(con, genotype)
dbGenotypeCheckName(con, genotype)
con |
a connection object as produced by dbConnect |
genotype |
The genotype name will be checked |
A vector with check genotype names
Get the dry weight per stem
dbGetDryWeightPerStem(con, trials = NULL, ...)
dbGetDryWeightPerStem(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected dry weight per stem
Get fertilization from database
dbGetFertilization(con, ...)
dbGetFertilization(con, ...)
con |
a connection object as produced by dbConnect |
... |
Other arguments to specify meta data |
a data.frame for fertilization information
Estimation of maturity
dbGetFieldMaturity(con, trials = NULL, ...)
dbGetFieldMaturity(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected maturity time
Estimation of plant populations
dbGetFieldPopulation(con, trials = NULL, ...)
dbGetFieldPopulation(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected field population
Estimation of stem number per unit area
dbGetFieldStemNumber(con, trials = NULL, ...)
dbGetFieldStemNumber(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected stem number
Estimation of tiller number per unit area
dbGetFieldTillerNumber(con, trials = NULL, ...)
dbGetFieldTillerNumber(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected tiller number
Get the gene information
dbGetGene(con)
dbGetGene(con)
con |
a connection object as produced by dbConnect |
a data.frame with all gene information
Get the genotype information
dbGetGenotype(con, name_only = FALSE)
dbGetGenotype(con, name_only = FALSE)
con |
a connection object as produced by dbConnect |
name_only |
Only return the name of genotypes |
data.frame with genotype information or a vector with genotype name if name_only = TRUE.
Get irrigation from database
dbGetIrrigation(con, ...)
dbGetIrrigation(con, ...)
con |
a connection object as produced by dbConnect |
... |
Other arguments to specify meta data |
a data frame for irrigation information
Get log from expDB
dbGetLog(con)
dbGetLog(con)
con |
a connection object as produced by dbConnect |
A data.frame with all logs
Get met information
dbGetMetInfo(con, name)
dbGetMetInfo(con, name)
con |
a connection object as produced by dbConnect |
name |
The met name |
a data.frame for met information
The final leaf number is first retrived from trait "O_FinalLeafNumber", then calculated from trait "O_HaunIndex" if "O_FinalLeafNumber" is not observed. Final leaf number equals the maximum value of "O_HaunIndex", which should be an integer.
dbGetOrganFinalLeafNumber(con, trials = NULL, ...)
dbGetOrganFinalLeafNumber(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments |
... |
Arguments to specific trials. |
A data.frame for selected final leaf number
The Haun Index is retrived from trait "O_HaunIndex", extending the final observationa
dbGetOrganHaunIndex(con, trials = NULL, avg = TRUE, ...)
dbGetOrganHaunIndex(con, trials = NULL, avg = TRUE, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments |
avg |
Whether to calculate the average value |
... |
Arguments to specific trials. |
A data.frame for selected Haun Index
Get phenotype values through a group of conditions
dbGetPhenotype( con, traits = NULL, direction = "long", tt = FALSE, gene = FALSE, ... )
dbGetPhenotype( con, traits = NULL, direction = "long", tt = FALSE, gene = FALSE, ... )
con |
a connection object as produced by dbConnect |
traits |
A list of traits. All traits will be returned if NULL |
direction |
One of 'long' or 'wide' for reshape function |
tt |
Whether to calculate thermal time |
gene |
Whether to get gene information |
... |
All other arguments to define range of export trials |
a data.frame for selected phenotypic values
Estimation of flowering time
dbGetPlantFlowering(con, trials = NULL, ...)
dbGetPlantFlowering(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected flowering time
Estimation of heading time
dbGetPlantHeading(con, trials = NULL, ...)
dbGetPlantHeading(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected heading time
Estimation of stem elongation
dbGetPlantStemElongation(con, trials = NULL, ...)
dbGetPlantStemElongation(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected stem elongation stage
Estimation of stem number per plant
dbGetPlantStemNumber(con, trials = NULL, ...)
dbGetPlantStemNumber(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected stem number for individual plant
Estimation of tiller number per plant
dbGetPlantTillerNumber(con, trials = NULL, ...)
dbGetPlantTillerNumber(con, trials = NULL, ...)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
... |
Arguments pass to dbGetTrials |
A data.frame for selected tiller number for individual plant
Get site into expDB
dbGetSites(con)
dbGetSites(con)
con |
a connection object as produced by dbConnect |
a data.frame for all sites in the data base
Get source from expDB
dbGetSource(con)
dbGetSource(con)
con |
a connection object as produced by dbConnect |
A data.frame for all source in the data base
Get trait list
dbGetTraits(con)
dbGetTraits(con)
con |
a connection object as produced by dbConnect |
a data.frame for all traits in the data base
Get trials by a groups of conditions.
dbGetTrials(con, design = TRUE, ...)
dbGetTrials(con, design = TRUE, ...)
con |
a connection object as produced by dbConnect |
design |
Whether include design |
... |
All other arguments to define range of export trials. All trials will be export if there are not arguments. Supported arguments include trial (or trialcode) |
A data.frame for selected trials
Get weather records from expDB
dbGetWeather(con, name, format = "data_frame", na = NA_character_, tz = "UTC")
dbGetWeather(con, name, format = "data_frame", na = NA_character_, tz = "UTC")
con |
a connection object as produced by dbConnect |
name |
The met name |
format |
The format of export dataset. |
na |
The character for missing value with default NA |
tz |
Time zone applied for hourly temperature |
a data.frame for all weather records
Obtain the key phenology stage
dbGetZadoksStage(con, trials, key_stage)
dbGetZadoksStage(con, trials, key_stage)
con |
a connection object as produced by dbConnect |
trials |
A data.frame to specify trials. If not NULL, other arguments will be ignored. |
key_stage |
The key zadoks stage |
A data.frame for selected Zadoks stage
Import data from excel file
dbImportXLSX(con, xlsx, ignore_genotype = TRUE, ignore_trait = TRUE, ...)
dbImportXLSX(con, xlsx, ignore_genotype = TRUE, ignore_trait = TRUE, ...)
con |
a connection object as produced by dbConnect |
xlsx |
The path to excel file |
ignore_genotype |
Ignore genotype tables when importing |
ignore_trait |
Ignore trait table when importing |
... |
Other arguments. Supported arguments include
|
No return values
Insert new rows or update existing rows to a specific table according to a specific column (unique) by each row
dbInsertUpdateByRow(con, table, data, unique_col = "name")
dbInsertUpdateByRow(con, table, data, unique_col = "name")
con |
A connection object as produced by dbConnect |
table |
The target table name |
data |
A data frame to write into table |
unique_col |
A character vector to indentify each row in the table |
List all trials
dbListTrials(con)
dbListTrials(con)
con |
a connection object as produced by dbConnect |
A data.frame for all trials in the data base
Connect to expDB
expdbConnect(filename)
expdbConnect(filename)
filename |
The filename of SQLite |
a connection object as produced by dbConnect
## Not run: con <- connect('filename') ## End(Not run)
## Not run: con <- connect('filename') ## End(Not run)
create to expDB
expdbCreateDB(filename, system_traits = TRUE)
expdbCreateDB(filename, system_traits = TRUE)
filename |
The filename of new expDB |
system_traits |
Whether to import system traits |
a connection object as produced by dbConnect
Didconnect to expDB
expdbDisconnect(con)
expdbDisconnect(con)
con |
a connection object as produced by dbConnect. |
no return values
## Not run: con <- connect('filename') disconnect(con) ## End(Not run)
## Not run: con <- connect('filename') disconnect(con) ## End(Not run)
Get index id by unique_columns.
getIdByUniqueIndex( con, table, data, unique_col = "name", data_col = unique_col, ignore_case = FALSE )
getIdByUniqueIndex( con, table, data, unique_col = "name", data_col = unique_col, ignore_case = FALSE )
con |
a connection object as produced by dbConnect |
table |
the table name |
data |
A data frame to write into table |
unique_col |
A character vector to identify each row in the table |
data_col |
The column names in the data.frame |
ignore_case |
Whether ignore_case |
id of unique_col
Process quadrat (detail) harvestQuadratDetail
harvestQuadratDetail(con, records)
harvestQuadratDetail(con, records)
con |
a connection object as produced by dbConnect |
records |
Phenotype records |
no return values