ballgown-constructor {ballgown} | R Documentation

## constructor function for ballgown objects

### Description

constructor function for ballgown objects

### Usage

    ballgown(samples = NULL, dataDir = NULL, samplePattern = NULL,
      bamfiles = NULL, pData = NULL, verbose = TRUE, meas = "all")

### Arguments

`samples` | vector of file paths to folders containing sample-specific ballgown data (generated by `tablemaker`). If `samples` is provided, `dataDir` and `samplePattern` are not used.
`dataDir` | file path to top-level directory containing sample-specific folders with ballgown data in them. Only used if `samples` is NULL.
`samplePattern` | regular expression identifying the subdirectories of\ `dataDir` containing data to be loaded into the ballgown object (and only those subdirectories). Only used if `samples` is NULL.
`bamfiles` | optional vector of file paths to read alignment files for each sample. If provided, make sure to sort properly (e.g., in the same order as `samples`). Default NULL.
`pData` | optional `data.frame` with rows corresponding to samples and columns corresponding to phenotypic variables.
`verbose` | if `TRUE`, print status messages and timing information as the object is constructed.
`meas` | character vector containing either "all" or one or more of: "rcount", "ucount", "mrcount", "cov", "cov_sd", "mcov", "mcov_sd", or "FPKM". The resulting ballgown object will only contain the specified expression measurements, for the appropriate features. See vignette for which expression measurements are available for which features. "all" creates the full object.

### Details

Because experimental data is recorded so variably, it is the user's responsibility to format `pData` correctly. In particular, it's really important that the rows of `pData` (corresponding to samples) are ordered the same way as `samples` or the `dataDir`/`samplePattern` combo. You can run `file.path(path = dataDir, pattern = samplePattern)` to see the sample order if `samples` was not used.

If you are creating a ballgown object for a large experiment, this function may run slowly and use a large amount of RAM. We recommend running this constructor as a batch job and saving the resulting ballgown object as an rda file. The rda file usually has reasonable size on disk, and the object in it shouldn't take up too much RAM when loaded, so the time and memory use in creating the object is a one-time cost.

### Value

an object of class `ballgown`

### Author(s)

Leonardo Collado-Torres, Alyssa Frazee

### See Also

`ballgownrsem`, for loading RSEM output into a ballgown object

### Examples

    bg = ballgown(dataDir=system.file('extdata', package='ballgown'),
        samplePattern='sample')
    pData(bg) = data.frame(id=sampleNames(bg), group=rep(c(1,0), each=10))

[Package ballgown version 2.14.1 Index]