Skip to contents

Normalize (z-score) rows of a matrix

Usage

scale_rows(x)

Arguments

x

a matrix, possibly containing gene by samples

Value

Row-normalized matrix

Examples

# \donttest{
library(cinaR)
data(atac_seq_consensus_bm) # calls 'bed'
bed.row.normalized <- scale_rows(bed[,c(4:25)])
head(bed.row.normalized)
#>       B6-18mo-M-BM-47-GT18-01783 B6-18mo-F-BM-42-GT18-01780
#> 52834                  1.0992670                  0.4518863
#> 29780                 -1.0422681                 -1.7648489
#> 67290                  1.1823472                  0.3326022
#> 51295                  0.8786799                 -0.1096104
#> 4267                   1.1855512                  0.2835383
#> 45102                  0.3550758                  0.2434806
#>       B6-18mo-M-BM-45-GT18-01781 B6-18mo-F-BM-40-GT18-01778
#> 52834                 -0.3910777                  2.1456376
#> 29780                 -1.4999026                 -1.2831284
#> 67290                 -0.1394783                  2.0320921
#> 51295                 -0.9002426                  2.3018180
#> 4267                  -0.6213518                  1.9393865
#> 45102                 -1.5420436                  0.4666711
#>       B6-18mo-F-BM-41-GT18-01779 NZO-18mo-F-BM-35-GT18-03804
#> 52834                  1.6429885                 -0.13486357
#> 29780                 -0.8977519                  0.76418396
#> 67290                 -0.2338944                  0.42701831
#> 51295                  0.3647690                  0.56242704
#> 4267                   1.5293806                 -0.17394187
#> 45102                 -0.1471028                  0.07608768
#>       NZO-18mo-F-BM-36-GT18-03805 NZO-18mo-F-BM-42-GT18-03806
#> 52834                 -0.01751359                  -0.6492476
#> 29780                  1.17364643                   1.1977325
#> 67290                  0.56864247                  -0.1866864
#> 51295                  0.04851607                  -0.5444581
#> 4267                  -0.18113496                  -0.4947535
#> 45102                 -0.20290047                   0.1876829
#>       NZO-18mo-M-BM-38-GT18-03807 NZO-18mo-M-BM-39-GT18-03808
#> 52834                  -0.5983960                -0.883947562
#> 29780                   1.1736464                -0.126999054
#> 67290                  -0.4699347                 0.002145821
#> 51295                   0.4438322                 0.285705747
#> 4267                   -0.7163005                -0.963742604
#> 45102                   1.0246474                -0.202900469
#>       NZO-18mo-M-BM-40-GT18-03809 B6-3mo-F-BM-4-GT18-04678
#> 52834                 -0.97978337                1.2087936
#> 29780                 -0.05474097               -0.2715152
#> 67290                 -1.08363942                1.0879311
#> 51295                 -0.54445812                1.2739961
#> 4267                  -1.15507866                1.5034855
#> 45102                 -0.48188861               -0.2586981
#>       B6-3mo-F-BM-5-GT18-04679 B6-3mo-M-BM-1-GT18-04680
#> 52834               -0.7763768                 2.237562
#> 29780               -0.9459240                 1.221818
#> 67290               -0.6115589                 2.598589
#> 51295               -0.7421162                 1.946033
#> 4267                -0.9507951                 2.253005
#> 45102               -0.3702934                 3.479743
#>       B6-3mo-M-BM-2-GT18-04681 B6-3mo-M-BM-3-GT18-04682
#> 52834               -0.7509509               -0.4751785
#> 29780               -1.0904402                0.4510656
#> 67290               -0.2338944               -0.5643508
#> 51295               -0.5444581                0.6019586
#> 4267                -0.6803351               -0.2976629
#> 45102               -0.5376862               -0.2029005
#>       NZO-3mo-F-BM-245-GT18-10918 NZO-3mo-F-BM-243-GT18-10916
#> 52834                  -0.5221185                 -0.49864848
#> 29780                  -0.0788270                  0.08977519
#> 67290                  -0.8475992                 -0.56435083
#> 51295                  -0.5444581                 -1.61181167
#> 4267                   -0.2732064                 -0.59401804
#> 45102                  -0.5376862                 -0.76087676
#>       NZO-3mo-M-BM-251-GT18-10919 NZO-3mo-M-BM-253-GT18-10921
#> 52834                  -0.5729701                  -0.2580810
#> 29780                   0.5474097                   0.2583774
#> 67290                  -1.4613039                  -0.7059750
#> 51295                  -1.4536852                  -0.7816478
#> 4267                   -0.5335961                  -0.1624329
#> 45102                  -0.9282696                  -0.9282696
#>       NZO-3mo-F-BM-244-GT18-10917 NZO-3mo-M-BM-252-GT18-10920
#> 52834                 -0.64142428                  -0.6355568
#> 29780                  0.49923766                   1.6794530
#> 67290                 -0.98922332                  -0.1394783
#> 51295                 -0.70258457                  -0.2282052
#> 4267                  -0.52496442                  -0.3710324
#> 45102                  0.02029005                   1.2478379
# }