genomation icon indicating copy to clipboard operation
genomation copied to clipboard

Allow antisymmetric data [Feature request]

Open balwierz opened this issue 9 years ago • 1 comments

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,]
              }
            }

balwierz avatar Jul 24 '15 17:07 balwierz

Hi balwierz, Could you create pull request with this feature, provide an example in vignette and write a test for it? Kasia

katwre avatar Jul 29 '15 10:07 katwre