genomation
genomation copied to clipboard
Allow antisymmetric data [Feature request]
Hi Altuna, In some cases the signal supplied to ScoreMatrix as "target" is antisymmetric under strand reversal. In our case it is a difference between signal mapped to the + strand and mapped to the - strand. The "strand.aware" argument deals with stranded features like promoters, but cannot deal with antisymmetric data like subtracted coverage. Therefore, I propose the following new feature:
In scoreMatrix.R:
setMethod("ScoreMatrix",signature("RleList","GRanges"),
function(target,windows,strand.aware,antisymmetric){
...
# if strand aware is TRUE, we need to flip the windows on the minus strand
if(strand.aware == TRUE){
orig.rows=which(as.character(strand(windows)) == '-')
mat[rownames(mat) %in% orig.rows,] = mat[rownames(mat) %in%
orig.rows, ncol(mat):1]
if(antisymmetric)
{
mat[rownames(mat) %in% orig.rows,] = - mat[rownames(mat) %in% orig.rows,]
}
}
Hi balwierz, Could you create pull request with this feature, provide an example in vignette and write a test for it? Kasia