Given a query GRanges object and an assembly string, this function will grab the TSS list for the given reference assembly and then calculate the distance from each query feature to the closest TSS. It is a wrapper of calcFeatureDist that uses built-in TSS features for a reference assembly

calcFeatureDistRefTSS(query, refAssembly)

Arguments

query

A GenomicRanges or GenomicRangesList object with query regions

refAssembly

A character vector specifying the reference genome assembly (*e.g.* 'hg19'). This will be used to grab chromosome sizes with getTSSs.

Value

A vector of distances for each query region relative to TSSs.

Examples

calcFeatureDistRefTSS(vistaEnhancers, "hg19")
#>    [1]   179984   -44796   -61083   124112    98559    75215     4835   -68758
#>    [9]    76457   -27740    27159    -1082   -43169    17261   -48451  -115948
#>   [17]  -144753  -150975  -224209  -280216  -289809  -307424   132123    76051
#>   [25]    33524    -3941    -4721   -36649  -119622   129581  -117531  -146246
#>   [33]  -210206   259944   -47785   239100   176399   243566   272102   144285
#>   [41]   136424  -120317  -194404  -215195   123058  -785945  -892031  -893170
#>   [49]  1243797  1212114  1153608  1119014  1103928  1053168   586065    -1815
#>   [57]   -10164   -28202   -28202  -234869  -271636  -314591  -390158  -609705
#>   [65]   612849   571726   554219   533596   502482   462995   307490   273442
#>   [73]   222251  -123595    99128  -423896   -41404  -301145    79102   -68286
#>   [81]  -150815  -216975   584651   501091   326320   -95781  -113486  -144388
#>   [89]  -148677  -176071  -107936   -48330   -64715  -138561   169570    39405
#>   [97]  -647981    -9972   -29336  -275035  -374157  -148914  -176199    37687
#>  [105]   250663   235446     7889   -58379   137201   118248    -3292   -25253
#>  [113]    62326    -9918   -44051  -142920  -242823   -17247    -1033   144685
#>  [121]    18956  -267424    71417   -26234    22699    -3438  -323047  -366243
#>  [129]  -629736  -796638  -922794  -941318  1007120  -502751    -9315   -68049
#>  [137]    25867   -22792   -83454   -85426    80112    75933    47325   -51984
#>  [145]   -56564    10340    18820    84505    63005     8060     2565  -918698
#>  [153]  -197371    31413    29873    -9017   -12331  -190583    79634    26972
#>  [161]   -60101    43035     3854  -195065   236338   -55924   -39930  -442788
#>  [169]   433131   157814   -92089   -95164  -137211  -205979    70138   -17716
#>  [177]   -37763    14527   -27705  -170971  -188334  -453709  -490578   443018
#>  [185]   322440   317793   306286   256244   210024    28596   -92175   147817
#>  [193]    47613    16501  -150089  -213438   259063     7619   -52236    35356
#>  [201]    64681   162452    57986   -37979   -62171   410793    -2569   186451
#>  [209]    74053  -627792   141479  -112663   106305  -107102  -110916    47690
#>  [217]  -106696  -177987  -270339  -549244   742176   689798   574951   551817
#>  [225]   170592  -130793  -187903  -167129   -39257   -19797     -578   -48772
#>  [233]  -146976    69549   344975  -168896     5491   -19791   -54900   -26572
#>  [241]   -69014   -23998    33085   185560    -1885    -2878   -29970  -256924
#>  [249]   -23611   -31613   639021  -782333  1194194  -625354  -661648  -676209
#>  [257]  -851025   717619   666221   647322   646951   377733   184892   184865
#>  [265]   139438   107077    94225    14268  -227748  -253155  -328389  -331244
#>  [273]   362083   299757   295266   233834   222599   219224   213908   152284
#>  [281]    76672    86982   310143   200996  -339612    49742     5249  -254753
#>  [289]  -254794   -81344   101952   -69140   -28031   -71730    -2474   688872
#>  [297]  -487764  -969508   835457   635016  -123669  -372107  -443912  -470204
#>  [305]  -502719  -619530  -652981  -670008  -686242   699856   663072   -51577
#>  [313]   -81585    38323  -143595  -415604  -664546  -718543   728944   545494
#>  [321]   -17264   -40067   207122   -25238    89211    74656    49193   -59728
#>  [329]  -214834  -143030  -154420   195770  -320583  -348957    31772   757575
#>  [337]   269653   -51705   467181   350696   271188   -81920  -265597   -80776
#>  [345]    51953   -93648   -95021  -112196   201489   175206   151852    44724
#>  [353]    21070  -120112  -128884  -260118    53881   398643  -214781  -215671
#>  [361]    -1057   156545  -117892    32043    -1580    19019   157561   -54668
#>  [369]  -561955   197443   -65702   277414  -480359  1202899  1189731   863110
#>  [377]   735020   488636   383316   190373   163026   -43742   467937  -181021
#>  [385]   200402   140794   -56526  -523433    -9282  -259422   220887   156056
#>  [393]   -73046   -94435   -99326  -201646   202918   174129   142594   128326
#>  [401]    78649    55521    37451   -46464  -204730  -307134  -375283  -392136
#>  [409]   454123   440776   379505   354668   325611   294517   258122   153397
#>  [417]  -130958   144898   135070   111568    77333    50458    29498    23618
#>  [425]   -25432   -40187    10913   -22854  -191645  -211150  -249538  -257127
#>  [433]   211290   171354   164621   160297    54284    -3204   -30341   -64655
#>  [441]  -202947  -220200  -256227  -259516  -291277  -295950  -298948  -304332
#>  [449]   313532   307023   298479   284859   179643   165142  -109945  -115061
#>  [457]   133937   116437    27646     5154    -1466   213266   158254  -895702
#>  [465]  1012367   827140  -872351   507798    79630   -44419   -65218  -195285
#>  [473]  -413665   358421   354238   253254   205543   163014   111874  -175103
#>  [481]  -185205    21765   -77248  -254545  -265079  -303750  -377968   371715
#>  [489]   182850    81769   -11624   252480  -316124  -335991   201456   150632
#>  [497]    24098   113725   -15598  -123058   123532   -50253   193021   -95550
#>  [505]   -45864   423885   -54203  -100310   -23473   -30486  -141701  -168431
#>  [513]    -7892     8255    16420   -12344    33767     1212   -46405     -155
#>  [521]   -31146    27706   -19255   147920    47252   -29217  -835306   782063
#>  [529]   -55520   -24855   -24855   -53397   -99962  -196095   274064   239125
#>  [537]   208013   184011   175610   164286   162308   122995    66548  -351984
#>  [545]   254850    91050   -71442  -310895    81995   -32690  -418937  -879010
#>  [553]  -917327 -1618278  2036053   -64025  -150291   169948   134553     4776
#>  [561]  -293895  -312129  -535753   292993  -347141   241666  -199257  -236333
#>  [569]    56574   338936   -92799   -98260  -244024  -303372   184297   400369
#>  [577]  -505197  -534919  -582650  -607714   732625   730038   675603   669008
#>  [585]   221991   153269   145453   112188    34444   -80509  -151933   144322
#>  [593]   -28657   -48470  -122722  -142807  -173771  -284406    52796    33702
#>  [601]  -368663   383201   112130   281476  -717210   -20382  -182783  -216753
#>  [609]    80129   -72949   137247   100212    61611    40195   417441   162009
#>  [617]   -12013  -228065  -280734  -302290  -331661  -342197  -343683  -389812
#>  [625]  -392329  -423316  -480805  -507920  -634219  -639977  -665302  -694722
#>  [633]  -711110  -731211  -734331  -735376  -835943  -837427 -1008773 -1072782
#>  [641]  1034017   890613   884826   882803   832919   781705   774164   724403
#>  [649]   702795   641844   556188   482492   462890   427643   338696   280666
#>  [657]   263607   -14837   -75271    82799    70898     8527   362212   262340
#>  [665]   149407   -89653  -264827  -391919   342551   209080   195150  -212625
#>  [673]   -31897    50104   -20770  -195703  -207103  -417223  -439708  -556924
#>  [681]  -664869  -708282  -711339  -932759   895220   894327   822687   802707
#>  [689]   784303   735026   423755   338645   283608   216721   170967    18396
#>  [697]   -45646   -43245   -70799   209915   195997   508097   -66012  -255833
#>  [705]  -263410  -266942   377083    93191    81117   -58420  -720954  -775929
#>  [713] -1130833 -1407428 -1410639 -1416045 -1516489  1467724  1429182  1341106
#>  [721]  1312052  1267715   798220   795291   613497   539401   471766   436245
#>  [729]   207113  -198828  -307630  -368452   252353   213852   108075    45315
#>  [737]    69374   410969   242127   141571    17789   -65018   -69497  -251768
#>  [745]   164268   -41883    12083      954    -6999    -8879   104395   126921
#>  [753]   123876    71474     3094    -5626   112859     7900  -369292    -5823
#>  [761]  -558291   653362  -323119   261871    -7007  -223537  -280134    82953
#>  [769]    11534  -494320   113284     5405     7447   -45976  -139118  -124813
#>  [777]    67930     5378      950   -27020   -47612  -286266   736425   454494
#>  [785]   -16741   -29859   -50047   -55861  -144708  -155295  -166090    81852
#>  [793]      330   311282    35673  -148221   450722   337369  -424821  -579640
#>  [801]  -849993   841183    43452  -240483   -25064    60334  -185013     2769
#>  [809]    -5481   -41530   -32284     3309     1389    -8889   -11343    22439
#>  [817]     9807     5622     9681  -764864   498020   316509   345064   290708
#>  [825]   272923   161393   155735   -16903    -1429   -85988     8776     -219
#>  [833]   -46959   -35464  -777462  -913612   761003   606643   598230   580329
#>  [841]   533136   445652   378798   355005   341639   185322   132916   124968
#>  [849]    59066    41298   440406   773299  -270191  -569186   431818   290740
#>  [857]   254019  -318371  -383337  -403203   357504   297163   122184    78066
#>  [865]    80208    60889    -1094  -254929  -269039  -624151  -629818   621842
#>  [873]   613978   612598   408415   233848    46772   -27236   -58842   -79685
#>  [881]  -165747  -185887  -202273    87009    42735   547439   420767  -336052
#>  [889]  -117276   123578   -67159  -530238  -192602   115228   192285   175088
#>  [897]    72236    41245   586072   534314   476166   359060    28342  -640032
#>  [905]  -488635     4317   -96578   168865    45373     3292  -106656  -453710
#>  [913]   -97249  -101533  -243572   173529  -118362    88666    69822    27108
#>  [921]    32805   -15271  -106935  -271815  -352957  -473480  -568402   644198
#>  [929]   509169   397443   -66992  -459724  -203370  -215862    -1930   158441
#>  [937]   214212     8923   -17188   168167   -33284    14788  1863095  -225393
#>  [945]  -319069   416144   413422   408984   397763   369364    83478   136692
#>  [953]   198690       -9   343073   209950   196945   -29466  -176409  -281930
#>  [961]    15221     4437     -233    -5604   -86044    24372    16514  -103691
#>  [969]   -52440  -375047   396369   324499  -127417    20199  -349529  -474031
#>  [977]   -89931  -107290  -249743  -358718  -515767  -593155  -619413  -620530
#>  [985]  -640001 -1021620 -1086398  1114782  1090328   977559   886899   882814
#>  [993]   776518   698551   603610   491552   441068   392332   382175   175919
#> [1001]   106700  -150311  -128614  -203253   192326    96331  -294824   148717
#> [1009]  -160321  -247290  -568176  -599664  -624864    -8104    12515    12166
#> [1017]   146451    -6647   -13978  -541229  -303571  -467280   508351   382694
#> [1025]   298170   184982    39960     8419   385656  -129025  -170572  -182939
#> [1033]   152329   107282   -13537    -1644    29163    29163   106428  -660366
#> [1041]    25418    11153   -80682  -168670  -244967  -294637   303066  -334131
#> [1049]   147749  -611422   248537   -77646    79087    76743    -9288  -119061
#> [1057]   199204  -110875   128217    -4201  -290273  -362754   435968    54060
#> [1065]  -172582   -23685  -218336  -385421  -482423  -531291  -548646  -632009
#> [1073]  -652103  -731538  -761441  -773954   709490   562444   468304   450520
#> [1081]   379304   286612   275882   -29937  -216529   -61397   102284   261952
#> [1089]    98323   127665    51139    49210  -155789  -100423    55757  -514117
#> [1097]  -129578     6805     4041  -798249   295044   579730   524308  -349134
#> [1105]  -317825   270694    -3394    -6760  -177510  -193871  -258396   227302
#> [1113]   174015  -267139   398766   271088    53258   -51761   -10733    -6717
#> [1121]   104024   -21957  -154465    56364    38873    24811    18062   -26846
#> [1129]   -37890   -49037   -65671   -94917  -120780  -161751  -165279  -212005
#> [1137]   144059    90914    84786    23773  -155347   -58952     9962   -14422
#> [1145]    68276  -335973  -533718  -639020   714928   705518   616198   493426
#> [1153]   114757   -12738    74985      916    81208   157361   -67673  -326371
#> [1161]  -329703  -331367  -336887  -345642  -416449   352577   300126   272936
#> [1169]   268771   266466   233865   180012   166327    98078  -551840  -554168
#> [1177]  -572421   536190   504018   485803   346786   217578   -18558    52431
#> [1185]   -24479   -14105    56764    34568    14456   126998   -57284   -19636
#> [1193]  -568494  -568535  -205509  -434347   235740  -316447   302879    57511
#> [1201]    23203   152927   206236   154656    89342  -511851  -484012    -4262
#> [1209]   -73240  -118039   397060   632587   451336    -5873   -97779  -130106
#> [1217]  -458039   421433    66970   289825    83657    10292   225180  -278544
#> [1225]  -359649   228239    -3276  -274218  -281035  -413745   390287  -251884
#> [1233]   -97950     9583    28760     7517     2601  -226544    67384  -207480
#> [1241]  -849154  -471168   459026  -321451   159980  -188307  -197297   -79313
#> [1249]   -94347   -99035  -108919  -119701  -558421   329495   -94861  -131181
#> [1257]    85193    -3192   -28986  -388467  -417642   155203  -560373   362705
#> [1265]   315264    66711   -59093   -79869   -88617   -90640  -405058  -495294
#> [1273]  -936256   890883   591982   576469   294029    38647     4556  -134549
#> [1281]  -343779  -375017   167932  -322388   -87871   -73260    20707    66436
#> [1289]   -21556   -22829   241520  -124717   -88564   153607    53990    73164
#> [1297]    62613    -8030   -12200   -16658   -74596   -97812  -131123  -157359
#> [1305]  -162811  -226044   169074   143391  -110443   -34057     -912   -47588
#> [1313]  -111579  -152947   138855   117238    87457    25335    16153    14363
#> [1321]  -367214  -564224 -1007188  1065330   973540   783837   680397    -3630
#> [1329]   128485  -556369  -203506  -416661  -122783   254470   205667    -6914
#> [1337]   -87727  -247450   -63249