Last data update: 2014.03.03

R: Functions for parsing Buxco respirometry data
Buxco file ParsersR Documentation

Functions for parsing Buxco respirometry data

Description

A typical Buxco respirometry experiment involves collecting repeated measures on both acclimation and experimental data related to metabolism and respiration. The parse.buxco function creates a local database representation of a given file to facilitate fast retrieval and ultimately analysis. The user should only use parse.buxco with parse.buxco.basic mainly used for testing purposes.

Usage

parse.buxco(file.name = NULL, table.delim = "Table", burn.in.lines = c("Measurement", "Create measurement", "Waiting for", "Site Acknowledgement Changed"),
  chunk.size = 500, db.name = "bux_test.db", max.run.time.minutes = 60, overwrite = TRUE, verbose=TRUE, make.package = F, author = NULL, author.email = NULL)
parse.buxco.basic(file.name=NULL, table.delim="Table", burn.in.lines=c("Measurement", "Create measurement", "Waiting for", "Site Acknowledgement Changed"))

Arguments

file.name

A path to the Buxco CSV file. See vignette for further description of the required file format.

table.delim

A character vector of length one containing the pattern used to divide the Buxco file into tables.

burn.in.lines

A character vector containing the patterns used to divided each Buxco table into readings for different animals.

chunk.size

The number of lines that should be read in at a given time, more lines results in more memory consumption and quicker parsing speed.

db.name

The file name of the local database to create.

max.run.time.minutes

The maximum time in minutes that a acclimation or experimental run should take. A warning will be given if this is exceeded and the data will be treated as if there were seperate runs.

overwrite

A logical value specifying whether the local database specified in db.name should be overwritten if exists.

verbose

A logical value specifying if additional information should be printed as parsing progresses.

make.package

A logical value indicating whether a package should be created in db.name instead of a database file.

author

If make.package == T, a string value indicating who the package author should be.

author.email

If make.package == T, a string value indicating what the package author's email address should be.

Details

The parse.buxco function reads in the specified file in chunks. It uses the lines specified in burn.in.lines to determine whether a 'break' has been reached. Each break signifies that a series of readings for several animals has been completed and so only upon reaching a break is measurement data written to the database for the completed measurement sets. Because of this, there will always be some memory overhead in proportion to the number of readings in each series irrespective of chunk.size. To access the database in R, use the convienience method retrieveData.

Value

The parse.buxco function returns a BuxcoDB object. The parse.buxco.basic function returns a data.frame.

Note

parse.buxco.basic should not be used directly as it is extremely memory intensive as it parses the entire file at once and returns a data.frame result.

Author(s)

Daniel Bottomly

References

http://www.buxco.com/

See Also

BuxcoDB, retrieveData

Examples


bux.db <- parse.buxco(file.name=buxco.sample.data.path(), db.name =tempfile())

head(retrieveData(bux.db))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(plethy)
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/plethy/parsing.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Buxco file Parsers
> ### Title: Functions for parsing Buxco respirometry data
> ### Aliases: parse.buxco parse.buxco.basic
> ### Keywords: utilities
> 
> ### ** Examples
> 
> 
> bux.db <- parse.buxco(file.name=buxco.sample.data.path(), db.name =tempfile())
Processing /home/ddbj/local/lib64/R/library/plethy/extdata/BuxcoR_sample.csv in chunks of 500
Starting chunk 1
Reached breakpoint change
Processing breakpoint 1
Starting sample 8034x13140_5
Sample written
Processing breakpoint 2
Starting sample 8034x13140_11
Sample written
Starting sample 8034x13140_5
Sample written
Processing breakpoint 3
Starting sample 8034x13140_11
Sample written
Starting sample 8034x13140_2
Sample written
Processing breakpoint 4
Starting sample 8034x13140_2
Sample written
Starting sample 8034x13140_3
Sample written
Starting chunk 2
Reached breakpoint change
Processing breakpoint 5
Starting sample 8034x13140_1
Sample written
Starting sample 8034x13140_3
Sample written
Processing breakpoint 6
Starting sample 8034x13140_1
Sample written
Starting sample 8034x13140_9
Sample written
Processing breakpoint 7
Starting sample 8034x13140_4
Sample written
Starting sample 8034x13140_9
Sample written
Starting chunk 3
Reached breakpoint change
Processing breakpoint 8
Starting sample 8034x13140_10
Sample written
Starting sample 8034x13140_4
Sample written
Reached the end of the file, writing remaining data
Starting sample 8034x13140_10
Sample written
> 
> head(retrieveData(bux.db))
   Sample_Name              P_Time Break_sec_start Variable_Name Bux_table_Name
1 8034x13140_5 2012-09-28 10:07:17               0             f          WBPth
2 8034x13140_5 2012-09-28 10:07:17               0           TVb          WBPth
3 8034x13140_5 2012-09-28 10:07:17               0           MVb          WBPth
4 8034x13140_5 2012-09-28 10:07:17               0          Penh          WBPth
5 8034x13140_5 2012-09-28 10:07:17               0           PAU          WBPth
6 8034x13140_5 2012-09-28 10:07:17               0          Rpef          WBPth
  Rec_Exp_date Break_number       Value
1          D-3            1 384.3611755
2          D-3            1   0.1556593
3          D-3            1  59.8293839
4          D-3            1   0.5106936
5          D-3            1   1.6047863
6          D-3            1   0.0828647
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>