Skip to contents

Read allele frequencies in FSIgen format (.csv)

Usage

read_allele_freqs(filename, remove_zeroes = TRUE, normalise = TRUE)

Arguments

filename

Path to csv file.

remove_zeroes

Logical. Should frequencies of 0 be removed from the return value? Default is TRUE.

normalise

Logical. Should frequencies be normalised to sum to 1? Default is TRUE.

Value

Named list with frequencies by locus. The frequencies at a locus are returned as a named numeric vector with names corresponding to alleles.

Details

Reads allele frequencies from a .csv file. The file should be in FSIgen format, i.e. comma separated with the first column specifying the allele labels and one column per locus. The last row should be the number of observations. No error checking is done since the file format is only loosely defined, e.g. we do not restrict the first column name or the last row name.

Examples

# below we read an allele freqs file that comes with the package
filename <- system.file("extdata","FBI_extended_Cauc_022024.csv",package = "simDNAmixtures")
freqs <- read_allele_freqs(filename)
freqs # the output is a list with an attribute named \code{N} giving the sample size.
#> $AMEL
#> X,X X,Y 
#> 0.5 0.5 
#> 
#> $D3S1358
#>         13         14         15         16         17         18         19 
#> 0.00249975 0.13858614 0.24747525 0.23267673 0.21037896 0.16338366 0.00499950 
#> 
#> $vWA
#>     13     14     15     16     17     18     19     20 
#> 0.0050 0.0990 0.1139 0.2054 0.2673 0.2178 0.0817 0.0099 
#> 
#> $D16S539
#>          8          9         10         11         12         13         14 
#> 0.01979604 0.10397920 0.06438712 0.27224555 0.34153169 0.16336733 0.03219356 
#>         15 
#> 0.00249950 
#> 
#> $CSF1PO
#>          7          8          9         10       10.3         11         12 
#> 0.00249950 0.00499900 0.01979604 0.25244951 0.00249950 0.29944011 0.32663467 
#>         13         14         15 
#> 0.07178564 0.01489702 0.00499900 
#> 
#> $TPOX
#>      8      9     10     11     12 
#> 0.5470 0.1238 0.0371 0.2550 0.0371 
#> 
#> $Yindel
#> 2 
#> 1 
#> 
#> $D8S1179
#>      8      9     10     11     12     13     14     15     16     17 
#> 0.0198 0.0099 0.1089 0.0594 0.1411 0.3342 0.2054 0.1064 0.0124 0.0025 
#> 
#> $D21S11
#>       24.2         27         28         29         30       30.2         31 
#> 0.00499900 0.04459108 0.16826635 0.18066387 0.23265347 0.03959208 0.07178564 
#>       31.2         32       32.2       33.2       35.2 
#> 0.10147970 0.01489702 0.10887822 0.02969406 0.00249950 
#> 
#> $D18S51
#>         10         11         12         13         14         15         16 
#> 0.01489553 0.01239628 0.12866140 0.11876437 0.17564731 0.13365990 0.10396881 
#>         17         18         19         20         21         22 
#> 0.15345396 0.09157253 0.03468959 0.02479256 0.00499850 0.00249925 
#> 
#> $DYS391
#>      9     10     11 
#> 0.0206 0.4536 0.5258 
#> 
#> $D2S441
#>          9         10         11       11.3         12       12.3         13 
#> 0.00249975 0.18068193 0.30936906 0.08419158 0.04949505 0.00249975 0.04949505 
#>         14         15         16 
#> 0.26237376 0.05199480 0.00739926 
#> 
#> $D19S433
#>         12       12.2         13       13.2         14       14.2         15 
#> 0.09648070 0.00499900 0.27964407 0.02229554 0.34893021 0.00989802 0.14357129 
#>       15.2         16       16.2         17       17.2       18.2 
#> 0.02479504 0.03959208 0.01979604 0.00249950 0.00499900 0.00249950 
#> 
#> $TH01
#>      6      7      8    8.3      9    9.3     10 
#> 0.2252 0.1733 0.1262 0.0025 0.1658 0.3045 0.0025 
#> 
#> $FGA
#>     18     19     20   20.2     21     22   22.2     23     24     25     26 
#> 0.0297 0.0545 0.1436 0.0025 0.1757 0.1881 0.0099 0.1584 0.1386 0.0718 0.0173 
#>     27 
#> 0.0099 
#> 
#> $D22S1045
#>         11         12         13         14         15         16         17 
#> 0.14358564 0.00739926 0.00499950 0.06189381 0.36386361 0.31676832 0.09649035 
#>         18 
#> 0.00499950 
#> 
#> $D5S818
#>      9     10     11     12     13     14     15 
#> 0.0297 0.0495 0.4084 0.3515 0.1510 0.0074 0.0025 
#> 
#> $D13S317
#>          8          9         10         11         12         13         14 
#> 0.10148985 0.08169183 0.04949505 0.31186881 0.30936906 0.11138886 0.03469653 
#> 
#> $D7S820
#>      6      7      8      9     10     11     12     13     14 
#> 0.0025 0.0173 0.1634 0.1460 0.2896 0.2030 0.1411 0.0297 0.0074 
#> 
#> $SE33
#>          12          13        13.2          14        14.2          15 
#> 0.017293083 0.007397041 0.002499000 0.027189124 0.002499000 0.042083167 
#>          16        16.3          17        17.3          18        18.3 
#> 0.042083167 0.002499000 0.071771291 0.002499000 0.079168333 0.002499000 
#>          19        19.2          20        20.2          21        21.2 
#> 0.066773291 0.004998001 0.042083167 0.017293083 0.024790084 0.012395042 
#>          22        22.2          23        23.2          24        24.2 
#> 0.004998001 0.027189124 0.004998001 0.042083167 0.002499000 0.029688125 
#>          25        25.2        26.2        27.2        28.2        29.2 
#> 0.002499000 0.049480208 0.037085166 0.064374250 0.069272291 0.091563375 
#>        30.2        31.2          32        32.2        33.2          34 
#> 0.054478209 0.029688125 0.002499000 0.009896042 0.007397041 0.002499000 
#> 
#> $D10S1248
#>         10         11         12         13         14         15         16 
#> 0.00249975 0.00249975 0.03709629 0.33656634 0.27477252 0.17328267 0.13118688 
#>         17         18 
#> 0.03959604 0.00249975 
#> 
#> $D1S1656
#>         10         11         12         13         14       14.3         15 
#> 0.00499950 0.06929307 0.11878812 0.04949505 0.09159084 0.00739926 0.14358564 
#>       15.3         16       16.3         17       17.3       18.3       19.3 
#> 0.05939406 0.11138886 0.05199480 0.05689431 0.15098490 0.07179282 0.01239876 
#> 
#> $D12S391
#>          15          16          17        17.3          18        18.3 
#> 0.039588124 0.042087374 0.103968809 0.024792562 0.175647306 0.019794062 
#>          19        19.3          20        20.3          21          22 
#> 0.106368090 0.009897031 0.103968809 0.002499250 0.133659902 0.103968809 
#>          23          24          25          26          27 
#> 0.074277717 0.027191842 0.024792562 0.004998500 0.002499250 
#> 
#> $D2S1338
#>     16     17     18     19     20     21     22     23     24     25     26 
#> 0.0297 0.1931 0.0668 0.1510 0.1485 0.0198 0.0297 0.1213 0.1213 0.0965 0.0223 
#> 
#> $`Penta E`
#>          5          6          7          8          9         10         11 
#> 0.07919208 0.00249975 0.13608639 0.01729827 0.01239876 0.09409059 0.09899010 
#>         12         13         14         15         16       16.4         17 
#> 0.15838416 0.10888911 0.07179282 0.04209579 0.04459554 0.00249975 0.06929307 
#>         18         19         20         21 
#> 0.02969703 0.01239876 0.01239876 0.00739926 
#> 
#> $`Penta D`
#>        2.2          7          8          9         10         11         12 
#> 0.00499950 0.00499950 0.01729827 0.23507649 0.11628837 0.13368663 0.21037896 
#>         13         14         15 
#> 0.20787921 0.05449455 0.01489851 
#> 
#> attr(,"N")
#>     AMEL  D3S1358      vWA  D16S539   CSF1PO     TPOX   Yindel  D8S1179 
#>      404      404      404      404      404      404       97      404 
#>   D21S11   D18S51   DYS391   D2S441  D19S433     TH01      FGA D22S1045 
#>      404      404      194      404      404      404      404      404 
#>   D5S818  D13S317   D7S820     SE33 D10S1248  D1S1656  D12S391  D2S1338 
#>      404      404      404      404      404      404      404      404 
#>  Penta E  Penta D 
#>      404      404