LD scores

snp_ld_scores(
  Gna,
  ind.row = rows_along(Gna),
  ind.col = cols_along(Gna),
  size = 500,
  infos.pos = NULL,
  ncores = 1
)

bed_ld_scores(
  obj.bed,
  ind.row = rows_along(obj.bed),
  ind.col = cols_along(obj.bed),
  size = 500,
  infos.pos = NULL,
  ncores = 1
)

Arguments

Gna

A FBM.code256 (typically <bigSNP>$genotypes).
You can have missing values in these data.

ind.row

An optional vector of the row indices (individuals) that are used. If not specified, all rows are used.
Don't use negative indices.

ind.col

An optional vector of the column indices (SNPs) that are used. If not specified, all columns are used.
Don't use negative indices.

size

For one SNP, window size around this SNP to compute correlations. Default is 500. If not providing infos.pos (NULL, the default), this is a window in number of SNPs, otherwise it is a window in kb (genetic distance).

infos.pos

Vector of integers specifying the physical position on a chromosome (in base pairs) of each SNP.
Typically <bigSNP>$map$physical.pos.

ncores

Number of cores used. Default doesn't use parallelism. You may use nb_cores.

obj.bed

Object of type bed, which is the mapping of some bed file. Use obj.bed <- bed(bedfile) to get this object.

Value

A vector of LD scores. For each variant, this is the sum of squared correlations with the neighboring variants (including itself).

Examples

test <- snp_attachExtdata()
G <- test$genotypes

(ld <- snp_ld_scores(G, ind.col = 1:1000))
#>    [1] 2.483941 2.172068 3.263946 2.183188 2.429795 2.398690 2.014529 2.356609
#>    [9] 2.366944 2.372684 2.027740 3.122179 2.133183 2.172548 2.519639 2.021563
#>   [17] 2.314697 2.037480 2.782503 1.924502 2.041895 2.750078 2.725187 2.169489
#>   [25] 2.172800 2.056492 2.310708 1.954138 2.218048 1.992463 2.052143 2.817170
#>   [33] 2.348052 2.522452 1.988571 2.460693 2.348271 2.171589 2.309941 2.141150
#>   [41] 2.898284 2.228980 1.957499 2.321395 2.283141 3.252310 2.071685 2.436255
#>   [49] 2.422020 3.116608 2.286026 2.473451 2.177112 2.234016 2.656763 2.364125
#>   [57] 2.543912 2.593429 2.240817 2.097550 2.721537 2.418359 2.264382 2.149650
#>   [65] 2.855477 2.432488 2.233151 2.964298 3.565872 2.539941 2.211568 2.448778
#>   [73] 2.122256 2.194954 2.284150 4.088315 3.214140 2.688912 2.405265 2.282933
#>   [81] 2.235928 2.219626 2.375044 2.202265 2.373397 2.243802 2.463568 2.259857
#>   [89] 3.096336 2.505973 2.343167 2.211804 2.263553 2.411079 3.270715 2.358670
#>   [97] 2.160601 3.077763 2.150695 3.335479 2.656914 2.209166 2.468470 2.220051
#>  [105] 2.230433 2.304490 3.071467 2.812230 3.060172 2.580506 2.318391 3.000447
#>  [113] 3.159669 2.529514 2.441784 2.803804 2.666278 2.913943 2.510455 2.836075
#>  [121] 2.264243 2.386437 2.399626 2.350546 2.303212 3.554361 2.447321 2.298799
#>  [129] 2.758459 2.414990 3.402631 2.672514 2.210194 2.662275 2.368337 3.023107
#>  [137] 2.300885 2.376440 2.739359 5.356159 2.527944 3.415592 2.779862 3.046894
#>  [145] 2.773047 2.300794 2.516966 2.405139 2.377319 2.304485 2.388043 2.414020
#>  [153] 3.079328 2.311424 3.399344 2.444282 2.499055 2.362487 3.327889 3.374418
#>  [161] 4.283714 2.512167 2.647116 2.588686 2.669233 2.376316 2.435975 2.788391
#>  [169] 2.523278 3.081978 2.526110 3.417503 2.658394 2.504456 2.528097 2.473714
#>  [177] 2.756809 4.907656 2.522946 4.506716 2.998665 3.129865 2.420649 2.563883
#>  [185] 2.444794 2.631632 2.760194 2.421189 2.398261 2.222887 3.942068 3.501646
#>  [193] 2.280635 2.732697 2.837002 2.453195 2.385928 3.700682 3.098629 2.478542
#>  [201] 2.753558 2.763687 3.603205 2.554965 2.461489 2.782830 2.507915 2.495259
#>  [209] 3.205411 3.785173 2.719918 3.339984 5.266818 2.498469 2.913110 2.991437
#>  [217] 3.061039 2.824088 2.514078 2.624245 6.524390 2.625522 2.688347 2.432665
#>  [225] 2.505293 3.272648 2.585555 2.521700 2.445717 2.543118 3.171608 2.613935
#>  [233] 2.518802 2.393835 3.421485 2.972313 2.577146 2.850681 2.714704 2.580884
#>  [241] 2.386333 2.697826 2.550889 4.886010 3.147424 3.259914 3.085455 2.777399
#>  [249] 3.535740 4.434031 2.778055 2.757343 2.567819 3.163561 2.774478 4.716693
#>  [257] 3.276145 2.505020 3.803461 2.578229 3.461727 2.572412 2.680091 2.563515
#>  [265] 3.152757 5.642844 2.829898 2.817875 2.632452 3.335756 4.589525 2.601979
#>  [273] 2.896802 2.619614 3.471961 2.574056 2.918288 3.984868 2.802838 3.153914
#>  [281] 2.749135 2.583296 2.549765 3.540138 2.672381 4.002720 4.111731 3.076526
#>  [289] 2.689113 2.869295 2.613572 2.630096 3.045009 3.111092 2.733147 3.077138
#>  [297] 3.287308 2.819850 2.777358 3.770783 2.901214 2.862444 3.648096 2.504669
#>  [305] 2.873847 2.904994 2.760643 2.622298 3.084078 2.995738 4.304413 3.031434
#>  [313] 3.168388 3.457882 2.681457 3.204299 4.292212 2.957736 3.165002 4.288307
#>  [321] 2.885498 3.043569 3.049978 2.961787 3.445098 2.840172 4.028226 3.159508
#>  [329] 3.038746 3.058655 3.013458 2.494327 4.175549 2.671223 3.405958 2.988619
#>  [337] 2.906655 3.087903 3.494616 3.184575 3.154802 3.205125 2.937227 2.818476
#>  [345] 2.738629 2.971563 2.712093 3.268500 2.882104 3.995208 2.766435 3.675460
#>  [353] 3.121895 2.671770 2.735914 4.212717 3.826649 2.881044 2.682132 2.729397
#>  [361] 2.880207 2.795193 3.132799 3.374109 2.975177 3.107462 3.490718 3.627595
#>  [369] 2.746772 3.026875 3.846731 4.531946 3.094428 3.062128 2.899320 3.004565
#>  [377] 3.318564 2.876984 4.972365 4.236666 3.601345 2.883815 3.061549 5.847291
#>  [385] 3.573615 3.513150 5.519004 2.917969 3.469834 5.581383 3.783829 5.248235
#>  [393] 4.285892 2.811689 3.018084 2.851769 2.625813 5.173330 3.473988 3.493140
#>  [401] 3.504336 3.039546 3.134160 3.772477 3.427069 3.279914 3.302548 4.234804
#>  [409] 2.815543 3.384708 4.158867 5.614057 3.014214 2.995985 2.853591 3.032993
#>  [417] 3.150960 3.028553 3.309813 5.547559 2.613122 4.111624 2.939922 3.412941
#>  [425] 3.205401 3.754533 3.059851 2.902755 3.453556 2.920460 3.045199 4.397014
#>  [433] 2.904881 3.959306 3.266509 3.018190 4.115975 2.923327 3.111349 3.146718
#>  [441] 3.469811 2.730679 3.038165 3.232789 2.844207 4.392956 3.349564 2.984551
#>  [449] 4.632261 4.102302 3.111486 3.294408 5.212656 3.257288 3.607930 2.936575
#>  [457] 3.105125 3.636805 3.119457 2.766690 3.061501 2.907970 3.126437 2.889065
#>  [465] 3.275503 3.429704 3.417515 2.863313 6.021582 3.515266 3.314481 2.906613
#>  [473] 4.034833 3.538217 3.129814 4.339163 3.947322 3.402724 3.210697 3.315297
#>  [481] 3.876704 4.110228 3.053260 3.130718 4.391551 3.292642 3.082609 2.893450
#>  [489] 2.833360 4.145800 2.828552 3.066124 2.820989 2.964991 4.503303 3.084582
#>  [497] 2.879319 3.866083 4.866860 4.128062 3.166605 3.191992 2.997118 3.895604
#>  [505] 4.672675 3.317324 3.583224 3.472401 4.275355 5.810840 3.091793 3.187891
#>  [513] 3.762807 3.209975 3.311576 3.931168 3.977489 3.072699 4.027145 3.091610
#>  [521] 3.569371 2.918534 3.126742 3.677142 2.906815 2.999909 2.869706 3.406332
#>  [529] 3.142642 3.442945 3.194029 2.836252 4.552388 5.881248 2.769316 3.041612
#>  [537] 3.131950 3.119697 4.413391 3.022119 3.603428 3.125300 4.601599 3.005488
#>  [545] 2.975432 5.187294 3.033460 2.861497 3.771196 4.125971 3.918574 3.406239
#>  [553] 2.923402 3.416220 2.995105 2.944589 4.047450 2.908738 4.171489 2.886468
#>  [561] 3.009789 2.997692 3.379060 3.386628 3.417768 3.269855 5.344707 2.676200
#>  [569] 3.870243 3.178218 3.442279 2.907055 2.930189 3.197841 3.439645 3.238726
#>  [577] 3.081989 2.912003 3.065807 2.910184 2.896037 4.083147 3.160098 4.302242
#>  [585] 2.857113 3.214391 4.664936 3.419287 3.113566 2.690945 4.609535 4.350485
#>  [593] 3.390218 3.932931 2.742506 3.481195 3.621762 3.090629 3.448568 3.000845
#>  [601] 3.399657 3.912648 3.312562 3.867474 4.930656 2.900063 3.171882 3.532238
#>  [609] 4.664775 3.255183 3.190490 2.935326 2.925912 3.244835 4.043329 2.637328
#>  [617] 2.958405 3.230938 3.072386 2.901956 2.987027 2.863394 2.671805 3.650229
#>  [625] 3.518070 3.761191 2.678031 3.750303 3.281264 2.796619 3.035831 3.621525
#>  [633] 4.827274 3.324728 2.838279 2.853098 3.246496 2.694090 2.871168 3.262483
#>  [641] 3.142475 3.147247 5.420599 2.770696 2.783801 2.884203 2.920680 2.912911
#>  [649] 2.707623 3.195098 2.569070 6.696770 2.683933 3.225784 3.425387 3.087215
#>  [657] 3.495440 2.770311 5.761507 3.983927 3.497628 3.226080 3.460347 2.986042
#>  [665] 2.635236 3.745038 2.803656 2.891996 2.635862 2.517818 6.138496 2.675636
#>  [673] 2.566514 2.880260 2.570739 5.890618 4.460939 3.134935 2.805226 2.671879
#>  [681] 3.147234 2.983460 3.351004 2.870568 3.626595 2.924705 3.349258 2.596185
#>  [689] 5.812723 4.978453 3.103541 2.723725 2.989406 2.652052 3.218327 2.574147
#>  [697] 2.925794 4.800190 2.843006 2.936138 5.662071 2.748219 3.104793 3.715465
#>  [705] 3.071855 3.893087 2.850687 4.182558 2.740224 3.344925 3.710780 3.757695
#>  [713] 2.698575 2.789627 2.633477 2.952379 3.368484 2.572385 2.803960 2.581554
#>  [721] 3.958422 2.636049 3.914526 3.922412 3.391536 2.549819 2.594605 2.677197
#>  [729] 2.609993 3.064577 2.567528 2.750249 3.552011 2.622231 3.825516 3.610507
#>  [737] 2.555532 2.655248 2.798198 2.456285 2.812479 5.623967 2.802041 2.640005
#>  [745] 2.542525 2.809179 2.523351 3.391938 3.236107 3.978464 2.636496 2.546840
#>  [753] 2.698975 3.638133 2.943745 3.278499 3.763871 2.406333 2.537921 2.665702
#>  [761] 2.806238 2.639343 3.108995 2.593705 3.206446 4.059255 2.671241 2.538003
#>  [769] 3.557314 3.706909 3.288219 2.555691 2.567502 3.118246 2.789531 3.278178
#>  [777] 3.387348 2.551665 2.506031 2.753655 4.398785 3.336474 2.594197 2.649556
#>  [785] 2.570305 3.479827 4.028438 2.480032 2.985742 2.881560 3.033125 3.416143
#>  [793] 2.401544 2.679880 4.247517 3.841785 2.960985 2.428673 2.662979 2.666651
#>  [801] 2.645295 2.386948 2.814740 2.694685 2.589503 2.445124 2.784779 2.597479
#>  [809] 2.522522 2.583696 2.941249 2.640083 4.299756 2.342358 3.305164 2.728239
#>  [817] 2.563030 3.745886 3.383276 3.008687 3.845822 2.695294 2.983177 2.703443
#>  [825] 3.043715 2.349000 2.931739 2.671959 4.013773 2.280952 2.414362 3.571735
#>  [833] 3.944224 3.788265 2.447561 3.380788 2.409450 2.286878 2.593043 3.001159
#>  [841] 2.274655 2.483408 2.414419 2.414105 2.326573 2.917431 2.708901 2.844424
#>  [849] 2.465766 3.773872 2.539779 2.201007 3.001390 2.572383 2.855427 2.419679
#>  [857] 2.459330 3.475477 3.428882 2.471893 2.425404 3.679711 2.555962 2.335916
#>  [865] 2.850663 2.790773 2.740232 2.410431 2.429098 3.859034 2.421984 2.500822
#>  [873] 2.517293 2.413277 2.135953 2.791262 2.936808 2.111540 2.155777 2.437363
#>  [881] 2.498417 3.044920 3.330169 3.024168 3.061377 3.497842 2.305276 3.642577
#>  [889] 3.356208 2.236766 2.273734 2.598168 3.001691 2.095432 2.369134 2.439700
#>  [897] 3.431133 4.842114 3.317416 2.887463 2.352016 2.944176 2.261241 2.395479
#>  [905] 2.130474 2.629295 2.198255 2.296895 2.683111 2.263649 3.435752 3.256162
#>  [913] 2.312726 2.475618 3.689019 2.069077 2.688899 2.466145 2.151337 2.126694
#>  [921] 3.487067 2.356364 2.487095 2.119313 2.142650 2.754491 2.945615 2.260876
#>  [929] 2.869813 2.166157 2.150403 2.106435 3.375754 2.435594 2.856531 2.263214
#>  [937] 3.041913 2.172078 2.545258 2.103093 2.230794 2.115897 2.458308 2.313907
#>  [945] 2.372318 2.096275 2.693425 2.294437 2.119573 2.433029 2.525079 2.539542
#>  [953] 2.476966 2.627998 2.632483 2.241862 2.064550 2.337467 3.132656 2.075889
#>  [961] 2.301174 2.172151 2.027950 3.423485 2.399043 2.753344 2.015842 2.513056
#>  [969] 2.376479 2.217831 2.235982 2.422366 2.467892 2.053773 2.379755 2.434223
#>  [977] 2.125852 2.688518 2.066812 2.608774 1.973150 2.460382 3.143638 2.161306
#>  [985] 2.275365 2.691380 2.095852 2.184302 1.932129 2.283432 1.921477 2.031262
#>  [993] 2.189533 2.309769 2.133190 2.042262 2.274570 2.483920 2.067305 2.216358