extractGeneRegions: Extraction of alignments from given genetic regions and BAM...

Description Usage Arguments Details Value Author(s) Examples

Description

The function extractGeneRegions writes aligns or some part of the stored aligns in a BAM file as reads into a BAM output file.

Usage

1

Arguments

src

sampleBamFiles: List of source BAM files where alignments are read from. BAM index files must exist and be present in src object.

trg

sampleBamFiles: List of target BAM files where alignments are written to.

gl

geneList: Objects from which genetic regions are taken.

Details

Reference sequence names in geneList object must all match sequence names in source BAM files.

Value

Numeric. Number of written alignments for each file.

Author(s)

Wolfgang Kaisers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# + + + + + + + + + + + + + + + + + + #
# A) Create sampleBamFiles objects
# + + + + + + + + + + + + + + + + + + #
bam <- system.file("extdata","accepted_hits.bam",package="rbamtools")
outdir <- tempdir()
# Input sampleBamFiles object
ibs <- sampleBamFiles(bam)
# Output sampleBamFiles object
obs <- sampleBamFiles(file.path(outdir, "outu.bam"))
# + + + + + + + + + + + + + + + + + + #
# B) Create geneList Object
# + + + + + + + + + + + + + + + + + + #
rfile <- system.file("extdata",
            "hs.ucsc.small.RData",
                package="refGenome")

ucr <- loadGenome(rfile)
gt <- getGeneTable(ucr)
gl <- geneList(ucr, gt$gene_id)

extractGeneRegions(ibs, obs, gl)
bamFiles(obs) <- file.path(outdir, bamSort(obs, "out"))
bamIdxFiles(obs) <- paste(bamFiles(obs), "bai", sep=".")
createIndex(obs)

rbamtools documentation built on Nov. 11, 2019, 5:09 p.m.