Learn R Programming

rbamtools (version 2.16.17)

saveAldData: saveAldData: Save alignment depth plots for single genes

Description

The function saveAldData reads alignment data for all genes in geneList sequentially from all Bam files listed in sampleBamFiles. The function cuts out intronic regions using the exonAlignDepth class and calculates a smoothed groupwise estimate using the exonLoessModel function. In a second region cutting step, remaining regions with low alignment depth are cut out using cutFlatAlignDepth. Finally, the function calculates group-wise ratios of alignment depth using the groupRatio function.

Usage

saveAldData(bs, gl, path, order=NULL, lim=1.1, startId=1, f=mean)

Arguments

bs

sampleBamFiles. Contains BAM file names and group assignment.

gl

geneList. Contains a list of geneModel objects. Only gene-name, gene-id and global genetic region is used. Object construction can be abridged using interior=FALSE.

path

character. Base directory where output files are written to.

order

numeric. Defines order in which group-levels of sampleBamFiles object are used for groupRatio

lim

numeric. Limit used for groupRatio function. The percentage of genomic position where this limit is exceeded between all (ordered) group levels is given as gr (and cgr) value in aldrat table.

startId

numeric. Index used for first gene. Starting value for subsequent numbering of genes.

f

function. Function for calculation of group accumulates. Defaults to mean. Alternatively median may also be used.

See Also

bamReader

Examples

Run this code
# NOT RUN {
bam <- system.file("extdata", "accepted_hits.bam", package="rbamtools")
reader <- bamReader(bam, idx=TRUE)
# Extract data for HLHL17 gene:
seqid <- "chr1"
start <- 895967
end <- 901099
gene_name <- "HLHL17" # (optional)
ranges <- data.frame(seqid=seqid, start=start, end=end, gene_name=gene_name)
# }
# NOT RUN {
saveAldData(reader, ranges=ranges, filename="new_file.bam", f=mean)
# }

Run the code above in your browser using DataLab