elongationEstimation: Shifting the positive strand vector and compute an overlap...

Description Usage Arguments Details Value Author(s) Examples

Description

This function helps to estimate the average lag between two numeric vectors (typically piled scores of reads aligned on negative and positive strands of each chromosome). It is namely used by Pasha pipeline to infer the average DNA fragments size of sequenced samples.

Usage

1
elongationEstimation(piledValuesPlus, piledValuesMinus, stepShift)

Arguments

piledValuesPlus

Numeric vector containing the piled score for the positive strand of the current chromosome

piledValuesMinus

Numeric vector containing the piled score for the negative strand of the current chromosome

stepShift

vector of positive integer specifying the shifting values that have to be tested

Details

This function takes as input two numeric vectors and a set of 'shifting' values. The two input vectors are aligned and an element-by-element multiplication is computed. The sum of these multiplication represent an overlap estimation of signal between the two vectors. This score is computed iteratively after shifting the relative alignment of the input vectors by all values of 'shifting'. It finally returns a vector of 'overlap' scores (covering every shifting value specified). In theory the vectors should be of the same size but the wrapper takes care to pad with 0s if this constraint is not respected.

Value

A vector of overlap scores generated by the function.

Author(s)

Romain Fenouil

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Create a very large vector of random values
a <- rnorm(1000000)

# Copy this vector but add 150 0s in front (shift)    
b <- c(rep(0,150),a)

# Estimate the overlap scores for shifting values between 50 and 200
shiftEstimate <- seq(50,200,by=10)
overlapScores <- elongationEstimation(a,b,shiftEstimate)

# Show the scores evolution
plot(shiftEstimate, overlapScores)

# Show the max value (150)
abline(v=shiftEstimate[which.max(overlapScores)], col='red')

Pasha documentation built on Jan. 15, 2017, 6:21 p.m.