create.experiment {ORFik} | R Documentation

## Create a template for new ORFik `experiment`

### Description

Create information on runs / samples from an experiment as a single R object. By using files in a folder / folders. It will try to make an experiment table with information per sample. There will be several columns you can fill in, most of there it will try to auto-detect. Like if it is RNA-seq or Ribo-seq, Wild type or mutant etc. You will have to fill in the details that were not autodetected. Easiest way to fill in the blanks are in a csv editor like libre Office or excel. Remember that each row (sample) must have a unique combination of values. An extra column called "reverse" is made if there are paired data, like +/- strand wig files.

### Usage

    create.experiment(
      dir,
      exper,
      saveDir = "~/Bio_data/ORFik_experiments/",
      txdb = "",
      fa = "",
      organism = "",
      pairedEndBam = FALSE,
      viewTemplate = TRUE,
      types = c("bam", "bed", "wig")
    )

### Arguments

`dir` | Which directory / directories to create experiment from
`exper` | Short name of experiment, max 5 characters long
`saveDir` | Directory to save experiment csv file, default: "~/Bio_data/ORFik_experiments/" Set to NULL if you don't want to save it to disc.
`txdb` | A path to gff/gtf file used for libraries
`fa` | A path to fasta genome/sequences used for libraries, remember the file must have a fasta index too.
`organism` | character, default: "" (no organism set), scientific name of organism. Homo sapiens, Danio rerio, Rattus norvegicus etc.
`pairedEndBam` | logical FALSE, else TRUE, or a logical list of TRUE/FALSE per library you see will be included (run first without and check what order the files will come in) 1 paired end file, then two single will be c(T, F, F)
`viewTemplate` | run View() on template when finished, default (TRUE)
`types` | Default (bam, bed, wig), which types of libraries to allow

### Value

a data.frame, NOTE: this is not a ORFik experiment, only a template for it!

### See Also

Other ORFik_experiment: `ORFik.template.experiment()`, `bamVarName()`, `experiment-class`, `filepath()`, `libraryTypes()`, `organism.df()`, `outputLibs()`, `read.experiment()`, `save.experiment()`, `validateExperiments()`

### Examples

    # 1. Pick directory
    dir <- system.file("extdata", "", package = "ORFik")
    # 2. Pick an experiment name
    exper <- "ORFik"
    # 3. Pick .gff/.gtf location
    txdb <- system.file("extdata", "annotations.gtf", package = "ORFik")
    # 4. Pick fasta genome of organism
    fa <- system.file("extdata", "genome.fasta", package = "ORFik")
    # 5. Set organism (optional)
    org <- "Homo sapiens"

    # Create temple not saved on disc yet:
    template <- create.experiment(dir = dir, exper, txdb = txdb,
                                  saveDir = NULL,
                                  fa = fa, organism = org,
                                  viewTemplate = FALSE)
    ## Now fix non-unique rows: either is libre office, microsoft excel, or in R
    template$X5[6] <- "heart"
    # read experiment (if you set correctly)
    df <- read.experiment(template)
    # Save with: save.experiment(df, file = "path/to/save/experiment.csv")

    ## Create and save experiment directly:
    ## Default location: "~/Bio_data/ORFik_experiments/"
    #template <- create.experiment(dir = dir, exper, txdb = txdb,
    #                               fa = fa, organism = org,
    #                               viewTemplate = FALSE)
    ## Custom location
    #template <- create.experiment(dir = dir, exper, txdb = txdb,
    #                               saveDir = "~/MY/CUSTOME/LOCATION",
    #                               fa = fa, organism = org,
    #                               viewTemplate = FALSE)

[Package ORFik version 1.8.6 Index]