bamToOE: Compute OE scores from (a set of) bamfiles.

Description Usage Arguments Details Value Examples

View source: R/OEfromBAM.R

Description

bamToOE computes the observed-over-expected (OE) scores for a set of samples. The input is a bamfile for each sample.

Usage

1
2
3
4
5
bamToOE(exp.name, bam.dir = getwd(), bam.fname, sample.name, cell.count,
  sig = sprintf("LP%s", format(Sys.time(), "%y%m%d")), CHR,
  bin.size = 0, fExp, GATC.mpbl.reads, OE.norm.factor = NULL, outdir,
  VERBOSE = FALSE, do.norm = TRUE, plot = TRUE, addToName = "",
  min.depth = 1000, sample.depth = 0L)

Arguments

exp.name

Character, used to create output file names.

bam.dir

Character, directory which contains the bamfiles.

bam.fname

Character vector, bamfile names for all samples.

sample.name

Character vector, (short) names for all samples.

cell.count

Integer vector, cell count for all samples.

sig

Character, string with initials and date used for output file names (eg LP170619).

CHR

Character vector, chromosome names to be used in the analysis.

bin.size

integer, 0 (each bin is entire chr length) or >0 specifying the width in bp of the bins used for computing the OE scores.

fExp

Numeric vector, length of twice the number of GATC fragments in GATC.mpbl.reads (2 reads per fragment) specifying the (normalized) expected readcount per fragment.

GATC.mpbl.reads

GRanges object, granges specify genomic GATC fragments, mcols specifies whether forw/rev/both read count (0/1/2).

OE.norm.factor

Numeric vector, normalization factor per window/chromosome to normalize raw OE scores.

outdir

Character, specifies directory for output files.

VERBOSE

Logical, print diagnostic msgs [default = FALSE].

do.norm

Logical, perform normalization [default = FALSE].

plot

Logical, generate plots [default = TRUE].

addToName

Character, a substrings which will be added in fromt of the chromsome names read from the bamfiles. This allows dealing with bamfiles which lack the 'chr' in the name.

min.depth

integer, minimal read depth per sample (samples with less reads are discarded) [default = 10000].

sample.depth

integer, target read depth per sample (samples will be downsampled to target; must be >= min.depth; sampling is without replacement; set sample.depth to 0 (default) to prevent sampling) [default = 0].

Details

extended description of function

Value

List with 3 elements;

OE.norm.factor

Numeric vector; normalization factor per window/chromosome to normalize raw OE scores

OE.norm

GRanges object; granges specify genomic GATC fragments, mcols specify normalized OE scores for each sample (ie each bamfile)

OE.raw

GRanges object; granges specify genomic GATC fragments, mcols specify raw OE scores for each sample (ie each bamfile)

Examples

1
2
3
4
5
6
7
## Not run: 
res <- bamToOE(exp.name="myExperiment", bam.dir="./bamfiles/",
  bam.fname=c("1.bam","2.bam"), sample.name=c("smpl1","smpl2"),
  cell.count=c(20,1),CHR=paste0('chr', c(1:19, 'X')), fExp=fExp.mm10,
  GATC.mpbl.reads=GATC.mpbl.reads.mm10, outdir="myResults")

## End(Not run)

lpagie/chromocounting documentation built on May 21, 2019, 2:26 a.m.