assemble_allCov {InPAS} | R Documentation

## Assemble coverage files for all samples

### Description

Process individual sample-chromosome-specific coverage files in an experiment into a file containing a list of chromosome-specific Rle coverage of all samples

### Usage

    assemble_allCov(sqlite_db, outdir, genome, removeScaffolds = FALSE)

### Arguments

`sqlite_db` | A path to the SQLite database for InPAS, i.e. the output of setup_sqlitedb()
`outdir` | A character(1) vector, a path with write permission for storing the coverage data. If it doesn't exist, it will be created.
`genome` | An object of BSgenome::BSgenome
`removeScaffolds` | A logical(1) vector, whether the scaffolds should be removed from the genome If you use a TxDb containing alternative scaffolds, you'd better to remove the scaffolds.

### Value

A list of paths to per-chromosome coverage files of all samples.

- seqname, chromosome/scaffold name

  - tag1, name tag for sample1

  - tag2, name tag for sample2

  - tagN, name tag for sampleN

### Author(s)

Haibo Liu

### Examples

    if (interactive()) {
       library(BSgenome.Mmusculus.UCSC.mm10)
       genome <- BSgenome.Mmusculus.UCSC.mm10
       bedgraphs <- system.file("extdata",c("Baf3.extract.bedgraph",
                                            "UM15.extract.bedgraph"),
                               package = "InPAS")
       tags <- c("Baf3", "UM15")
       metadata <- data.frame(tag = tags,
                              condition = c("Baf3", "UM15"),
                              bedgraph_file = bedgraphs)
       outdir = tempdir()
       write.table(metadata, file =file.path(outdir, "metadata.txt"),
                   sep = "\t", quote = FALSE, row.names = FALSE)

       sqlite_db <- setup_sqlitedb(metadata = file.path(outdir,
                                                        "metadata.txt"),
                                   outdir)
       coverage <- list()
       for (i in seq_along(bedgraphs)){
       coverage[[tags[i]]] <- get_ssRleCov(bedgraph = bedgraphs[i],
                                tag = tags[i],
                                genome = genome,
                                sqlite_db = sqlite_db,
                                outdir = outdir,
                                removeScaffolds = TRUE,
                                BPPARAM = NULL)
       }
       coverage_files <- assemble_allCov(sqlite_db,
                                        outdir,
                                        genome,
                                        removeScaffolds = FALSE)
    }

[Package InPAS version 2.2.0 Index]