From 6f2818c453dc29edee9fc9410dabf0576334de2d Mon Sep 17 00:00:00 2001 From: dramanica Date: Mon, 9 Dec 2024 21:36:50 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20EvolEcol?= =?UTF-8?q?Group/tidypopgen@e7acf7885539fa145f7fe1f038bb54ea8faa1968=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- articles/a01_overview.html | 66 +++++---- articles/a02_qc.html | 13 +- articles/a03_example_clustering_and_dapc.html | 22 ++- pkgdown.yml | 2 +- reference/autoplot.gt_admix.html | 8 ++ reference/autoplot_gt_admix.html | 114 +++++++++++++++ reference/autoplot_gt_pcadapt.html | 4 +- reference/c.gt_admix.html | 82 +++++++++++ reference/get_p_matrix.html | 12 +- reference/get_q_matrix.html | 12 +- reference/gt_admixture.html | 133 ++++++++++++++++++ reference/gt_as_plink.html | 12 +- reference/gt_order_loci.html | 108 ++++++++++++++ reference/gt_save.html | 2 +- reference/gt_update_backingfile.html | 105 ++++++++++++++ reference/index.html | 64 +++++++-- reference/is_loci_table_ordered.html | 101 +++++++++++++ reference/is_loci_table_ordered.tbl_df.html | 8 ++ .../is_loci_table_ordered.vctrs_bigSNP.html | 8 ++ reference/pairwise_ibs.html | 4 +- reference/q_matrix.html | 28 ++-- reference/read_q_files.html | 87 ++++++++++++ reference/summary.gt_admix.html | 86 +++++++++++ search.json | 2 +- sitemap.xml | 11 +- 25 files changed, 987 insertions(+), 107 deletions(-) create mode 100644 reference/autoplot.gt_admix.html create mode 100644 reference/autoplot_gt_admix.html create mode 100644 reference/c.gt_admix.html create mode 100644 reference/gt_admixture.html create mode 100644 reference/gt_order_loci.html create mode 100644 reference/gt_update_backingfile.html create mode 100644 reference/is_loci_table_ordered.html create mode 100644 reference/is_loci_table_ordered.tbl_df.html create mode 100644 reference/is_loci_table_ordered.vctrs_bigSNP.html create mode 100644 reference/read_q_files.html create mode 100644 reference/summary.gt_admix.html diff --git a/articles/a01_overview.html b/articles/a01_overview.html index 82fd3380..7b88c88b 100644 --- a/articles/a01_overview.html +++ b/articles/a01_overview.html @@ -167,12 +167,12 @@

The gen_tibble loci=example_loci, backingfile = tempfile()) #> -#> gen_tibble saved to /tmp/RtmpBI8D7y/file1e322a471272.gt -#> using bigSNP file: /tmp/RtmpBI8D7y/file1e322a471272.rds -#> with backing file: /tmp/RtmpBI8D7y/file1e322a471272.bk +#> gen_tibble saved to /tmp/Rtmpw9DdD6/file1e84387848a.gt +#> using bigSNP file: /tmp/Rtmpw9DdD6/file1e84387848a.rds +#> with backing file: /tmp/Rtmpw9DdD6/file1e84387848a.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: -#> gt_load('/tmp/RtmpBI8D7y/file1e322a471272.gt') +#> gt_load('/tmp/Rtmpw9DdD6/file1e84387848a.gt')

We are provided information on where the three files underlying the genotype information are stored. As we don’t want to keep the files, we used the tmp directory; normally you will want to use your working @@ -514,22 +514,20 @@

Saving and reading data
 gt_file_name <- gt_save(example_gt)
 #> 
-#> gen_tibble saved to /tmp/RtmpBI8D7y/file1e322a471272.gt
-#> using bigSNP file: /tmp/RtmpBI8D7y/file1e322a471272.rds
-#> with backing file: /tmp/RtmpBI8D7y/file1e322a471272.bk
+#> gen_tibble saved to /tmp/Rtmpw9DdD6/file1e84387848a.gt
+#> using bigSNP file: /tmp/Rtmpw9DdD6/file1e84387848a.rds
+#> with backing file: /tmp/Rtmpw9DdD6/file1e84387848a.bk
 #> make sure that you do NOT delete those files!
 #> to reload the gen_tibble in another session, use:
-#> gt_load('/tmp/RtmpBI8D7y/file1e322a471272.gt')
+#> gt_load('/tmp/Rtmpw9DdD6/file1e84387848a.gt')
 gt_file_name
-#> [1] "/tmp/RtmpBI8D7y/file1e322a471272.gt" 
-#> [2] "/tmp/RtmpBI8D7y/file1e322a471272.rds"
-#> [3] "/tmp/RtmpBI8D7y/file1e322a471272.bk"
+#> [1] "/tmp/Rtmpw9DdD6/file1e84387848a.gt" "/tmp/Rtmpw9DdD6/file1e84387848a.rds" +#> [3] "/tmp/Rtmpw9DdD6/file1e84387848a.bk"

And if we ever need to retrieve the location of the .bk and .rds files for a gen_tibble, we can use:

 gt_get_file_names(example_gt)
-#> [1] "/tmp/RtmpBI8D7y/file1e322a471272.rds"
-#> [2] "/tmp/RtmpBI8D7y/file1e322a471272.bk"
+#> [1] "/tmp/Rtmpw9DdD6/file1e84387848a.rds" "/tmp/Rtmpw9DdD6/file1e84387848a.bk"

In a later session, we could reload the data with:

 new_example_gt <- gt_load(gt_file_name[1])
@@ -553,12 +551,12 @@ 

Saving and reading databed_path_pop_a <- system.file("extdata/pop_a.bed", package = "tidypopgen") pop_a_gt <- gen_tibble(bed_path_pop_a, backingfile = tempfile("pop_a_")) #> -#> gen_tibble saved to /tmp/RtmpBI8D7y/pop_a_1e3266f63279.gt -#> using bigSNP file: /tmp/RtmpBI8D7y/pop_a_1e3266f63279.rds -#> with backing file: /tmp/RtmpBI8D7y/pop_a_1e3266f63279.bk +#> gen_tibble saved to /tmp/Rtmpw9DdD6/pop_a_1e845eb44469.gt +#> using bigSNP file: /tmp/Rtmpw9DdD6/pop_a_1e845eb44469.rds +#> with backing file: /tmp/Rtmpw9DdD6/pop_a_1e845eb44469.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: -#> gt_load('/tmp/RtmpBI8D7y/pop_a_1e3266f63279.gt')

+#> gt_load('/tmp/Rtmpw9DdD6/pop_a_1e845eb44469.gt')

For this vignette, we don’t want to keep files, so we are using again a temporary path for the backing files, but in normal instances, we can simply omit the backingfile parameter, and the @@ -574,7 +572,7 @@

Saving and reading data
 gt_as_plink(example_gt, file =  tempfile("new_bed_"))
-#> [1] "/tmp/RtmpBI8D7y/new_bed_1e321b01af13.bed"
+#> [1] "/tmp/Rtmpw9DdD6/new_bed_1e8446591f04.bed"

This will also write a .bim and .fam file and save them together with the .bed file. Note that, from the main tibble, only id, population and sex will be preserved in the @@ -608,22 +606,22 @@

Merging databigsnp_path_a <- bigsnpr::snp_readBed(bed_path_pop_a, backingfile = tempfile("pop_a_")) pop_a_gt <- gen_tibble(bigsnp_path_a) #> -#> gen_tibble saved to /tmp/RtmpBI8D7y/pop_a_1e3270779944.gt -#> using bigSNP file: /tmp/RtmpBI8D7y/pop_a_1e3270779944.rds -#> with backing file: /tmp/RtmpBI8D7y/pop_a_1e3270779944.bk +#> gen_tibble saved to /tmp/Rtmpw9DdD6/pop_a_1e844950b6e2.gt +#> using bigSNP file: /tmp/Rtmpw9DdD6/pop_a_1e844950b6e2.rds +#> with backing file: /tmp/Rtmpw9DdD6/pop_a_1e844950b6e2.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: -#> gt_load('/tmp/RtmpBI8D7y/pop_a_1e3270779944.gt') +#> gt_load('/tmp/Rtmpw9DdD6/pop_a_1e844950b6e2.gt') bed_path_pop_b <- system.file("extdata/pop_b.bed", package = "tidypopgen") bigsnp_path_b <- bigsnpr::snp_readBed(bed_path_pop_b, backingfile = tempfile("pop_b_")) pop_b_gt <- gen_tibble(bigsnp_path_b) #> -#> gen_tibble saved to /tmp/RtmpBI8D7y/pop_b_1e3249a1f0c9.gt -#> using bigSNP file: /tmp/RtmpBI8D7y/pop_b_1e3249a1f0c9.rds -#> with backing file: /tmp/RtmpBI8D7y/pop_b_1e3249a1f0c9.bk +#> gen_tibble saved to /tmp/Rtmpw9DdD6/pop_b_1e842df68a88.gt +#> using bigSNP file: /tmp/Rtmpw9DdD6/pop_b_1e842df68a88.rds +#> with backing file: /tmp/Rtmpw9DdD6/pop_b_1e842df68a88.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: -#> gt_load('/tmp/RtmpBI8D7y/pop_b_1e3249a1f0c9.gt') +#> gt_load('/tmp/Rtmpw9DdD6/pop_b_1e842df68a88.gt')

And inspect them:

+#> gt_load('/tmp/Rtmpw9DdD6/gt_merged.gt')

Let’s check the resulting gen_tibble:

 merged_gt
@@ -759,12 +757,12 @@ 

Imputationbed_file <- system.file("extdata", "example-missing.bed", package = "bigsnpr") missing_gt <- gen_tibble(bed_file, backingfile = tempfile("missing_")) #> -#> gen_tibble saved to /tmp/RtmpBI8D7y/missing_1e3265b836b0.gt -#> using bigSNP file: /tmp/RtmpBI8D7y/missing_1e3265b836b0.rds -#> with backing file: /tmp/RtmpBI8D7y/missing_1e3265b836b0.bk +#> gen_tibble saved to /tmp/Rtmpw9DdD6/missing_1e8416d6b7c2.gt +#> using bigSNP file: /tmp/Rtmpw9DdD6/missing_1e8416d6b7c2.rds +#> with backing file: /tmp/Rtmpw9DdD6/missing_1e8416d6b7c2.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: -#> gt_load('/tmp/RtmpBI8D7y/missing_1e3265b836b0.gt') +#> gt_load('/tmp/Rtmpw9DdD6/missing_1e8416d6b7c2.gt') missing_gt #> # A gen_tibble: 500 loci #> # A tibble: 200 × 3 diff --git a/articles/a02_qc.html b/articles/a02_qc.html index 78c4e60c..3557b0b8 100644 --- a/articles/a02_qc.html +++ b/articles/a02_qc.html @@ -294,14 +294,15 @@

Save
 gt_save(ld_data, file_name = tempfile())
## 
-## gen_tibble saved to /tmp/RtmpkX48XV/file1e83178c00e1.gt
-
## using bigSNP file: /tmp/RtmpkX48XV/file1e83cf20541.rds
-
## with backing file: /tmp/RtmpkX48XV/file1e83cf20541.bk
+## gen_tibble saved to /tmp/RtmpjyR3xY/file1ed5274867b3.gt

+
## using bigSNP file: /tmp/RtmpjyR3xY/file1ed5766ee7e3.rds
+
## with backing file: /tmp/RtmpjyR3xY/file1ed5766ee7e3.bk
## make sure that you do NOT delete those files!
## to reload the gen_tibble in another session, use:
-
## gt_load('/tmp/RtmpkX48XV/file1e83178c00e1.gt')
-
## [1] "/tmp/RtmpkX48XV/file1e83178c00e1.gt" "/tmp/RtmpkX48XV/file1e83cf20541.rds"
-## [3] "/tmp/RtmpkX48XV/file1e83cf20541.bk"
+
## gt_load('/tmp/RtmpjyR3xY/file1ed5274867b3.gt')
+
## [1] "/tmp/RtmpjyR3xY/file1ed5274867b3.gt" 
+## [2] "/tmp/RtmpjyR3xY/file1ed5766ee7e3.rds"
+## [3] "/tmp/RtmpjyR3xY/file1ed5766ee7e3.bk"

Grouping data diff --git a/articles/a03_example_clustering_and_dapc.html b/articles/a03_example_clustering_and_dapc.html index 2396775b..55ef7cdd 100644 --- a/articles/a03_example_clustering_and_dapc.html +++ b/articles/a03_example_clustering_and_dapc.html @@ -454,7 +454,7 @@

Clustering with sNMF
 geno_file <- gt_as_geno_lea(anole_gt)
 geno_file
-#> [1] "/tmp/RtmpPvAlXU/anolis_1ece3d9bd99d.geno"

+#> [1] "/tmp/Rtmpun9qPy/anolis_1f1f194a7919.geno"

Note that the .geno file is placed by default in the same directory and using the same name as the backing file of the gen_tibble

@@ -570,19 +570,13 @@

ADMIXTURE and handling multi }

And read them back into a q_matrix_list:

-q_list <- q_matrix(dir)
+q_list <- read_q_files(dir)
 summary(q_list)
-#>     K Repeats
-#> 1   1       3
-#> 2   2       3
-#> 3   3       3
-#> 4   4       3
-#> 5   5       3
-#> 6   6       3
-#> 7   7       3
-#> 8   8       3
-#> 9   9       3
-#> 10 10       3
+#> Admixture results for multiple runs: +#> k 1 2 3 4 5 6 7 8 9 10 +#> n 3 3 3 3 3 3 3 3 3 3 +#> with slots: +#> $Q for Q matrices

q_matrix has read and summarised the .Q files from our analysis,and we can access a single matrix from the list by selecting the run number and K value of interest. For example, if we would like to view the @@ -637,7 +631,7 @@

ADMIXTURE and handling multi #> [45,] 0.850262000 0.027241300 0.12249600 #> [46,] 0.999800000 0.000099990 0.00009999 #> attr(,"class") -#> [1] "q_matrix" "matrix" "array" +#> [1] "q_matrix" "q_matrix" "matrix" "array"

Similarly to before, we can then autoplot any of these matrices by selecting from the q_matrix_list:

diff --git a/pkgdown.yml b/pkgdown.yml
index 1a7c6ffc..3a44a46e 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -6,7 +6,7 @@ articles:
   a02_qc: a02_qc.html
   a03_example_clustering_and_dapc: a03_example_clustering_and_dapc.html
   a99_plink_cheatsheet: a99_plink_cheatsheet.html
-last_built: 2024-12-08T21:56Z
+last_built: 2024-12-09T21:35Z
 urls:
   reference: https://evolecolgroup.github.io/tidypopgen/reference
   article: https://evolecolgroup.github.io/tidypopgen/articles
diff --git a/reference/autoplot.gt_admix.html b/reference/autoplot.gt_admix.html
new file mode 100644
index 00000000..334098cf
--- /dev/null
+++ b/reference/autoplot.gt_admix.html
@@ -0,0 +1,8 @@
+
+  
+    
+    
+    
+  
+
+
diff --git a/reference/autoplot_gt_admix.html b/reference/autoplot_gt_admix.html
new file mode 100644
index 00000000..f46204a1
--- /dev/null
+++ b/reference/autoplot_gt_admix.html
@@ -0,0 +1,114 @@
+
+Autoplots for gt_admix objects — autoplot_gt_admix • tidypopgen
+    Skip to contents
+
+
+    
+
+
+ +
+

For gt_admix, the following types of plots are available:

  • cv: the cross-validation error for each value of k

  • +
  • barplot a standard barplot of the admixture proportions

  • +
+ +
+

Usage

+
# S3 method for class 'gt_admix'
+autoplot(object, type = c("cv", "barplot"), k = NULL, run = NULL, ...)
+
+ +
+

Arguments

+ + +
object
+

an object of class gt_admixture

+ + +
type
+

the type of plot (one of "cv", and "boxplot")

+ + +
k
+

the value of k to plot (for barplot type only) +param repeat the repeat to plot (for barplot type only)

+ + +
run
+

the run to plot (for barplot type only)

+ + +
...
+

not used.

+ +
+
+

Value

+

a ggplot2 object

+
+
+

Details

+

autoplot produces simple plots to quickly inspect an object. They are +not customisable; we recommend that you use ggplot2 to produce publication +ready plots.

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/autoplot_gt_pcadapt.html b/reference/autoplot_gt_pcadapt.html index 6f7d9f9e..e1689812 100644 --- a/reference/autoplot_gt_pcadapt.html +++ b/reference/autoplot_gt_pcadapt.html @@ -50,9 +50,9 @@
-

For gt_pcadapt, the following types of plots are available:

  • qq: a qunatile-quantile plot of the p-values from pcadapt +

    For gt_pcadapt, the following types of plots are available:

    • qq: a qunatile-quantile plot of the p-values from pcadapt (wrapping bigsnpr::snp_qq())

    • -
    • manhattan a manhattan plot of the p-values from pcadapt +

    • manhattan a manhattan plot of the p-values from pcadapt (wrapping bigsnpr::snp_manhattan())

diff --git a/reference/c.gt_admix.html b/reference/c.gt_admix.html new file mode 100644 index 00000000..28896b7a --- /dev/null +++ b/reference/c.gt_admix.html @@ -0,0 +1,82 @@ + +Combine method for gt_admix objects — c.gt_admix • tidypopgen + Skip to contents + + +
+
+
+ +
+

Combine method for gt_admix objects

+
+ +
+

Usage

+
# S3 method for class 'gt_admix'
+c(...)
+
+ +
+

Arguments

+ + +
...
+

A list of gt_admix objects

+ +
+
+

Value

+

A gt_admix object with the combined data

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/get_p_matrix.html b/reference/get_p_matrix.html index dc6038de..a7f45d97 100644 --- a/reference/get_p_matrix.html +++ b/reference/get_p_matrix.html @@ -1,6 +1,6 @@ -Return a single P matrix from a q_matrix_list object — get_p_matrix • tidypopgenReturn a single P matrix from a gt_admix object — get_p_matrix • tidypopgen Skip to contents @@ -34,13 +34,13 @@
-

This function retrieves a single P matrix from a q_matrix_list object +

This function retrieves a single P matrix from a gt_admix object based on the specified k value and run number.

@@ -54,7 +54,7 @@

Argumentsx -

A q_matrix_list object containing P matrices

+

A gt_admix object containing P matrices

...
@@ -71,7 +71,7 @@

Arguments

Value

-

A single P matrix from the q_matrix_list object

+

A single P matrix from the gt_admix object

diff --git a/reference/read_q_files.html b/reference/read_q_files.html new file mode 100644 index 00000000..97485f2d --- /dev/null +++ b/reference/read_q_files.html @@ -0,0 +1,87 @@ + +Read and structure .Q files or existing matrices as q_matrix or gt_admix objects. — read_q_files • tidypopgen + Skip to contents + + +
+
+
+ +
+

This function reads .Q matrix files generated by external clustering +algorithms (such as ADMIXTURE) and transforms them into gt_admix objects.

+
+ +
+

Usage

+
read_q_files(x)
+
+ +
+

Arguments

+ + +
x
+

can be:

  • a path to a directory containing .Q files

  • +
+ +
+
+

Value

+ +
  • a gt_admix object containing a list of Q matrices and a list of +indices for each Q matrix separated by K

  • +
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/summary.gt_admix.html b/reference/summary.gt_admix.html new file mode 100644 index 00000000..0bd3729f --- /dev/null +++ b/reference/summary.gt_admix.html @@ -0,0 +1,86 @@ + +Summary method for gt_admix objects — summary.gt_admix • tidypopgen + Skip to contents + + +
+
+
+ +
+

Summary method for gt_admix objects

+
+ +
+

Usage

+
# S3 method for class 'gt_admix'
+summary(object, ...)
+
+ +
+

Arguments

+ + +
object
+

a gt_admix object

+ + +
...
+

unused (necessary for compatibility with generic function)

+ +
+
+

Value

+

A summary of the gt_admix object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/search.json b/search.json index adad5505..60d2f644 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://evolecolgroup.github.io/tidypopgen/CODE_OF_CONDUCT.html","id":null,"dir":"","previous_headings":"","what":"Contributor Code of Conduct","title":"Contributor Code of Conduct","text":"contributors maintainers project, pledge respect people contribute reporting issues, posting feature requests, updating documentation, submitting pull requests patches, activities. committed making participation project harassment-free experience everyone, regardless level experience, gender, gender identity expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion. Examples unacceptable behavior participants include use sexual language imagery, derogatory comments personal attacks, trolling, public private harassment, insults, unprofessional conduct. Project maintainers right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct. Project maintainers follow Code Conduct may removed project team. Instances abusive, harassing, otherwise unacceptable behavior may reported opening issue contacting one project maintainers. Code Conduct adapted Contributor Covenant (https://www.contributor-covenant.org), version 1.0.0, available https://contributor-covenant.org/version/1/0/0/.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to tidypopgen","title":"Contributing to tidypopgen","text":"document outlines contribute development tidypopgen. package maintained voluntary basis, help always appreciated.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"the-basic-process-of-contributing","dir":"","previous_headings":"","what":"The basic process of contributing","title":"Contributing to tidypopgen","text":"Development work tidypopgen occurs dev branch. , want propose changes, work dev. Start forking project onto github repository, make changes directly fork (either dev branch, make custom branch). updating documentation checking tests pass (see ), start Pull Request. proposed changes reviewed, might asked fix/improve code. can iterative process, requiring rounds revision depending complexity code. Functions documented using roxygen. changes affects documentation , rebuild . root directory package, simply run: implemented new functionality, patched bug, consider whether add appropriate unit test. tidypopgen uses testthat framework unit tests. make sure tests work : Finally, submit push request, check changes don’t break build. can check, also builds vignette runs tests.: Make sure resolved warnings notes raised devtools::check()! followed 3 steps, ready make Pull Request. changes go automatic continuous integration, check impact changes multiple platforms. everything goes well, see green tick submission.","code":"devtools::document() devtools::test() devtools::check()"},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to tidypopgen","text":"spot typos, spelling mistakes, grammatical errors documentation, fix directly file describes function. .R file R directory, .Rd file man directory. .Rd files automatically generated roxygen2 edited hand. recommend study first roxygen2 comments work.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"functional-changes","dir":"","previous_headings":"","what":"Functional changes","title":"Contributing to tidypopgen","text":"want make change impacts functioning tidypopgen, ’s good idea first file issue explaining mind. change meant fix bug, add minimal reprex. good reprex also perfect starting point writing unit test, accompany functional change code. Unit tests also essential fixing bugs, can demonstrate fix work, prevent future changes undoing work. unit testing, use testthat; find tests tests, file dedicated function, following convention test_my_function.R naming files. creating tests, try make use built-datasets, rather adding data files package. Ideally, body Pull Request include phrase Fixes #issue-number, issue_number number Github. way, Pull Request automatically linked issue, issue closed Pull Request merged . user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html. continuous integration checks Pull Request reduce test coverage.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Functional changes","what":"Code style","title":"Contributing to tidypopgen","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. Lots commenting code helps mantainability; , doubt, always add explanation new code.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"compiling-on-mac","dir":"","previous_headings":"","what":"Compiling on Mac","title":"Contributing to tidypopgen","text":"develop Mac, need install additional software, encounter issues Clang finding correct path. information available CRAN page","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to tidypopgen","text":"Please note tidyverse project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"tidy-data-in-population-genetics","dir":"Articles","previous_headings":"","what":"tidy data in population genetics","title":"Overview","text":"fundamental tenet tidy data observation row variable column, value cell. Applying logic population genetic data means individual row, individual metadata (population, sex, phenotype, etc) variables. Genotypes locus can also thought variables, however, due large number loci restricted values genotype can take, inefficient store individual standard columns. tidypopgen, represent data gen_tbl, subclass tibble three compulsory columns: id individual (character, must unique individual), population giving population individuals belong (character), genotypes (stored compressed format File-Backed Matrix, vector tibble providing row indices matrix individual). real data reside disk, attribute bigsnp genotype column contains information access . also additional attribute , loci provides information loci, including column indices represent locus FBM. vector row indices table loci can subsetted reordered without changing data disk; thus, operation gen_tibble fast shapes indices genotype matrix rather matrix . loci tibble includes columns big_index index FBM, name locus name (character, must unique), chromosome chromosome (integer, known, otherwise set NA), position position chromosome (integer, known, otherwise set NA), genetic_dist genetic distance chromosome (numeric, known, else set 0) allele_ref reference allele (character), allele_alt alternate allele (character, can 0 monomorphic loci, following convention plink). Additional individual metadata can stored columns main gen_tbl, whilst additional loci information (position centimorgans) can added columns loci attribute table. principle, possible use use multiple ways compress genotypes. tidypopgen currently uses bigSNP object package bigsnpr. fast well documented, mostly geared towards diploid data. tidypopgen expands object deal different levels ploidy, including multiple ploidy within single dataset; however, functions currently incompatible ploidy levels 2 (return clear error message avoid computing anything incorrectly).","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"the-gen_tibble","dir":"Articles","previous_headings":"The grammar of population genetics","what":"The gen_tibble","title":"Overview","text":"Given information individuals, genotypes, loci: can create simple gen_tibble object (class gen_tbl) : provided information three files underlying genotype information stored. don’t want keep files, used tmp directory; normally want use working directory files cleared R end session. important files deleted moved, gen_tibble stores paths future use. Now let’s look gen_tibble: discussed , tibble, genotypes contains indices individuals FBM values, FBM attribute. retrieve genotypes (compressed FBM), use: want extract information loci genotypes (stored attribute column), say: Note , passing gen_tibble function works genotypes, generally necessary pass column genotypes call: However, function used within dplyr verb mutate, need pass genotype column function: , simply:","code":"library(tidypopgen) #> Loading required package: dplyr #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union #> Loading required package: tibble example_indiv_meta <- data.frame (id=c(\"a\",\"b\",\"c\",\"d\",\"e\"), population = c(\"pop1\",\"pop1\",\"pop2\",\"pop2\",\"pop2\")) example_genotypes <- rbind(c(1, 1, 0, 1, 1, 0), c(2, 0, 0, 0,NA, 0), c(1, 2, 0, 0, 1, 1), c(0, 2, 0, 1, 2, 1), c(1, 1,NA, 2, 1, 0)) example_loci <- data.frame(name=c(\"rs1\",\"rs2\",\"rs3\",\"rs4\",\"x1\",\"x2\"), chromosome=c(1,1,1,1,2,2), position=c(3,5,65,343,23,456), genetic_dist = c(0,0,0,0,0,0), allele_ref = c(\"A\",\"T\",\"C\",\"G\",\"C\",\"T\"), allele_alt = c(\"T\",\"C\", NA,\"C\",\"G\",\"A\")) example_gt <- gen_tibble(example_genotypes, indiv_meta = example_indiv_meta, loci=example_loci, backingfile = tempfile()) #> #> gen_tibble saved to /tmp/RtmpBI8D7y/file1e322a471272.gt #> using bigSNP file: /tmp/RtmpBI8D7y/file1e322a471272.rds #> with backing file: /tmp/RtmpBI8D7y/file1e322a471272.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/RtmpBI8D7y/file1e322a471272.gt') example_gt #> # A gen_tibble: 6 loci #> # A tibble: 5 × 3 #> id population genotypes #> #> 1 a pop1 1 #> 2 b pop1 2 #> 3 c pop2 3 #> 4 d pop2 4 #> 5 e pop2 5 example_gt %>% show_genotypes() #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 1 1 0 1 1 0 #> [2,] 2 0 0 0 NA 0 #> [3,] 1 2 0 0 1 1 #> [4,] 0 2 0 1 2 1 #> [5,] 1 1 NA 2 1 0 example_gt %>% show_loci() #> # A tibble: 6 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 1 rs1 1 3 0 A T 1 #> 2 2 rs2 1 5 0 T C 1 #> 3 3 rs3 1 65 0 C NA 1 #> 4 4 rs4 1 343 0 G C 1 #> 5 5 x1 2 23 0 C G 2 #> 6 6 x2 2 456 0 T A 2 example_gt %>% indiv_het_obs() #> [1] 0.6666667 0.0000000 0.5000000 0.3333333 0.6000000 example_gt %>% mutate (het_obs = indiv_het_obs(.data$genotypes)) #> # A gen_tibble: 6 loci #> # A tibble: 5 × 4 #> id population genotypes het_obs #> #> 1 a pop1 1 0.667 #> 2 b pop1 2 0 #> 3 c pop2 3 0.5 #> 4 d pop2 4 0.333 #> 5 e pop2 5 0.6 example_gt %>% mutate (het_obs = indiv_het_obs(genotypes)) #> # A gen_tibble: 6 loci #> # A tibble: 5 × 4 #> id population genotypes het_obs #> #> 1 a pop1 1 0.667 #> 2 b pop1 2 0 #> 3 c pop2 3 0.5 #> 4 d pop2 4 0.333 #> 5 e pop2 5 0.6"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"standard-dplyr-verbs-to-manipulate-the-tibble","dir":"Articles","previous_headings":"","what":"Standard dplyr verbs to manipulate the tibble","title":"Overview","text":"individual metadata can processed usual tidyverse grammar. , can filter individuals population number functions compute population genetics quantities individual, individual observed heterozygosity. can compute simply : filtering: can use mutate add observed heterozygosity column gen_tibble (, note functions work genotypes don’t need passed arguments tibble passed directly , column genotypes provided used within dplyr verbs mutate): number functions estimate quantities individual level, prefixed indiv_.","code":"example_pop1 <- example_gt %>% filter (population==\"pop2\") example_pop1 #> # A gen_tibble: 6 loci #> # A tibble: 3 × 3 #> id population genotypes #> #> 1 c pop2 3 #> 2 d pop2 4 #> 3 e pop2 5 example_gt %>% indiv_het_obs() #> [1] 0.6666667 0.0000000 0.5000000 0.3333333 0.6000000 example_gt %>% filter (population==\"pop2\") %>% indiv_het_obs() #> [1] 0.5000000 0.3333333 0.6000000 example_gt %>% mutate(het_obs = indiv_het_obs(genotypes)) #> # A gen_tibble: 6 loci #> # A tibble: 5 × 4 #> id population genotypes het_obs #> #> 1 a pop1 1 0.667 #> 2 b pop1 2 0 #> 3 c pop2 3 0.5 #> 4 d pop2 4 0.333 #> 5 e pop2 5 0.6"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"using-verbs-on-loci","dir":"Articles","previous_headings":"","what":"Using verbs on loci","title":"Overview","text":"Since genotypes loci stored compressed list one column, possible use standard dplyr verbs . However, tidypopgen provides number specialised verbs, postfixed _loci, manipulate loci. key operation loci selection (removal). compressed nature genotypes imposes constraints possible grammar. selection, two verbs: select_loci select_loci_if. select_loci understands concise-minilanguage spoken standard dplyr::select allows easily refer variables names. However, select_loci criteria can based actual genotypes (e.g. heterozygosity missingness). , use select_loci_if, can operate genotypes blind names loci. Let us start looking loci names simple dataset: can see two categories loci, one starting “rs” “x”. wanted select loci “rs” code, use: gives us gen_tibble 4 loci, expected. can confirm correct loci : Let us check indeed impacted individual heterozygosity can also subset reorder passing indices: operation helpful merging datasets fully overlap loci (later). limit select_loci can directly summarise genotypes. can separately feed result set indices. example, might want impose minimum minor allele frequency. loci_maf() allows us inspect minimum allele frequencies gen_tibble: can now create vector indices loci minimum allele frequency (MAF) larger 0.2, use select: Note passing variable directly select deprecated, use all_of wrap . select_loci_if allows us avoid creating temporary variable store indices: Note , need tidy evaluate loci_maf within select_loci_if verb, need provide column want use (even though genotypes). Also note , select_loci_if, can reorder loci. select_loci_if flexible; example, filter loci MAF greater 0.2 also chromosome 2. can use similar approach select alleles given chromosome: Incidentally, loci_maf() one several functions compute quantities locus; can identified start loci_.","code":"loci_names(example_gt) #> [1] \"rs1\" \"rs2\" \"rs3\" \"rs4\" \"x1\" \"x2\" example_sub <- example_gt %>% select_loci (starts_with(\"rs\")) example_sub #> # A gen_tibble: 4 loci #> # A tibble: 5 × 3 #> id population genotypes #> #> 1 a pop1 1 #> 2 b pop1 2 #> 3 c pop2 3 #> 4 d pop2 4 #> 5 e pop2 5 loci_names(example_sub) #> [1] \"rs1\" \"rs2\" \"rs3\" \"rs4\" example_sub %>% indiv_het_obs() #> [1] 0.5000000 0.0000000 0.1666667 0.1666667 0.4000000 example_gt %>% select_loci (c(2,6,1)) %>% show_loci() #> # A tibble: 3 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 2 rs2 1 5 0 T C 1 #> 2 6 x2 2 456 0 T A 2 #> 3 1 rs1 1 3 0 A T 1 example_gt %>% select_loci (c(2,6,1)) %>% show_genotypes() #> [,1] [,2] [,3] #> [1,] 1 0 1 #> [2,] 0 0 2 #> [3,] 2 1 1 #> [4,] 2 1 0 #> [5,] 1 0 1 example_gt %>% loci_maf() #> [1] 0.500 0.400 0.000 0.400 0.375 0.200 sel_indices <- which((example_gt %>% loci_maf())>0.2) example_gt %>% select_loci (all_of(sel_indices)) %>% show_loci() #> # A tibble: 4 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 1 rs1 1 3 0 A T 1 #> 2 2 rs2 1 5 0 T C 1 #> 3 4 rs4 1 343 0 G C 1 #> 4 5 x1 2 23 0 C G 2 example_gt_sub <- example_gt %>% select_loci_if(loci_maf(genotypes)>0.2) example_gt_sub %>% show_genotypes() #> [,1] [,2] [,3] [,4] #> [1,] 1 1 1 1 #> [2,] 2 0 0 NA #> [3,] 1 2 0 1 #> [4,] 0 2 1 2 #> [5,] 1 1 2 1 example_gt %>% select_loci_if(loci_chromosomes(genotypes)==2 & loci_maf(genotypes)>0.2) %>% show_loci() #> # A tibble: 1 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 5 x1 2 23 0 C G 2"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"grouping-individuals-in-populations","dir":"Articles","previous_headings":"","what":"Grouping individuals in populations","title":"Overview","text":"population genetics, generally interested computing quantities describe groups individuals (.e. populations). Grouping can used number ways. starting point, can group population get pop sizes: functions return one result per individual (indiv_het_obs used ), can use summarise, returns new tibble one line per population. example, can count number individuals per population, well mean heterozygosity : However, note somewhat inefficient, computing pop averages requires multiple access data. efficient approach : way, compute individual heterozygosities one go (optimising file access time), generate population summaries. functions return quantity per locus (e.g. loci_maf), can use group_by together group_map apply functions populations: details syntax group_map, see help page. functions, loci_maf(), also method grouped tibbles allows even easier syntax: reality, grouped methods nothing wrapper appropriate group_map syntax, make life little bit simpler. Certain metrics analyses naturally defined grouped tibble refer populations, distance metrics among populations. example: type functions prefixed pop.","code":"example_gt %>% group_by(population) %>% tally() #> # A tibble: 2 × 2 #> population n #> #> 1 pop1 2 #> 2 pop2 3 example_gt %>% group_by(population) %>% summarise(n= n(), mean_het = mean(indiv_het_obs(genotypes))) #> # A tibble: 2 × 3 #> population n mean_het #> #> 1 pop1 2 0.333 #> 2 pop2 3 0.478 example_gt %>% mutate(het_obs = indiv_het_obs(genotypes)) %>% group_by(population) %>% summarise(n= n(), mean_het = mean(het_obs)) #> # A tibble: 2 × 3 #> population n mean_het #> #> 1 pop1 2 0.333 #> 2 pop2 3 0.478 example_gt %>% group_by(population) %>% group_map(.f = ~loci_maf(.x)) #> [[1]] #> [1] 0.25 0.25 0.00 0.25 0.50 0.00 #> #> [[2]] #> [1] 0.3333333 0.1666667 0.0000000 0.5000000 0.3333333 0.3333333 example_gt %>% group_by(population) %>% loci_maf() #> [[1]] #> [1] 0.25 0.25 0.00 0.25 0.50 0.00 #> #> [[2]] #> [1] 0.3333333 0.1666667 0.0000000 0.5000000 0.3333333 0.3333333 # not reimplemented yet! example_gt %>% group_by(population) %>% pairwise_pop_fst() #> Whilst this function should work, it has not been extensively tested. Check your results to ensure they make sense #> # A tibble: 1 × 3 #> population_1 population_2 value #> #> 1 pop1 pop2 0.0258"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"saving-and-reading-data","dir":"Articles","previous_headings":"","what":"Saving and reading data","title":"Overview","text":"can save gen_tibble gt_save(). command save file extension .gt. Together .rds .bk files, .gt file include information stored gen_tibble. Note , whilst .rds .bk file share name, .gt file can named differently (, default, specific name given, gt_save use pattern .rds .bk file). , let us save file: ever need retrieve location .bk .rds files gen_tibble, can use: later session, reload data : can see genotypes recovered correctly. saw beginning vignette, possible create gen_tibble data data.frames tibbles. can use function wrangle small datasets custom formats, commonly SNP data stored PLINK bed files VCF files. gen_tibble can directly read types files (including gzipped vcf files), just need provide path file first argument gen_tibble; example, want read PLINK bed file, can simply use: vignette, don’t want keep files, using temporary path backing files, normal instances, can simply omit backingfile parameter, .rds .bk file saved name path original .bed file. can also export data various formats family functions gt_as_*(). functions, gt_as_hierfstat(), gt_as_genind() gt_as_genlight() return object appropriate type; functions, gt_as_plink() gt_as_geno_lea() write file appropriate format, return name file completion. example, export PLINK .bed file, simply use: also write .bim .fam file save together .bed file. Note , main tibble, id, population sex preserved .fam file. also possible write .ped .raw files specifying type=\"ped\" type=\"raw\" gt_as_plink() (see help page gt_as_plink() details).","code":"gt_file_name <- gt_save(example_gt) #> #> gen_tibble saved to /tmp/RtmpBI8D7y/file1e322a471272.gt #> using bigSNP file: /tmp/RtmpBI8D7y/file1e322a471272.rds #> with backing file: /tmp/RtmpBI8D7y/file1e322a471272.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/RtmpBI8D7y/file1e322a471272.gt') gt_file_name #> [1] \"/tmp/RtmpBI8D7y/file1e322a471272.gt\" #> [2] \"/tmp/RtmpBI8D7y/file1e322a471272.rds\" #> [3] \"/tmp/RtmpBI8D7y/file1e322a471272.bk\" gt_get_file_names(example_gt) #> [1] \"/tmp/RtmpBI8D7y/file1e322a471272.rds\" #> [2] \"/tmp/RtmpBI8D7y/file1e322a471272.bk\" new_example_gt <- gt_load(gt_file_name[1]) new_example_gt %>% show_genotypes() #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 1 1 0 1 1 0 #> [2,] 2 0 0 0 NA 0 #> [3,] 1 2 0 0 1 1 #> [4,] 0 2 0 1 2 1 #> [5,] 1 1 NA 2 1 0 bed_path_pop_a <- system.file(\"extdata/pop_a.bed\", package = \"tidypopgen\") pop_a_gt <- gen_tibble(bed_path_pop_a, backingfile = tempfile(\"pop_a_\")) #> #> gen_tibble saved to /tmp/RtmpBI8D7y/pop_a_1e3266f63279.gt #> using bigSNP file: /tmp/RtmpBI8D7y/pop_a_1e3266f63279.rds #> with backing file: /tmp/RtmpBI8D7y/pop_a_1e3266f63279.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/RtmpBI8D7y/pop_a_1e3266f63279.gt') gt_as_plink(example_gt, file = tempfile(\"new_bed_\")) #> [1] \"/tmp/RtmpBI8D7y/new_bed_1e321b01af13.bed\""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"merging-data","dir":"Articles","previous_headings":"","what":"Merging data","title":"Overview","text":"Merging data different sources common problem, especially human population genetics wealth SNP chips available. tidypopgen, merging enacted rbind operation gen_tibbles. datasets loci, merge trivial. , necessary subset loci, ensure data coded reference alternate alleles (swap needed). Additionally, data come SNP chips, added complication strand always consistent, might also necessary flip strand (case, ambiguous SNPs filtered). rbind method gen_tibbles number parameters allow us control behaviour merge. Let us start bringing two sample datasets (note use tempfiles store data; real applications, usually avoid defining backingfile let function create backing files bed file stored): inspect : one: using small datasets, real life, rbind operations demanding. performing operation, can run rbind_dry_run: Note , default, rbind flip strand remove ambiguous SNPs (relevant merging different SNP chips), need set flip_strand TRUE. report object contains details locus either kept removed, usually report sufficient make decisions whether want go ahead. happy likely outcome, can proceed rbind. Note data saved disk. can either provide path prefix, ‘.RDS’ ‘.bk’ appended bigSNP file backing file; let function save files path original backing file first object). NOTE: vignette, save temporary directory, real life want save directory able retrieve file later date!!! Let’s check resulting gen_tibble: Note values genotype column (corresponds id FBM file) changed reflect new, larger FBM datasets. can look subsetted loci (note used first population reference determine strand order alleles): , note big_index values changed compared original files, generated new FBM merged data. default, rbind using loci names match two datasets. option ‘use_position = TRUE’ forces matching chromosome position; note common source problems merging coding chromosomes (e.g. dataset ‘chromosome1’ ‘chr1’). using ‘use_position = TRUE’, also make sure two datasets aligned reference genome assembly.","code":"bed_path_pop_a <- system.file(\"extdata/pop_a.bed\", package = \"tidypopgen\") bigsnp_path_a <- bigsnpr::snp_readBed(bed_path_pop_a, backingfile = tempfile(\"pop_a_\")) pop_a_gt <- gen_tibble(bigsnp_path_a) #> #> gen_tibble saved to /tmp/RtmpBI8D7y/pop_a_1e3270779944.gt #> using bigSNP file: /tmp/RtmpBI8D7y/pop_a_1e3270779944.rds #> with backing file: /tmp/RtmpBI8D7y/pop_a_1e3270779944.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/RtmpBI8D7y/pop_a_1e3270779944.gt') bed_path_pop_b <- system.file(\"extdata/pop_b.bed\", package = \"tidypopgen\") bigsnp_path_b <- bigsnpr::snp_readBed(bed_path_pop_b, backingfile = tempfile(\"pop_b_\")) pop_b_gt <- gen_tibble(bigsnp_path_b) #> #> gen_tibble saved to /tmp/RtmpBI8D7y/pop_b_1e3249a1f0c9.gt #> using bigSNP file: /tmp/RtmpBI8D7y/pop_b_1e3249a1f0c9.rds #> with backing file: /tmp/RtmpBI8D7y/pop_b_1e3249a1f0c9.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/RtmpBI8D7y/pop_b_1e3249a1f0c9.gt') pop_a_gt #> # A gen_tibble: 16 loci #> # A tibble: 5 × 3 #> id population genotypes #> #> 1 GRC24 pop_a 1 #> 2 GRC25 pop_a 2 #> 3 GRC26 pop_a 3 #> 4 GRC27 pop_a 4 #> 5 GRC28 pop_a 5 pop_b_gt #> # A gen_tibble: 17 loci #> # A tibble: 3 × 3 #> id population genotypes #> #> 1 SL088 pop_b 1 #> 2 SL1329 pop_b 2 #> 3 SL1108 pop_b 3 report <- rbind_dry_run(pop_a_gt, pop_b_gt, flip_strand = TRUE) #> harmonising loci between two datasets #> flip_strand = TRUE ; remove_ambiguous = TRUE #> ----------------------------- #> dataset: reference #> number of SNPs: 16 reduced to 12 #> ( 2 are ambiguous, of which 2 were removed) #> ----------------------------- #> dataset: target #> number of SNPs: 17 reduced to 12 #> ( 5 were flipped to match the reference set) #> ( 2 are ambiguous, of which 2 were removed) # #create merge merged_gt <- rbind(pop_a_gt, pop_b_gt, flip_strand = TRUE, backingfile = file.path(tempdir(),\"gt_merged\")) #> harmonising loci between two datasets #> flip_strand = TRUE ; remove_ambiguous = TRUE #> ----------------------------- #> dataset: reference #> number of SNPs: 16 reduced to 12 #> ( 2 are ambiguous, of which 2 were removed) #> ----------------------------- #> dataset: target #> number of SNPs: 17 reduced to 12 #> ( 5 were flipped to match the reference set) #> ( 2 are ambiguous, of which 2 were removed) #> #> gen_tibble saved to /tmp/RtmpBI8D7y/gt_merged.gt #> using bigSNP file: /tmp/RtmpBI8D7y/gt_merged.rds #> with backing file: /tmp/RtmpBI8D7y/gt_merged.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/RtmpBI8D7y/gt_merged.gt') merged_gt #> # A gen_tibble: 12 loci #> # A tibble: 8 × 3 #> id population genotypes #> #> 1 GRC24 pop_a 1 #> 2 GRC25 pop_a 2 #> 3 GRC26 pop_a 3 #> 4 GRC27 pop_a 4 #> 5 GRC28 pop_a 5 #> 6 SL088 pop_b 6 #> 7 SL1329 pop_b 7 #> 8 SL1108 pop_b 8 merged_gt %>% show_loci() #> # A tibble: 12 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt #> #> 1 1 rs3094315 1 752566 0 A G #> 2 2 rs3131972 1 752721 0 G A #> 3 3 rs12124819 1 776546 0 A G #> 4 4 rs11240777 1 798959 0 G A #> 5 5 rs1110052 1 873558 0 G T #> 6 6 rs6657048 1 957640 0 C T #> 7 7 rs2488991 1 994391 0 T G #> 8 8 rs2862633 2 61974443 0 G A #> 9 9 rs28569024 2 139008811 0 T C #> 10 10 rs10106770 2 235832763 0 G A #> 11 11 rs11942835 3 155913651 0 T C #> 12 12 rs5945676 23 51433071 0 T G #> # ℹ 1 more variable: chr_int "},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"imputation","dir":"Articles","previous_headings":"","what":"Imputation","title":"Overview","text":"Many genetic analysis (e.g. PCA) allow missing data. many software implementations, missing gentoypes imputed fly, often simplistic manner. tidypopgen, encourage taking step explicitly, running analysis. Let us start dataset missing genotypes: can visualise amount missingness : attempt run PCA dataset, get: Note using gt_pca_autoSVD small dataset likely cause error, see manual page details. possible obviate problem filtering loci missing data, might lose lot loci. alternative impute missing data. tidypopgen provides wrappers two fast imputation approaches available bigsnpr, simple imputation (gt_impute_simple) based frequency alleles locus (random sampling, using mean mode), sophisticated approach (gt_impute_xgboost) uses boosted trees try predict likely genotype. methods fine impute missing genotypes, used sophisticated imputation (e.g. low coverage genomes). use simple approach fix dataset: can now check dataset indeed imputed: However, note gen_tibble stores raw data imputed data. Even imputation, imputed data used default: indeed, summarise missingness, still get: can manually force gen_tibble use imputed data: However, generally needed, can keep gen_tibble set use raw data: let functions need imputation use automatically: Note , function finished, gen_tibble back using raw genotypes: details PCA analysis found vignette population genetic analysis.","code":"bed_file <- system.file(\"extdata\", \"example-missing.bed\", package = \"bigsnpr\") missing_gt <- gen_tibble(bed_file, backingfile = tempfile(\"missing_\")) #> #> gen_tibble saved to /tmp/RtmpBI8D7y/missing_1e3265b836b0.gt #> using bigSNP file: /tmp/RtmpBI8D7y/missing_1e3265b836b0.rds #> with backing file: /tmp/RtmpBI8D7y/missing_1e3265b836b0.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/RtmpBI8D7y/missing_1e3265b836b0.gt') missing_gt #> # A gen_tibble: 500 loci #> # A tibble: 200 × 3 #> id population genotypes #> #> 1 ind_1 fam_1 1 #> 2 ind_2 fam_2 2 #> 3 ind_3 fam_3 3 #> 4 ind_4 fam_4 4 #> 5 ind_5 fam_5 5 #> 6 ind_6 fam_6 6 #> 7 ind_7 fam_7 7 #> 8 ind_8 fam_8 8 #> 9 ind_9 fam_9 9 #> 10 ind_10 fam_10 10 #> # ℹ 190 more rows missing_gt %>% loci_missingness() %>% hist() missing_pca <- missing_gt %>% gt_pca_autoSVD() #> Error: You can't have missing values in 'G'. missing_gt <- gt_impute_simple(missing_gt, method = \"mode\") gt_has_imputed(missing_gt) #> [1] TRUE gt_uses_imputed(missing_gt) #> [1] FALSE missing_gt %>% loci_missingness() %>% hist() gt_set_imputed(missing_gt, set = TRUE) missing_gt %>% loci_missingness() %>% hist() gt_set_imputed(missing_gt, set = FALSE) missing_gt %>% loci_missingness() %>% hist() missing_pca <- missing_gt %>% gt_pca_partialSVD() missing_pca #> === PCA of gen_tibble object === #> Method: [1] \"partialSVD\" #> #> Call ($call):gt_pca_partialSVD(x = .) #> #> Eigenvalues ($d): #> 146.859 106.219 90.352 80.983 69.332 68.427 ... #> #> Principal component scores ($u): #> matrix with 200 rows (individuals) and 10 columns (axes) #> #> Loadings (Principal axes) ($v): #> matrix with 500 rows (SNPs) and 10 columns (axes) gt_uses_imputed(missing_gt) #> [1] FALSE missing_gt %>% loci_missingness() %>% hist()"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"quality-control-for-snp-datasets","dir":"Articles","previous_headings":"","what":"Quality control for SNP datasets","title":"Quality Control","text":"tidypopgen two key functions examine quality data across loci across individuals: qc_report_loci qc_report_indiv. vignette uses simulated data set illustrate methods data cleaning.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"read-data-into-gen_tibble-format","dir":"Articles","previous_headings":"","what":"Read data into gen_tibble format","title":"Quality Control","text":"#Quality control individuals output qc_report_indiv supplies observed heterozygosity per individual, rate missingness per individual standard. data can also visualised using autoplot: can see individuals low missingness. wanted filter individuals remove 4.5% genotypes missing, can use filter. wanted remove outliers particularly high low heterozygosity, can using filter. example, remove observations lie 3 standard deviations mean. Next, can look relatedness within sample. parameter kings_threshold provided qc_report_indiv(), report also calculates KING coefficient relatedness matrix using sample. kings_threshold used provide output largest possible group related individuals third column to_keep. boolean column recommends individuals remove (FALSE) keep (TRUE) achieve unrelated sample. can remove recommended individuals using: can now view summary cleaned data set , showing data reduced 12 9 individuals.","code":"library(tidypopgen) ## Loading required package: dplyr ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union ## Loading required package: tibble data <- gen_tibble(system.file(\"extdata/related/families.bed\", package=\"tidypopgen\"), quiet = TRUE, backingfile = tempfile(), valid_alleles = c(\"1\",\"2\")) individual_report <- qc_report_indiv(data) summary(individual_report) ## het_obs missingness ## Min. :0.3467 Min. :0.03018 ## 1st Qu.:0.3736 1st Qu.:0.03642 ## Median :0.3790 Median :0.03798 ## Mean :0.3799 Mean :0.03867 ## 3rd Qu.:0.3901 3rd Qu.:0.04110 ## Max. :0.4015 Max. :0.04579 autoplot(individual_report) data <- data %>% filter(indiv_missingness(genotypes)<0.045) nrow(data) ## [1] 10 mean_val <- mean(individual_report$het_obs) sd_val <- stats::sd(individual_report$het_obs) lower <- mean_val - 3*(sd_val) upper <- mean_val + 3*(sd_val) data <- data %>% filter(indiv_het_obs(genotypes) > lower) data <- data %>% filter(indiv_het_obs(genotypes) < upper) nrow(data) ## [1] 10 individual_report <- qc_report_indiv(data, kings_threshold = 0.177) summary(individual_report) ## het_obs missingness to_keep id ## Min. :0.3467 Min. :0.03018 Mode :logical Min. : 1.00 ## 1st Qu.:0.3757 1st Qu.:0.03642 FALSE:1 1st Qu.: 4.25 ## Median :0.3790 Median :0.03746 TRUE :9 Median : 6.50 ## Mean :0.3812 Mean :0.03725 Mean : 6.60 ## 3rd Qu.:0.3957 3rd Qu.:0.04006 3rd Qu.: 9.50 ## Max. :0.4015 Max. :0.04266 Max. :12.00 data <- data %>% filter(id %in% individual_report$id & individual_report$to_keep == TRUE) summary(data) ## id genotypes ## Min. : 1 Length:9 ## 1st Qu.: 4 Class :character ## Median : 6 Mode :character ## Mean : 6 ## 3rd Qu.: 8 ## Max. :11"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"quality-control-for-loci","dir":"Articles","previous_headings":"","what":"Quality control for loci","title":"Quality Control","text":"output qc_report_loci supplies minor allele frequency, rate missingness, Hardy-Weinberg exact p-value SNP. data can visualised autoplot : Using ‘overview’ provides Upset plot, designed show intersection different sets way Venn diagram. SNPs can divided ‘sets’ pass predefined quality control threshold; set SNPs missingness given threshold, set SNPs MAF given threshold, set SNPs Hardy-Weinberg exact p-value falls given significance level. thresholds parameter, (percentage missingness accepted, minor allele frequency cutoff, Hardy-Weinberg equilibrium p-value) can adjusted using parameters provided autoplot. example: upset plot visualises 961 SNPs within respective sets. number second bar indicates 262 SNPs occur 3 sets, meaning 262 SNPs pass QC thresholds. combined total first second bars represents number SNPs pass MAF HWE thresholds, 939 SNPs. examine QC measure detail, can plot different summary panel. can begin consider quality control raw data set. Let’s start filtering SNPs according minor allele frequency. can visualise MAF distribution using: can see monomorphic SNPs data set. Let’s filter loci minor allele frequency lower 2%, using select_loci_if. , select SNPs MAF greater 2%. operation equivalent plink –maf 0.02. Following , can remove SNPs high rate missingness. Lets say want remove SNPs missing 5% individuals, equivalent using plink –geno 0.05 can see SNPs low missingness, 5% threshold, , however, missingness threshold. remove SNPs, can use select_loci_if. Finally, may want remove SNPs show significant deviation Hardy-Weinberg equilibrium, study design requires. visualise SNPs significant p-values Hardy-Weinberg exact test, can call autoplot: None SNPs data significant, however may circumstances want cut extreme cases, data real, cases indicate genotyping errors.","code":"loci_report <- qc_report_loci(data) summary(loci_report) ## snp_id maf missingness hwe_p ## Min. : 1 Min. :0.0000 Min. :0.00000 Min. :0.00144 ## 1st Qu.:241 1st Qu.:0.1667 1st Qu.:0.00000 1st Qu.:0.35500 ## Median :481 Median :0.2778 Median :0.00000 Median :0.52941 ## Mean :481 Mean :0.2682 Mean :0.03723 Mean :0.50607 ## 3rd Qu.:721 3rd Qu.:0.3889 3rd Qu.:0.11111 3rd Qu.:0.67059 ## Max. :961 Max. :0.5000 Max. :0.33333 Max. :0.76964 autoplot(loci_report, type = \"overview\") autoplot(loci_report, type = \"overview\", miss_threshold = 0.03, maf_threshold = 0.02, hwe_p = 0.01) autoplot(loci_report, type = \"all\", miss_threshold = 0.03, maf_threshold = 0.02, hwe_p = 0.01) autoplot(loci_report, type = \"maf\") data <- data %>% select_loci_if(loci_maf(genotypes)>0.02) count_loci(data) ## [1] 941 autoplot(loci_report, type = \"missing\", miss_threshold = 0.05) data <- data %>% select_loci_if(loci_missingness(genotypes)<0.05) count_loci(data) ## [1] 679 autoplot(loci_report,type = \"significant hwe\", hwe_p = 0.01) data <- data %>% select_loci_if(loci_hwe(genotypes)>0.01) count_loci(data) ## [1] 677"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"linkage-disequilibrium","dir":"Articles","previous_headings":"","what":"Linkage Disequilibrium","title":"Quality Control","text":"analyses, may necessary control linkage data set. tidypopgen provides LD clumping. option similar –indep-pairwise flag plink, results even distribution loci compared LD pruning. explore clumping preferable pruning, see https://privefl.github.io/bigsnpr/articles/pruning-vs-clumping.html LD clumping requires data set missingness. means need create imputed data set LD pruning, can quickly gt_impute_simple. example, want remove SNPs correlation greater 0.2 windows 10 SNPs time, can set parameters thr_r2 size respectively. loci_ld_clump provides boolean vector length list SNPs, telling us keep data set. can use list create pruned version data:","code":"imputed_data <- gt_impute_simple(data, method = \"random\") to_keep_LD <- loci_ld_clump(imputed_data, thr_r2 = 0.2, size = 10) head(to_keep_LD) ## [1] FALSE FALSE FALSE FALSE FALSE FALSE ld_data <- imputed_data %>% select_loci_if(loci_ld_clump(genotypes, thr_r2 = 0.2, size = 10))"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"save","dir":"Articles","previous_headings":"","what":"Save","title":"Quality Control","text":"benefit operating gen_tibble quality control step can observed visually, easily reversed necessary. happy quality data, can create save final quality controlled version gen_tibble using gt_save.","code":"gt_save(ld_data, file_name = tempfile()) ## ## gen_tibble saved to /tmp/RtmpkX48XV/file1e83178c00e1.gt ## using bigSNP file: /tmp/RtmpkX48XV/file1e83cf20541.rds ## with backing file: /tmp/RtmpkX48XV/file1e83cf20541.bk ## make sure that you do NOT delete those files! ## to reload the gen_tibble in another session, use: ## gt_load('/tmp/RtmpkX48XV/file1e83178c00e1.gt') ## [1] \"/tmp/RtmpkX48XV/file1e83178c00e1.gt\" \"/tmp/RtmpkX48XV/file1e83cf20541.rds\" ## [3] \"/tmp/RtmpkX48XV/file1e83cf20541.bk\""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"grouping-data","dir":"Articles","previous_headings":"","what":"Grouping data","title":"Quality Control","text":"quality control measures, gen_tibble includes multiple datasets may want group population running quality control. can done using group_by. First, lets add imaginary population data gen_tibble: can group population run quality control group: loci report receive calculate Hardy-Weinberg equilibrium SNP within population separately, providing Bonferroni corrected p-value SNP. Similarly, can run quality control report individuals within population: important related individuals, background population structure can affect filtering relatives.","code":"data <- data %>% mutate(population = c(rep(\"A\", 4), rep(\"B\", 5))) grouped_loci_report <- data %>% group_by(population) %>% qc_report_loci() head(grouped_loci_report) ## # A tibble: 6 × 4 ## snp_id maf missingness hwe_p ## ## 1 2 0.389 0 1 ## 2 3 0.167 0 1 ## 3 5 0.278 0 0.4 ## 4 7 0.333 0 0.333 ## 5 8 0.333 0 0.4 ## 6 10 0.444 0 0.492 grouped_individual_report <- data %>% group_by(population) %>% qc_report_indiv(kings_threshold = 0.177) head(grouped_individual_report) ## # A tibble: 6 × 4 ## het_obs missingness to_keep id ## ## 1 0.262 0 TRUE 1 ## 2 0.251 0 TRUE 2 ## 3 0.258 0 TRUE 4 ## 4 0.270 0 TRUE 5 ## 5 0.262 0 TRUE 6 ## 6 0.285 0 TRUE 7"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"grouped-functions","dir":"Articles","previous_headings":"","what":"Grouped functions","title":"Quality Control","text":"also possible run loci indiv functions grouped data. useful want run quality control group data, don’t want split data separate gen_tibbles. Grouped functions built efficiency surpass use applying function group_map.","code":"loci_maf_grouped <- data %>% group_by(population) %>% loci_maf()"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"an-example-workflow-with-real-data","dir":"Articles","previous_headings":"","what":"An example workflow with real data","title":"Example workflow with tidypopgen","text":"explore genetic structure Anolis punctatus South America, using data Prates et al 2018. downloaded vcf file genotypes “https://github.com/ivanprates/2018_Anolis_EcolEvol/blob/master/data/VCFtools_SNMF_punctatus_t70_s10_n46/punctatus_t70_s10_n46_filtered.recode.vcf?raw=true” compressed vcf.gz file. read data compressed vcf : Now let’s inspect gen_tibble: can see 46 individuals, 3249 loci. Note don’t information population vcf. information can found another file github repository (“https://github.com/ivanprates/2018_Anolis_EcolEvol/raw/master/data/plot_order_punctatus_n46.csv). add population information manually. Let’s start reading file: ids VCF different format ones just got pop csv. need bit string wrangling, looks easy, just need remove “punc_”: Let us simplify ids, “punc_” prefix Now can bring pop information:","code":"library(tidypopgen) #> Loading required package: dplyr #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union #> Loading required package: tibble vcf_path <- system.file(\"/extdata/anolis/punctatus_t70_s10_n46_filtered.recode.vcf.gz\", package = \"tidypopgen\") anole_gt <- gen_tibble(vcf_path, quiet = TRUE, backingfile = tempfile(\"anolis_\")) anole_gt #> # A gen_tibble: 3249 loci #> # A tibble: 46 × 2 #> id genotypes #> #> 1 punc_BM288 1 #> 2 punc_GN71 2 #> 3 punc_H1907 3 #> 4 punc_H1911 4 #> 5 punc_H2546 5 #> 6 punc_IBSPCRIB0361 6 #> 7 punc_ICST764 7 #> 8 punc_JFT459 8 #> 9 punc_JFT773 9 #> 10 punc_LG1299 10 #> # ℹ 36 more rows pops_path <- system.file(\"/extdata/anolis/plot_order_punctatus_n46.csv\", package = \"tidypopgen\") pops <- readr::read_csv(pops_path) #> Rows: 46 Columns: 3 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \",\" #> chr (2): ID, pop #> dbl (1): plot_order #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. pops #> # A tibble: 46 × 3 #> ID plot_order pop #> #> 1 BM288 18 Eam #> 2 GN71 21 Eam #> 3 H1907 6 Wam #> 4 H1911 4 Wam #> 5 H2546 7 Wam #> 6 IBSPCRIB0361 34 AF #> 7 ICST764 31 AF #> 8 JFT459 37 AF #> 9 JFT773 38 AF #> 10 LG1299 44 AF #> # ℹ 36 more rows anole_gt <- anole_gt %>% mutate(id = gsub('punc_',\"\",.data$id,)) anole_gt #> # A gen_tibble: 3249 loci #> # A tibble: 46 × 2 #> id genotypes #> #> 1 BM288 1 #> 2 GN71 2 #> 3 H1907 3 #> 4 H1911 4 #> 5 H2546 5 #> 6 IBSPCRIB0361 6 #> 7 ICST764 7 #> 8 JFT459 8 #> 9 JFT773 9 #> 10 LG1299 10 #> # ℹ 36 more rows anole_gt <- anole_gt %>% mutate(population = pops$pop[match(pops$ID,.data$id)]) anole_gt #> # A gen_tibble: 3249 loci #> # A tibble: 46 × 3 #> id genotypes population #> #> 1 BM288 1 Eam #> 2 GN71 2 Eam #> 3 H1907 3 Wam #> 4 H1911 4 Wam #> 5 H2546 5 Wam #> 6 IBSPCRIB0361 6 AF #> 7 ICST764 7 AF #> 8 JFT459 8 AF #> 9 JFT773 9 AF #> 10 LG1299 10 AF #> # ℹ 36 more rows"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"pca","dir":"Articles","previous_headings":"","what":"PCA","title":"Example workflow with tidypopgen","text":"easy. loci already filtered cleaned, don’t need QC. Let us jump straight analysis run PCA: OK, jumped quickly. missing data, need first impute : now: Let us look object: print function (implicitly called type name object) gives us information important elements object (names elements stored). can extract elements tidy function, returns tibble can easily used analysis, e.g.: can return information eigenvalues, scores loadings pca. also autoplot method allows visualise elements (type screeplot eigenvalues, type scores scores, loadings loadings: plot sample principal coordinates space, can simply use: autoplots deliberately kept simple: just way quickly inspect results. generate ggplot2 objects, can embellished usual ggplot2 grammar: complex/publication ready plots, want add PC scores tibble, can create custom plot ggplot2. can easily add data augment method: now can use ggplot2 directly generate plot: can see three population separate nicely PCA, just one individual Wam sitting -Wam individuals Eam. also possible inspect loci contribute given component: using information loci table, easily embellish plot, example colouring chromosome maf. complex plots, can augment loci table loadings using augment_loci():","code":"anole_pca <- anole_gt %>% gt_pca_partialSVD(k=30) #> Error: You can't have missing values in 'X'. anole_gt <- gt_impute_simple(anole_gt, method = \"mode\") anole_pca <- anole_gt %>% gt_pca_partialSVD(k=30) anole_pca #> === PCA of gen_tibble object === #> Method: [1] \"partialSVD\" #> #> Call ($call):gt_pca_partialSVD(x = ., k = 30) #> #> Eigenvalues ($d): #> 351.891 192.527 113.562 104.427 87.615 83.476 ... #> #> Principal component scores ($u): #> matrix with 46 rows (individuals) and 30 columns (axes) #> #> Loadings (Principal axes) ($v): #> matrix with 3249 rows (SNPs) and 30 columns (axes) tidy(anole_pca, matrix=\"eigenvalues\") #> # A tibble: 30 × 3 #> PC std.dev cumulative #> #> 1 1 51.9 51.9 #> 2 2 28.4 80.3 #> 3 3 16.7 97.0 #> 4 4 15.4 112. #> 5 5 12.9 125. #> 6 6 12.3 138. #> 7 7 10.2 148. #> 8 8 9.92 158. #> 9 9 9.13 167. #> 10 10 8.80 176. #> # ℹ 20 more rows autoplot(anole_pca, type=\"screeplot\") autoplot(anole_pca, type =\"scores\") library(ggplot2) autoplot(anole_pca, type = \"scores\") + aes(color = anole_gt$population) + labs(color = \"population\") anole_gt <- augment(anole_pca , data = anole_gt) anole_gt %>% ggplot(aes(.fittedPC1, .fittedPC2, color = population)) + geom_point() autoplot(anole_pca, type = \"loadings\") anole_gt_load <- augment_loci(anole_pca, data= anole_gt)"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"explore-population-structure-with-dapc","dir":"Articles","previous_headings":"","what":"Explore population structure with DAPC","title":"Example workflow with tidypopgen","text":"DAPC powerful tool investigate population structure. advantage scaling well large datasets. assumptions STRUCTURE ADMIXTURE (also limits power). first step determine number genetic clusters dataset. DAPC can either used test -priori hypothesis, can use data suggest number clusters. case, strong expectations structure study system, let data inform number possible genetic clusters. use k-clustering algorithm applied principal components (allowing us reduce dimensions thousands loci just tens components). need decide many components use; decision often made based plot cumulative explained variance components. Using tidy gt_pca object allows us easily obtain quantities, trivial plot : Note , working truncated SVD algorithm PCA, can easily phrase eigenvalues terms proportion total variance, cumulative y axis simply shows cumulative sum eigenvalues. Ideally, looking point curve starts flattening. case, can see clear flattening, PC 10 increase explained variance markedly decelerated. can now find clusters based 10 PCs: define k values explore, default 1 5 used (can change setting k parameter change range). choose appropriate k, plot number clusters measure fit. BIC shown good metric many scenarios: looking minimum value BIC. clear elbow (minimum BIC increases increasing k). However, notice quick levelling decrease BIC 3 clusters. Arguably, sufficient capture main structure (makes sense given saw PCA). can also use number algorithmic approaches (based original find.clusters() function adegenet) choose best k value plot gt_cluster_pca_best_k(). use defaults (BIC “diffNgroup”, see help page gt_cluster_pca_best_k() description various options): algorithm confirms choice. Note function simply adds element $best_k gt_cluster_pca object: decided wanted explore different value, simply overwrite number anole_clusters$best_k<-5 case, happy option 3 clusters, can run DAPC: Note gt_dapc() takes automatically number clusters anole_clusters object, can change behaviour setting parameters (see help page gt_dapc()). print object, given information important elements object find (saw gt_pca): , elements can obtained tidiers (matrix equal eigenvalues, scores,ld_loadings loci_loadings): can visualised autoplot: pca, tidy method can used extract information gt_dapc objects. example, want create bar plot eigenvalues (since two), simply use: can plot scores : can inspect assignment DAPC autoplot using type components, ordering samples original population labels: clear separation observed plotting LD scores, individual modelled mixture: assignments 100% probability single cluster. Finally, can explore loci biggest impact separating clusters (either drift selection): strong outlier, suggesting drift across many loci created signal picked DAPC. Note anole_dapc class gt_dapc, subclass dapc adegenet. means functions written work dapc objects work box (exception adegenet::predict.dapc, work underlying pca object different). example, can obtain standard dapc plot :","code":"library(ggplot2) tidy(anole_pca,matrix=\"eigenvalues\") %>% ggplot(mapping =aes(x=PC, y=cumulative)) + geom_point() anole_clusters <- gt_cluster_pca(anole_pca, n_pca = 10) autoplot(anole_clusters) anole_clusters <- gt_cluster_pca_best_k(anole_clusters) #> Using BIC with criterion diffNgroup: 3 clusters anole_clusters$best_k #> [1] 3 anole_dapc <- gt_dapc(anole_clusters) anole_dapc #> === DAPC of gen_tibble object === #> Call ($call):gt_dapc(x = anole_clusters) #> #> Eigenvalues ($eig): #> 727.414 218.045 #> #> LD scores ($ind.coord): #> matrix with 46 rows (individuals) and 2 columns (LD axes) #> #> Loadings by PC ($loadings): #> matrix with 2 rows (PC axes) and 2 columns (LD axes) #> #> Loadings by locus($var.load): #> matrix with 3249 rows (loci) and 2 columns (LD axes) tidy(anole_dapc, matrix=\"eigenvalues\") #> # A tibble: 2 × 3 #> LD eigenvalue cumulative #> #> 1 1 727. 727. #> 2 2 218. 945. autoplot(anole_dapc, type=\"screeplot\") tidy(anole_dapc, matrix=\"eigenvalues\") %>% ggplot(aes(x=LD,y=eigenvalue)) + geom_col() autoplot(anole_dapc, type=\"scores\") autoplot(anole_dapc, type=\"components\", group = anole_gt$population) autoplot(anole_dapc, \"loadings\") library(adegenet) #> Loading required package: ade4 #> #> /// adegenet 2.1.10 is loaded //////////// #> #> > overview: '?adegenet' #> > tutorials/doc/questions: 'adegenetWeb()' #> > bug reports/feature requests: adegenetIssues() scatter(anole_dapc, posi.da=\"bottomright\")"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"clustering-with-snmf","dir":"Articles","previous_headings":"","what":"Clustering with sNMF","title":"Example workflow with tidypopgen","text":"sNMF fast clustering algorithm provides results similar STRUCTURE ADMIXTURE. can run directly R. first generate file genotype data: Note .geno file placed default directory using name backing file gen_tibble Now can run K clusters k=1 k=10. use just one repeat, ideally run multiple repetitions K: can examine suitability K values plotting : can see K = 3 sensible choice, 3 represents ‘elbow’ plot. can select fastest run using: plot clusters, can begin extracting Q matrix snmf object, covert q_matrix object used tidypopgen: can quickly plot can tidy q matrix tibble, returning format suitable plotting: complex plots, can add clusters tibble, can create custom plot ggplot2. can easily add data augment method: now can use ggplot2 directly generate plot:","code":"geno_file <- gt_as_geno_lea(anole_gt) geno_file #> [1] \"/tmp/RtmpPvAlXU/anolis_1ece3d9bd99d.geno\" library(LEA) anole_snmf <- snmf(input.file = geno_file, K = 1:10, entropy = TRUE, repetitions = 3, alpha = 100 ) plot(anole_snmf, cex = 1.2, pch = 19) ce <- cross.entropy(anole_snmf, K = 3) quick_run <- which.min(ce) q_mat <- LEA::Q(anole_snmf, K = 3, run = quick_run) q_mat <- q_matrix(q_mat) head(q_mat) #> .Q1 .Q2 .Q3 #> [1,] 9.999e-05 9.999e-05 9.998e-01 #> [2,] 9.999e-05 9.999e-05 9.998e-01 #> [3,] 9.998e-01 9.999e-05 9.999e-05 #> [4,] 9.998e-01 9.999e-05 9.999e-05 #> [5,] 9.998e-01 9.999e-05 9.999e-05 #> [6,] 9.999e-05 9.998e-01 9.999e-05 anole_gt <- anole_gt %>% group_by(population) autoplot(q_mat, data = anole_gt, annotate_group = TRUE) tidy_q <- tidy(q_mat, anole_gt) head(tidy_q) #> # A tibble: 6 × 5 #> .Q1 .Q2 .Q3 id group #> #> 1 9.999e-05 9.999e-05 9.998e-01 BM288 Eam #> 2 9.999e-05 9.999e-05 9.998e-01 GN71 Eam #> 3 9.998e-01 9.999e-05 9.999e-05 H1907 Wam #> 4 9.998e-01 9.999e-05 9.999e-05 H1911 Wam #> 5 9.998e-01 9.999e-05 9.999e-05 H2546 Wam #> 6 9.999e-05 9.998e-01 9.999e-05 IBSPCRIB0361 AF anole_gt_sNMF <- augment(q_mat, data = anole_gt) anole_gt_sNMF <- anole_gt_sNMF %>% tidyr::pivot_longer(cols = dplyr::starts_with(\".Q\"), names_to = \"q\", values_to = \"percentage\") %>% dplyr::mutate(percentage = as.numeric(percentage)) %>% dplyr::group_by(id) %>% dplyr::mutate(dominant_q = max(percentage)) %>% dplyr::ungroup() %>% dplyr::arrange(population, dplyr::desc(dominant_q)) %>% dplyr::mutate(plot_order = dplyr::row_number(), id = factor(id, levels = unique(id))) plt <- ggplot2::ggplot(anole_gt_sNMF, ggplot2::aes(x = id, y = percentage, fill = q)) + ggplot2::geom_col(width = 1, position = ggplot2::position_stack(reverse = TRUE))+ ggplot2::labs(y = \"Population Structure for K = 3\") + theme_distruct() + scale_fill_distruct() plt"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"admixture-and-handling-multiple-q-matrices","dir":"Articles","previous_headings":"","what":"ADMIXTURE and handling multiple Q matrices","title":"Example workflow with tidypopgen","text":"Usually, clustering algorithms run multiple times different values K. function q_matrix() can take path directory containing results multiple runs clustering algorithm (ADMIXTURE), read .Q files, summarise single q_matrix_list object. analysis , snmf(), ran 3 repetitions value K. exemplify q_matrix() can read directly output folders, can write outputs temporary file: read back q_matrix_list: q_matrix read summarised .Q files analysis,can access single matrix list selecting run number K value interest. example, like view second run K = 3: Similarly , can autoplot matrices selecting q_matrix_list: way, tidypopgen integrates external clustering software (ADMIXTURE STRUCTURE) seamlessly quick, easy plotting.","code":"runs <- c(1:3) k_values <- c(1:10) q_matrices <- list() dir <- tempdir() for(x in k_values){ q_matrices[[x]] <- list() for(i in runs){ q_matrices[[x]][[i]] <- LEA::Q(anole_snmf, K = x, run = i) write.table(q_matrices[[x]][[i]], file = paste0(dir,\"/K\",x,\"run\",i,\".Q\"), col.names = FALSE, row.names = FALSE, quote = FALSE) } } q_list <- q_matrix(dir) summary(q_list) #> K Repeats #> 1 1 3 #> 2 2 3 #> 3 3 3 #> 4 4 3 #> 5 5 3 #> 6 6 3 #> 7 7 3 #> 8 8 3 #> 9 9 3 #> 10 10 3 get_q_matrix(q_list, k = 3, run = 2) #> .Q1 .Q2 .Q3 #> [1,] 0.000099990 0.000099990 0.99980000 #> [2,] 0.000099990 0.000099990 0.99980000 #> [3,] 0.999800000 0.000099990 0.00009999 #> [4,] 0.999800000 0.000099990 0.00009999 #> [5,] 0.999800000 0.000099990 0.00009999 #> [6,] 0.000099990 0.999800000 0.00009999 #> [7,] 0.000099990 0.801337000 0.19856300 #> [8,] 0.000099990 0.999800000 0.00009999 #> [9,] 0.000099990 0.999800000 0.00009999 #> [10,] 0.000099990 0.999800000 0.00009999 #> [11,] 0.559491000 0.181639000 0.25887000 #> [12,] 0.811919000 0.034168200 0.15391300 #> [13,] 0.234834000 0.000099991 0.76506600 #> [14,] 0.999800000 0.000099990 0.00009999 #> [15,] 0.000099990 0.000099990 0.99980000 #> [16,] 0.999800000 0.000099990 0.00009999 #> [17,] 0.000099990 0.000099990 0.99980000 #> [18,] 0.999800000 0.000099990 0.00009999 #> [19,] 0.030865000 0.214975000 0.75416000 #> [20,] 0.000099990 0.000099990 0.99980000 #> [21,] 0.016124800 0.392110000 0.59176500 #> [22,] 0.000099990 0.000099990 0.99980000 #> [23,] 0.000099990 0.000099990 0.99980000 #> [24,] 0.000099990 0.000099990 0.99980000 #> [25,] 0.000099990 0.999800000 0.00009999 #> [26,] 0.000099990 0.999800000 0.00009999 #> [27,] 0.000099990 0.999800000 0.00009999 #> [28,] 0.000099990 0.999800000 0.00009999 #> [29,] 0.000099990 0.999800000 0.00009999 #> [30,] 0.999800000 0.000099990 0.00009999 #> [31,] 0.000099991 0.036791300 0.96310900 #> [32,] 0.073108700 0.135951000 0.79094000 #> [33,] 0.000099990 0.999800000 0.00009999 #> [34,] 0.999800000 0.000099990 0.00009999 #> [35,] 0.000099991 0.030821400 0.96907900 #> [36,] 0.206381000 0.000099991 0.79351900 #> [37,] 0.254406000 0.000099991 0.74549400 #> [38,] 0.000099990 0.999800000 0.00009999 #> [39,] 0.000099990 0.999800000 0.00009999 #> [40,] 0.000099991 0.033945100 0.96595500 #> [41,] 0.000099991 0.342076000 0.65782400 #> [42,] 0.000099990 0.999800000 0.00009999 #> [43,] 0.000099990 0.999800000 0.00009999 #> [44,] 0.000099991 0.806520000 0.19338000 #> [45,] 0.850262000 0.027241300 0.12249600 #> [46,] 0.999800000 0.000099990 0.00009999 #> attr(,\"class\") #> [1] \"q_matrix\" \"matrix\" \"array\" autoplot(get_q_matrix(q_list, k = 3, run = 2), data = anole_gt)"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"file-management-and-reading-data","dir":"Articles","previous_headings":"","what":"File management and reading data:","title":"PLINK cheatsheet","text":"PLINK flags –update-alleles, –allele1234, –alleleACGT, alter coding alleles. tidypopgen, valid alleles supplied reading gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"quality-control","dir":"Articles","previous_headings":"","what":"Quality control:","title":"PLINK cheatsheet","text":"filter variants tidypopgen, similar way PLINK flags –extract –autosome, necessary use gen_tibble select_loci_if(). example: select autosomal loci way –autosome. alternatively: select loci previously defined set way –extract. Similarly, filter individuals, might performed –keep PLINK, requires using filter:","code":"data %>% select_loci_if(loci_chromosomes(genotypes) %in% c(1:22)) #> # A gen_tibble: 15 loci #> # A tibble: 5 × 3 #> id population genotypes #> #> 1 GRC24 pop_a 1 #> 2 GRC25 pop_a 2 #> 3 GRC26 pop_a 3 #> 4 GRC27 pop_a 4 #> 5 GRC28 pop_a 5 my_snps <- c(\"rs4477212\",\"rs3094315\",\"rs3131972\",\"rs12124819\",\"rs11240777\") data %>% select_loci_if(loci_names(genotypes) %in% my_snps) %>% show_loci() #> # A tibble: 5 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 1 rs44… 1 82154 0 A NA 1 #> 2 2 rs30… 1 752566 0 A G 1 #> 3 3 rs31… 1 752721 0 G A 1 #> 4 4 rs12… 1 776546 0 A NA 1 #> 5 5 rs11… 1 798959 0 G A 1 my_individuals <- c(\"GRC14300079\", \"GRC14300142\", \"GRC14300159\") data %>% filter(id %in% my_individuals) #> # A gen_tibble: 16 loci #> # A tibble: 0 × 3 #> # ℹ 3 variables: id , population , genotypes "},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"quality-control-for-linkage","dir":"Articles","previous_headings":"","what":"Quality control for linkage","title":"PLINK cheatsheet","text":"Linkage managed clumping tidypopgen loci_ld_clump(). option similar –indep-pairwise flag PLINK, results even distribution loci compared LD pruning. explore clumping preferable pruning, see https://privefl.github.io/bigsnpr/articles/pruning-vs-clumping.html","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"quality-control-for-relatedness-king","dir":"Articles","previous_headings":"","what":"Quality control for relatedness (KING)","title":"PLINK cheatsheet","text":"pairwise_king() implements KING-robust estimator kinship equivalent –kinship KING. remove related individuals, instead using –unrelated –degree, user can pass resulting kinship matrix relatedness threshold filter_high_relatedness, return largest possible set unrelated individuals.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"merging-datasets","dir":"Articles","previous_headings":"","what":"Merging datasets:","title":"PLINK cheatsheet","text":"PLINK, data merging can fail due strand inconsistencies addressed prior merging. PLINK documentation suggests users try ‘trial flip’ data address , ‘unflip’ errors remain. tidypopgen, data merged rbind, strand inconsistencies identified automatically flipped, avoiding multiple rounds flipping merging. PLINK allow users identify inconsistencies prior merging –flip-scan, functionality included tidypopgen rbind_dry_run(). rbind_dry_run() reports numeric overlap datasets, alongside number SNPs ‘flip’ new target dataset, well number ambiguous SNPs. Data merged one set time, equivalent –merge-list.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Evie Carter. Author. Andrea Manica. Author, maintainer.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Carter E, Manica (2024). tidypopgen: Tidy Population Genetics. R package version 0.0.0.9020, https://evolecolgroup.github.io/tidypopgen.","code":"@Manual{, title = {tidypopgen: Tidy Population Genetics}, author = {Evie Carter and Andrea Manica}, year = {2024}, note = {R package version 0.0.0.9020}, url = {https://evolecolgroup.github.io/tidypopgen}, }"},{"path":"https://evolecolgroup.github.io/tidypopgen/index.html","id":"tidypopgen-","dir":"","previous_headings":"","what":"Tidy Population Genetics","title":"Tidy Population Genetics","text":"goal tidypopgen provide tidy grammar population genetics, facilitating manipulation analysis genetic data. Currently, focussed biallelic single nucleotide polymorphisms (SNPs). making available preview version package. Everything work, vigilant functions tested extensively. Also, syntax functions still slightly flux, names order parameters might change. Make sure don’t rely position giving multiple parameters function, change trigger informative error code allow update.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Tidy Population Genetics","text":"can install latest version tidypopgen directly r-universe (reccomended): Alternatively, can install tidypopgenusing devtools (might need set development environment, can bit complex):","code":"install.packages('tidypopgen', repos = \"https://evolecolgroup.r-universe.dev\") install.packages(\"devtools\") devtools::install_github(\"EvolEcolGroup/tidypopgen\")"},{"path":"https://evolecolgroup.github.io/tidypopgen/index.html","id":"examples","dir":"","previous_headings":"","what":"Examples","title":"Tidy Population Genetics","text":"several vignettes designed teach use tidypopgen. ‘overview’ vignette explains data structures designed, provides illustration grammar used manipulate individuals loci. ‘example workflow’ vignette provides fully annotated example run population genetics analysis tidypopgen. ‘quality control’ vignette illustrates tidypopgen functions help running fully QC dataset analysis. Finally, provide ‘PLINK cheatsheet’ aimed translating common tasks performed PLINK tidypopgen commands.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/index.html","id":"when-something-does-not-work","dir":"","previous_headings":"","what":"When something does not work","title":"Tidy Population Genetics","text":"preview version tidypopgen. Everything work, elements extensively tested. something work, check issues GitHub see whether problem already reported. , feel free create new issue. Please make sure updated latest version tidypopgen Github, well updating packages system, provide reproducible example developers investigate problem. Ideally, try create minimalistic dataset reproduces error, much easier (thus faster!) developers track problem.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/annotate_group_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","title":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","text":"Add vertical lines separate individuals different populations, add optional x labels names","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/annotate_group_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","text":"","code":"annotate_group_info(q_tbl)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/annotate_group_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","text":"q_tbl tidied q_matrix block, adjacent ","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/annotate_group_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","text":"modifier ggplot, added usual '+'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/as_q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a standard matrix to a q_matrix object — as_q_matrix","title":"Convert a standard matrix to a q_matrix object — as_q_matrix","text":"Takes single Q matrix exists either matrix data frame returns q_matrix object.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/as_q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a standard matrix to a q_matrix object — as_q_matrix","text":"","code":"as_q_matrix(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/as_q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a standard matrix to a q_matrix object — as_q_matrix","text":"x matrix data frame","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/as_q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a standard matrix to a q_matrix object — as_q_matrix","text":"q_matrix object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment.gt_dapc.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment data with information from a gt_dapc object — augment.gt_dapc","title":"Augment data with information from a gt_dapc object — augment.gt_dapc","text":"Augment gt_dapc accepts model object dataset adds scores observation dataset. Scores component stored separate column, given name pattern \".fittedLD1\", \".fittedLD2\", etc. consistency broom::augment.prcomp, column \".rownames\" also returned; copy 'id', ensures scripts written data augmented broom::augment.prcomp work box (especially helpful adapting plotting scripts).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment.gt_dapc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment data with information from a gt_dapc object — augment.gt_dapc","text":"","code":"# S3 method for class 'gt_dapc' augment(x, data = NULL, k = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment.gt_dapc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment data with information from a gt_dapc object — augment.gt_dapc","text":"x gt_dapc object returned gt_dapc(). data gen_tibble used run PCA. k number components add ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment.gt_dapc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment data with information from a gt_dapc object — augment.gt_dapc","text":" gen_tibble containing original data along additional columns containing observation's projection PCA space.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment data with information from a gt_pca object — augment_gt_pca","title":"Augment data with information from a gt_pca object — augment_gt_pca","text":"Augment gt_pca accepts model object dataset adds scores observation dataset. Scores component stored separate column, given name pattern \".fittedPC1\", \".fittedPC2\", etc. consistency broom::augment.prcomp, column \".rownames\" also returned; copy 'id', ensures scripts written data augmented broom::augment.prcomp work box (especially helpful adapting plotting scripts).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment data with information from a gt_pca object — augment_gt_pca","text":"","code":"# S3 method for class 'gt_pca' augment(x, data = NULL, k = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment data with information from a gt_pca object — augment_gt_pca","text":"x gt_pca object returned one gt_pca_* functions. data gen_tibble used run PCA. k number components add ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment data with information from a gt_pca object — augment_gt_pca","text":" gen_tibble containing original data along additional columns containing observation's projection PCA space.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment the loci table with information from a analysis object — augment_loci","title":"Augment the loci table with information from a analysis object — augment_loci","text":"augment_loci add columns loci table gen_tibble related information given analysis.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment the loci table with information from a analysis object — augment_loci","text":"","code":"augment_loci(x, data, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment the loci table with information from a analysis object — augment_loci","text":"x object returned one gt_ functions (e.g. gt_pca()). data gen_tibble used run PCA. ... Additional parameters passed individual methods.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment the loci table with information from a analysis object — augment_loci","text":"gen_tibble additional columns added loci tibble (accessible show_loci(). data missing, tibble information, column .rownames giving loci names.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","title":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","text":"Augment gt_pca accepts model object gen_tibble adds loadings locus loci table. Loadings component stored separate column, given name pattern \".loadingPC1\", \".loadingPC2\", etc. data missing, tibble loadings returned.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","text":"","code":"# S3 method for class 'gt_pca' augment_loci(x, data = NULL, k = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","text":"x gt_pca object returned one gt_pca_* functions. data gen_tibble used run PCA. k number components add ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","text":"gen_tibble loadings added loci tibble (accessible show_loci(). data missing, tibble loadings.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment data with information from a q_matrix object — augment_q_matrix","title":"Augment data with information from a q_matrix object — augment_q_matrix","text":"Augment q_matrix accepts model object dataset adds Q values observation dataset. Q values stored separate columns, given name pattern \".Q1\",\".Q2\", etc. consistency broom::augment.prcomp, column \".rownames\" also returned; copy 'id', ensures scripts written data augmented broom::augment.prcomp work box (especially helpful adapting plotting scripts).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment data with information from a q_matrix object — augment_q_matrix","text":"","code":"# S3 method for class 'q_matrix' augment(x, data = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment data with information from a q_matrix object — augment_q_matrix","text":"x q_matrix object data gen_tibble used run clustering algorithm ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment data with information from a q_matrix object — augment_q_matrix","text":" gen_tibble containing original data along additional columns containing observation's Q values.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for q_matrix objects — autoplot.q_matrix","title":"Autoplots for q_matrix objects — autoplot.q_matrix","text":"Autoplots q_matrix objects","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for q_matrix objects — autoplot.q_matrix","text":"","code":"# S3 method for class 'q_matrix' autoplot(object, data = NULL, annotate_group = TRUE, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for q_matrix objects — autoplot.q_matrix","text":"object Q matrix object (returned q_matrix()). data associated tibble (e.g. gen_tibble), individuals order data used generate Q matrix annotate_group Boolean determining whether annotate plot group information ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for q_matrix objects — autoplot.q_matrix","text":"barplot individuals, coloured ancestry proportion","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"qc_report_indiv, following types plots available: scatter: plot missingness observed heterozygosity within individuals. relatedness: histogram paired kinship coefficients","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"","code":"# S3 method for class 'qc_report_indiv' autoplot( object, type = c(\"scatter\", \"relatedness\"), miss_threshold = NULL, kings_threshold = kings_threshold, ... )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"object object class qc_report_indiv type type plot (scatter,relatedness) miss_threshold threshold accepted rate missingness within individuals kings_threshold optional numeric, threshold relatedness sample ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"qc_report_loci, following types plots available: overview: UpSet plot, giving counts snps threshold missingness, minor allele frequency, Hardy-Weinberg equilibrium P-value, visualising interaction : four panel plot, containing missing high maf, missing low maf, hwe, significant hwe plots missing: histogram proportion missing data missing low maf: histogram proportion missing data snps low minor allele freqency missing high maf:histogram proportion missing data snps high minor allele freqency maf: histogram minor allele frequency hwe: histogram HWE exact test p-values significant hwe: histogram significant HWE exact test p-values","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"","code":"# S3 method for class 'qc_report_loci' autoplot( object, type = c(\"overview\", \"all\", \"missing\", \"missing low maf\", \"missing high maf\", \"maf\", \"hwe\", \"significant hwe\"), maf_threshold = NULL, miss_threshold = NULL, hwe_p = NULL, ... )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"object object class qc_report_loci type type plot (one overview, , missing, missing low maf, missing high maf, maf, hwe, significant hwe) maf_threshold threshold accepted rate minor allele frequency loci miss_threshold threshold accepted rate missingness per loci hwe_p threshold significance Hardy-Weinberg exact p-values ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"gt_cluster_pca, autoplot produces plot metric choice ('BIC', 'AIC' 'WSS') number clusters (k). plot can used infer best value k, corresponds smallest value metric (minimum 'elbow' shaped curve). cases, 'elbow' metric keeps decreasing increasing k; cases, customary choose value k decrease metric reaches plateau. programmatic way choosing k, use gt_cluster_pca_best_k().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"","code":"# S3 method for class 'gt_cluster_pca' autoplot(object, metric = c(\"BIC\", \"AIC\", \"WSS\"), ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"object object class gt_dapc metric metric plot y axies, one 'BIC', 'AIC', 'WSS' (sum squares) ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for gt_dapc objects — autoplot.gt_dapc","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"gt_dapc, following types plots available: screeplot: plot eigenvalues discriminant axes scores scatterplot scores individual two discriminant axes (defined ld) loadings plot loadings loci discriminant axis (chosen ld) components bar plot showing probability assignment cluster","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"","code":"# S3 method for class 'gt_dapc' autoplot( object, type = c(\"screeplot\", \"scores\", \"loadings\", \"components\"), ld = NULL, group = NULL, n_col = 1, ... )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"object object class gt_dapc type type plot (one \"screeplot\", \"scores\" \"loadings\") ld principal components plotted: scores, pair values e.g. c(1,2); loadings either one values. group vector group memberships order individuals \"components\" plot. NULL, clusters used DAPC used. n_col loadings plots, multiple LD axis plotted, many columns used. ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for gt_pca objects — autoplot_gt_pca","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"gt_pca, following types plots available: screeplot: plot eigenvalues principal components (currently plots singular value) scores scatterplot scores individual two principal components (defined pc) loadings plot loadings loci given component (chosen pc)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"","code":"# S3 method for class 'gt_pca' autoplot(object, type = c(\"screeplot\", \"scores\", \"loadings\"), k = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"object object class gt_pca type type plot (one \"screeplot\", \"scores\" \"loadings\") k principal components plotted: scores, pair values e.g. c(1,2); loadings either one values. ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"gt_pcadapt, following types plots available: qq: qunatile-quantile plot p-values pcadapt (wrapping bigsnpr::snp_qq()) manhattan manhattan plot p-values pcadapt (wrapping bigsnpr::snp_manhattan())","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"","code":"# S3 method for class 'gt_pcadapt' autoplot(object, type = c(\"qq\", \"manhattan\"), ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"object object class gt_pcadapt type type plot (one \"qq\", \"mnahattan\") ... arguments passed bigsnpr::snp_qq() bigsnpr::snp_manhattan().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/cast_list_to_q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Creates a structured list of Q matrices and their K indices — cast_list_to_q_matrix","title":"Creates a structured list of Q matrices and their K indices — cast_list_to_q_matrix","text":"function takes two q_matrix objects flat list format returns structured list q_matrix_list first element k_indices contains index number Q matrix grouped K, second element q_matrices contains Q matrices .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/cast_list_to_q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Creates a structured list of Q matrices and their K indices — cast_list_to_q_matrix","text":"","code":"cast_list_to_q_matrix(matrix_list)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/cast_list_to_q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Creates a structured list of Q matrices and their K indices — cast_list_to_q_matrix","text":"matrix_list flat list q_matrix objects","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/cast_list_to_q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Creates a structured list of Q matrices and their K indices — cast_list_to_q_matrix","text":"q_matrix_list object containing Q matrices K indices","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Count the number of loci in a gen_tibble — count_loci","title":"Count the number of loci in a gen_tibble — count_loci","text":"Count number loci gen_tibble (directly genotype column).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count the number of loci in a gen_tibble — count_loci","text":"","code":"count_loci(.x, ...) # S3 method for class 'tbl_df' count_loci(.x, ...) # S3 method for class 'vctrs_bigSNP' count_loci(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count the number of loci in a gen_tibble — count_loci","text":".x gen_tibble, vector class vctrs_bigSNP (usually genotype column gen_tibble object). ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count the number of loci in a gen_tibble — count_loci","text":"number loci","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":null,"dir":"Reference","previous_headings":"","what":"Counts the number of individuals in a vcf file — count_vcf_individuals","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"Count number VCF individuals first parsing header, getting first line, separating tabs.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"","code":"count_vcf_individuals(file)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"file name path vcf file (can compressed)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"number individuals (integer)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"author Henrik Bengtsson original countLines R.utils; Andrea Manica modified version focussed vcf; Max Carter-Brown modified file .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":null,"dir":"Reference","previous_headings":"","what":"Counts the number of variants in a vcf file — count_vcf_variants","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"Count number VCF variants first parsing header, rapidly counting number platform-independent newlines (CR, LF, CR+LF), including last line neither.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"","code":"count_vcf_variants(file, chunk_size = 5e+07)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"file name path vcf file (can compressed) chunk_size number bytes read chunk.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"number variants (integer)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"author Henrik Bengtsson original countLines R.utils; Andrea Manica modified version focussed vcf","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/distruct_colours.html","id":null,"dir":"Reference","previous_headings":"","what":"Distruct colours — distruct_colours","title":"Distruct colours — distruct_colours","text":"Colours palette used distruct","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/distruct_colours.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Distruct colours — distruct_colours","text":"","code":"distruct_colours"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/distruct_colours.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Distruct colours — distruct_colours","text":"vector 60 hex colours","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/filter_high_relatedness.html","id":null,"dir":"Reference","previous_headings":"","what":"Filter individuals based on a relationship threshold — filter_high_relatedness","title":"Filter individuals based on a relationship threshold — filter_high_relatedness","text":"function takes matrix x y individuals containing relatedness coefficients returns maximum set individuals contains relationships given threshold.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/filter_high_relatedness.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Filter individuals based on a relationship threshold — filter_high_relatedness","text":"","code":"filter_high_relatedness( matrix, .x = NULL, kings_threshold = NULL, verbose = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/filter_high_relatedness.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Filter individuals based on a relationship threshold — filter_high_relatedness","text":"matrix square symmetric matrix individuals containing relationship coefficients .x gen_tibble object kings_threshold threshold verbose boolean whether report screen","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/filter_high_relatedness.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Filter individuals based on a relationship threshold — filter_high_relatedness","text":"list '1' individual ID's retain, '2' individual ID's remove, '3' boolean individuals keep TRUE individuals remove FALSE","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":null,"dir":"Reference","previous_headings":"","what":"Flip the strand of alleles — flip","title":"Flip the strand of alleles — flip","text":"function takes vector bases recodes .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Flip the strand of alleles — flip","text":"","code":"flip(bases)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Flip the strand of alleles — flip","text":"bases vector characters. valid characters \"\", \"T\", \"C\" \"G\".","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Flip the strand of alleles — flip","text":"vector recoded bases","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Flip the strand of alleles — flip","text":"Note check bases valid. Also, missing alleles \"m\" kept \"m\".","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":null,"dir":"Reference","previous_headings":"","what":"Constructor for a gen_tibble — gen_tibble","title":"Constructor for a gen_tibble — gen_tibble","text":"gen_tibble stores genotypes individuals tidy format. DESCRIBE format","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Constructor for a gen_tibble — gen_tibble","text":"","code":"gen_tibble( x, ..., valid_alleles = c(\"A\", \"T\", \"C\", \"G\"), missing_alleles = c(\"0\", \".\"), backingfile = NULL, quiet = FALSE ) # S3 method for class 'character' gen_tibble( x, ..., parser = c(\"vcfR\", \"cpp\"), n_cores = 1, chunk_size = NULL, valid_alleles = c(\"A\", \"T\", \"C\", \"G\"), missing_alleles = c(\"0\", \".\"), backingfile = NULL, quiet = FALSE ) # S3 method for class 'matrix' gen_tibble( x, indiv_meta, loci, ..., ploidy = 2, valid_alleles = c(\"A\", \"T\", \"C\", \"G\"), missing_alleles = c(\"0\", \".\"), backingfile = NULL, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Constructor for a gen_tibble — gen_tibble","text":"x can : string giving path PLINK BED PED file. associated BIM FAM files BED, MAP PED expected directory file name. string giving path RDS file storing bigSNP object bigsnpr package (usually created bigsnpr::snp_readBed()) string giving path vcf file. Note currently read whole vcf memory vcfR, smallish VCF can imported. biallelic SNPs considered. string giving path packedancestry .geno file. associated .ind .snp files expected directory share file name prefix. genotype matrix dosages (0, 1, 2, NA) giving dosage alternate allele. ... x name vcf file, additional arguments passed vcfR::read.vcfR(). Otherwise, unused. valid_alleles vector valid allele values; defaults '','T', 'C' 'G'. missing_alleles vector values BIM file/loci dataframe indicate missing value allele value (e.g. monomorphic locus one allele). defaults '0' '.' (PLINK 1.9). backingfile path, including file name without extension, backing files used store data (given .bk .RDS automatically). needed x already .RDS file. x .BED VCF file backingfile left NULL, backing file saved directory bed file, using file name different file type (.bk rather .bed). x genotype matrix backingfile NULL, temporary file created (note R delete end session!) quiet provide information files used store data parser name parser used VCF, either \"cpp\" use fast C++ parser, \"vcfR\" use R package vcfR. latter slower robust; \"cpp\" gives error, try using \"vcfR\" case VCF unusual structure. n_cores number cores use parallel processing chunk_size number loci individuals (depending format) processed time (currently used x vcf packedancestry file) indiv_meta list, data.frame tibble compulsory columns 'id' 'population', plus additional metadata interest. used x genotype matrix. Otherwise information extracted directly files. loci data.frame tibble, compulsory columns 'name', 'chromosome', 'position','genetic_dist', 'allele_ref' 'allele_alt'. used x genotype matrix. Otherwise information extracted directly files. ploidy ploidy samples (either single value, vector values mixed ploidy). used creating gen_tibble matrix data; otherwise, ploidy determined automatically data read.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Constructor for a gen_tibble — gen_tibble","text":"object class gen_tbl.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Constructor for a gen_tibble — gen_tibble","text":"VCF files: fast cpp parser used default. cpp vcfR parsers attempt establish ploidy first variant; variant found sex chromosome (mtDNA), parser fail 'Error: genotype max_ploidy alleles...'. successful import VCF, change order variants first chromosome autosome using tool vcftools. Currently, biallelic SNPs supported. haploid variants (e.g. sex chromosomes) included VCF, transformed homozygous calls. Instead, reference alleles counted 0 alternative alleles counted 1. packedancestry files: loading packedancestry files, missing alleles converted 'X' NA","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_p_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Return a single P matrix from a q_matrix_list object — get_p_matrix","title":"Return a single P matrix from a q_matrix_list object — get_p_matrix","text":"function retrieves single P matrix q_matrix_list object based specified k value run number.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_p_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return a single P matrix from a q_matrix_list object — get_p_matrix","text":"","code":"get_p_matrix(x, ..., k, run)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_p_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return a single P matrix from a q_matrix_list object — get_p_matrix","text":"x q_matrix_list object containing P matrices ... used k k value desired P matrix run run number desired P matrix","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_p_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return a single P matrix from a q_matrix_list object — get_p_matrix","text":"single P matrix q_matrix_list object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Return a single Q matrix from a q_matrix_list object — get_q_matrix","title":"Return a single Q matrix from a q_matrix_list object — get_q_matrix","text":"function retrieves single Q matrix q_matrix_list object based specified k value run number.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return a single Q matrix from a q_matrix_list object — get_q_matrix","text":"","code":"get_q_matrix(x, ..., k, run)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return a single Q matrix from a q_matrix_list object — get_q_matrix","text":"x q_matrix_list object containing multiple Q matrices ... used k k value desired Q matrix run run number desired Q matrix","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return a single Q matrix from a q_matrix_list object — get_q_matrix","text":"single Q matrix q_matrix_list object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genind.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","title":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","text":"function converts gen_tibble genind object adegenet","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genind.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","text":"","code":"gt_as_genind(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genind.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","text":"x gen_tibble, population coded 'population'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genind.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","text":"genind object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genlight.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","title":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","text":"function converts gen_tibble genlight object adegenet","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genlight.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","text":"","code":"gt_as_genlight(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genlight.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","text":"x gen_tibble, population coded 'population'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genlight.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","text":"genlight object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_geno_lea.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","title":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","text":"function writes .geno file fom gen_tibble. Unless file path given, file suffix .geno written location .rds .bk files underpin gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_geno_lea.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","text":"","code":"gt_as_geno_lea(x, file = NULL)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_geno_lea.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","text":"x gen_tibble file .geno filename path, NULL (default) use location backing files.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_geno_lea.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","text":"path .geno file","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_hierfstat.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","title":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","text":"function converts gen_tibble data.frame formatted used hierfstat functions.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_hierfstat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","text":"","code":"gt_as_hierfstat(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_hierfstat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","text":"x gen_tibble, population coded 'population'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_hierfstat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","text":"data.frame column 'pop' column representing genotypes (alleles recoded 1 2)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":null,"dir":"Reference","previous_headings":"","what":"Export a gen_tibble object to PLINK bed format — gt_as_plink","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"function exports information gen_tibble object PLINK bed, ped raw file (associated files, .e. .bim .fam .bed; .fam .ped).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"","code":"gt_as_plink(x, file = NULL, type = c(\"bed\", \"ped\", \"raw\"), overwrite = TRUE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"x gen_tibble object file character string giving path output file. left NULL, output file path prefix backingfile. type one \"bed\", \"ped\" \"raw\" overwrite boolean whether overwrite file.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"path saved file","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"gen_tibble read vcf format, family.ID resulting plink files sample.ID.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_vcf.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gen_tibble to a VCF — gt_as_vcf","title":"Convert a gen_tibble to a VCF — gt_as_vcf","text":"function write VCF gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_vcf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gen_tibble to a VCF — gt_as_vcf","text":"","code":"gt_as_vcf(x, file = NULL, chunk_size = NULL, overwrite = FALSE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_vcf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gen_tibble to a VCF — gt_as_vcf","text":"x gen_tibble, population coded 'population' file .vcf file name path, NULL (default) use location backing files. chunk_size number loci processed time. Automatically set left NULL overwrite logical, file overwritten already exists?","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_vcf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gen_tibble to a VCF — gt_as_vcf","text":"path .vcf file","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Run K-clustering on principal components — gt_cluster_pca","title":"Run K-clustering on principal components — gt_cluster_pca","text":"function implements clustering procedure used Discriminant Analysis Principal Components (DAPC, Jombart et al. 2010). procedure consists running successive K-means increasing number clusters (k), transforming data using principal component analysis (PCA). model, several statistical measures goodness fit computed, allows choose optimal k using function gt_cluster_pca_best_k(). See details description select optimal k vignette(\"adegenet-dapc\") tutorial.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run K-clustering on principal components — gt_cluster_pca","text":"","code":"gt_cluster_pca( x = NULL, n_pca = NULL, k_clusters = c(1, round(nrow(x$u)/10)), method = c(\"kmeans\", \"ward\"), n_iter = 1e+05, n_start = 10, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run K-clustering on principal components — gt_cluster_pca","text":"x gt_pca object returned one gt_pca_* functions. n_pca number principal components fed LDA. k_clusters number clusters explore, either single value, vector length 2 giving minimum maximum (e.g. 1:5). left NULL, use 1 number pca components divided 10 (reasonable guess). method either 'kmeans' 'ward' n_iter number iterations kmeans (used method=\"kmeans\") n_start number starting points kmeans (used method=\"kmeans\") quiet boolean whether silence outputting information screen (defaults FALSE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run K-clustering on principal components — gt_cluster_pca","text":"gt_cluster_pca object, subclass gt_pca additional element 'cluster', list elements: 'method' clustering method (either kmeans ward) 'n_pca' number principal components used clustering 'k' k values explored function 'WSS' within sum squares k 'AIC' AIC k 'BIC' BIC k 'groups' list, element giving group assignments given k","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":null,"dir":"Reference","previous_headings":"","what":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"function selects best k value based chosen metric criterion. equivalent plotting metric k values, selecting k fulfils given criterion (see details explanation criterion). function simply adds element 'best_k' gt_cluster_pca returned gt_cluster_pca(). choice can -ridden simply assigning different value element (e.g. object x desired k 8, simply use x$best_k <- 8)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"","code":"gt_cluster_pca_best_k( x, stat = c(\"BIC\", \"AIC\", \"WSS\"), criterion = c(\"diffNgroup\", \"min\", \"goesup\", \"smoothNgoesup\", \"goodfit\"), quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"x gt_cluster_pca object obtained gt_cluster_pca() stat statistics, one \"BIC\", \"AIC\" \"WSS\" criterion one \"diffNgroup\", \"min\", \"goesup\", \"smoothNgoesup\", \"goodfit\", see details discussion approach. quiet boolean whether silence outputting information screen (defaults FALSE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"'gt_cluster_pca' object added element 'best_k'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"analysis data simulated various population genetics models (see reference) suggested ad-hoc rule selection optimal number clusters. First important result BIC seems efficient AIC WSS select appropriate number clusters (see example). rule thumb consists increasing K longer leads appreciable improvement fit (.e., decrease BIC). simple models (island models), BIC decreases reaches optimal K, increases. cases, best rule amounts choosing lowest K. models stepping stones, decrease BIC often continues optimal K, much less steep, change slope can taken indication best k lies. function provides programmatic way select k. Note highly recommended look graph BIC versus numbers clusters, understand validate programmatic selection. criteria available function : \"diffNgroup\": differences successive values summary statistics (default, BIC) split two groups using Ward's clustering method (see ?hclust), differentiate sharp decrease mild decreases increases. retained K one first group switch. criterion appears work well island/hierarchical models, decently isolation distance models, albeit unstability. can confounded initial, sharp decrease test statistics. UNSURE CRITERION USE, USE ONE. \"min\": model minimum summary statistics (specified stat argument, BIC default) retained. likely work simple island model, using BIC. likely fail models relating stepping stones, BIC always decreases (albeit small amount) K increases. general, approach tends -estimate number clusters. \"goesup\": selected model K increasing number clusters leads increasing summary statistics. Suffers inaccuracy, since ) steep decrease might follow small 'bump' increase statistics, ii) increase might never happen, happen negligible decreases. likely work clear-cut island models. \"smoothNgoesup\": variant \"goesup\", summary statistics first smoothed using lowess approach. meant accurate \"goesup\" less prone stopping small 'bumps' decrease statistics. \"goodfit\": another criterion seeking good fit minimum number clusters. approach rely differences successive statistics, absolute fit. selects model smallest K overall fit given threshold.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"Jombart T, Devillard S Balloux F (2010) Discriminant analysis principal components: new method analysis genetically structured populations. BMC Genetics 11:94. doi:10.1186/1471-2156-11-94","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":null,"dir":"Reference","previous_headings":"","what":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"function implements Discriminant Analysis Principal Components (DAPC, Jombart et al. 2010). method describes diversity pre-defined groups. groups unknown, use gt_cluster_pca() infer genetic clusters. See 'details' section succinct description method, vignette package adegenet (\"adegenet-dapc\") tutorial. function returns objects class adegenet::dapc compatible methods adegenet; graphical methods DAPC documented adegenet::scatter.dapc (see ?scatter.dapc).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"","code":"gt_dapc( x, pop = NULL, n_pca = NULL, n_da = NULL, loadings_by_locus = TRUE, pca_info = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"x object class gt_pca, subclass gt_cluster_pca pop either factor indicating group membership individuals; integer defining desired k x gt_cluster_pca; NULL, 'x' gt_cluster_pca contain element 'best_k', usually generated gt_cluster_pca_best_k(), used select clustering level. n_pca number principal components used Discriminant Analysis. NULL, k-1 used. n_da integer indicating number axes retained Discriminant Analysis step. loadings_by_locus logical indicating whether loadings contribution locus stored (TRUE, default) (FALSE). output can useful, can also create large matrices lot loci many dimensions. pca_info logical indicating whether information prior PCA stored (TRUE, default) (FALSE). information required predict group membership new individuals using predict, makes object slightly bigger.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"object class adegenet::dapc","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"Discriminant Analysis Principal Components (DAPC) designed investigate genetic structure biological populations. multivariate method consists two-steps procedure. First, genetic data transformed (centred, possibly scaled) submitted Principal Component Analysis (PCA). Second, principal components PCA submitted Linear Discriminant Analysis (LDA). trivial matrix operation allows express discriminant functions linear combination alleles, therefore allowing one compute allele contributions. details computation DAPC found indicated reference.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"Jombart T, Devillard S Balloux F (2010) Discriminant analysis principal components: new method analysis genetically structured populations. BMC Genetics 11:94. doi:10.1186/1471-2156-11-94 Thia, J. . (2023). Guidelines standardizing application discriminant analysis principal components genotype data. Molecular Ecology Resources, 23, 523–538. https://doi.org/10.1111/1755-0998.13706","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_extract_f2.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","title":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","text":"function prepares data various ADMIXTOOLS 2 functions fro package ADMIXTOOLS 2. takes gen_tibble, computes allele frequencies blocked f2-statistics, writes results outdir. equivalent admixtools::extract_f2().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_extract_f2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","text":"","code":"gt_extract_f2( .x, outdir = NULL, blgsize = 0.05, maxmem = 8000, maxmiss = 0, minmaf = 0, maxmaf = 0.5, minac2 = FALSE, outpop = NULL, outpop_scale = TRUE, transitions = TRUE, transversions = TRUE, overwrite = FALSE, adjust_pseudohaploid = TRUE, fst = TRUE, afprod = TRUE, poly_only = c(\"f2\"), apply_corr = TRUE, n_cores = 1, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_extract_f2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","text":".x gen_tibble outdir Directory data stored. blgsize SNP block size Morgan. Default 0.05 (5 cM). blgsize 100 greater, interpreted base pair distance rather centimorgan distance. maxmem Maximum amount memory used. required amount memory exceeds maxmem, allele frequency data split blocks, computation performed separately block pair. put precise cap amount memory used (used point). Set parameter lower values run memory running function. Set higher values function slow lots memory. maxmiss Discard SNPs missing fraction populations higher maxmiss minmaf Discard SNPs minor allele frequency less minmaf maxmaf Discard SNPs minor allele frequency greater maxmaf minac2 Discard SNPs allele count lower 2 population (default FALSE). option set TRUE computing f3-statistics one population consists mostly pseudohaploid samples. Otherwise heterozygosity estimates thus f3-estimates can biased. minac2 == 2 discard SNPs allele count lower 2 non-singleton population (option experimental based hypothesis using SNPs allele count lower 2 leads biases non-singleton populations). Note , minac2 option discards SNPs allele count lower 2 population, qp3pop function discard SNPs allele count lower 2 first (target) population (first argument prefix genotype file; .e. applied directly genotype file, via precomputing f2 gen_tibble). outpop Keep SNPs heterozygous population outpop_scale Scale f2-statistics inverse outpop heterozygosity (1/(p*(1-p))). Providing outpop setting outpop_scale TRUE give results original qpGraph outpop parameter set, disadvantage treating one population different others. may limit use f2-statistics models. transitions Set FALSE exclude transition SNPs transversions Set FALSE exclude transversion SNPs overwrite Overwrite existing files outdir adjust_pseudohaploid Genotypes pseudohaploid samples usually coded 0 2, even though one allele observed. adjust_pseudohaploid ensures observed allele count increases 1 pseudohaploid sample. TRUE (default), samples genotypes coded 1 among first 1000 SNPs automatically identified pseudohaploid. leads slightly accurate estimates f-statistics. Setting parameter FALSE treats samples diploid equivalent ADMIXTOOLS inbreed: option. Setting adjust_pseudohaploid integer n check first n SNPs instead first 1000 SNPs. fst Write files pairwise FST every population pair. Setting FALSE can make extract_f2 faster require less memory. afprod Write files allele frequency products every population pair. Setting FALSE can make extract_f2 faster require less memory. poly_only Specify whether SNPs identical allele frequencies every population discarded (poly_only = TRUE), whether used (poly_only = FALSE). default (poly_only = c(\"f2\")), SNPs used compute FST allele frequency products, compute f2 (default option original ADMIXTOOLS). apply_corr Apply small-sample-size correction computing f2-statistics (default TRUE) n_cores Parallelize computation across n_cores cores. quiet Suppress printing progress updates","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_extract_f2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","text":"SNP metadata (invisibly)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_get_file_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","title":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","text":"function return names files used store data gen_tibble. Specifically, returns .rds file storing big","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_get_file_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","text":"","code":"gt_get_file_names(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_get_file_names.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","text":"x gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_get_file_names.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","text":"character vector names paths two files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_has_imputed.html","id":null,"dir":"Reference","previous_headings":"","what":"Checks if a gen_tibble has been imputed — gt_has_imputed","title":"Checks if a gen_tibble has been imputed — gt_has_imputed","text":"function checks dataset imputed. Note imputation mean imputed values used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_has_imputed.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checks if a gen_tibble has been imputed — gt_has_imputed","text":"","code":"gt_has_imputed(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_has_imputed.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checks if a gen_tibble has been imputed — gt_has_imputed","text":"x gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_has_imputed.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checks if a gen_tibble has been imputed — gt_has_imputed","text":"boolean TRUE FALSE depending whether dataset imputed","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":null,"dir":"Reference","previous_headings":"","what":"Simple imputation based on allele frequencies — gt_impute_simple","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"function provides simple imputation algorithm gen_tibble objects using mode, mean sampling allele frequencies. locus imputed independently (thus linkage information ignored).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"","code":"gt_impute_simple(x, method = c(\"mode\", \"mean0\", \"random\"), n_cores = 1)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"x gen_tibble missing data method one 'mode': frequent genotype 'mean0': mean rounded nearest integer 'random': randomly sample genotype based observed allele frequencies n_cores number cores used","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"gen_tibble imputed genotypes","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"function wrapper around bigsnpr::snp_fastImputeSimple().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_load.html","id":null,"dir":"Reference","previous_headings":"","what":"Load a gen_tibble — gt_load","title":"Load a gen_tibble — gt_load","text":"Load gen_tibble previously saved gt_save(). .rds .bk files moved, found automatically. moved, use reattach_to point .rds file (.bk file needs directory .rds file).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_load.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load a gen_tibble — gt_load","text":"","code":"gt_load(file = NULL, reattach_to = NULL)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_load.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load a gen_tibble — gt_load","text":"file file name, including full path. end .gt, extension added. reattach_to file name, including full path, .rds file moved. assumes .bk file found path. able leave NULL unless moved files.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_load.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load a gen_tibble — gt_load","text":"gen_tibble","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Principal Component Analysis for gen_tibble objects — gt_pca","title":"Principal Component Analysis for gen_tibble objects — gt_pca","text":"number PCA methods available gen_tibble objects. mostly designed work large datasets, compute limited number components. smaller datasets, gt_partialSVD allows use partial (truncated) SVD fit PCA; method suitable number individuals much smaller number loci. larger dataset, gt_randomSVD appropriate. Finally, method specifically designed dealing LD large datasets, gt_autoSVD. Whilst arguably best option, somewhat data hungry, suitable large datasets (hundreds individuals several hundred thousands markers, larger).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Principal Component Analysis for gen_tibble objects — gt_pca","text":"NOTE: using gt_pca_autoSVD small dataset likely cause error, see man page details. NOTE: monomorphic markers must removed PCA computed. error message 'Error: variables zero scaling; remove attempting scale.' indicates monomorphic markers present.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":null,"dir":"Reference","previous_headings":"","what":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"function performs Principal Component Analysis gen_tibble, using fast truncated SVD initial pruning iterative removal long-range LD regions. function wrapper bigsnpr::snp_autoSVD()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"","code":"gt_pca_autoSVD( x, k = 10, fun_scaling = bigsnpr::snp_scaleBinom(), thr_r2 = 0.2, use_positions = TRUE, size = 100/thr_r2, roll_size = 50, int_min_size = 20, alpha_tukey = 0.05, min_mac = 10, max_iter = 5, n_cores = 1, verbose = TRUE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"x gen_tbl object k Number singular vectors/values compute. Default 10. algorithm used compute singular vectors/values. fun_scaling Usually can left unset, defaults bigsnpr::snp_scaleBinom(), appropriate function biallelic SNPs. Alternatively possible use custom function (see bigsnpr::snp_autoSVD() details. thr_r2 Threshold squared correlation two SNPs. Default 0.2. Use NA want skip clumping step. size use_positions boolean whether position used define size, whether size number SNPs. Default TRUE size one SNP, window size around SNP compute correlations. Default 100 / thr_r2 clumping (0.2 -> 500; 0.1 -> 1000; 0.5 -> 200). providing infos.pos (NULL, default), window number SNPs, otherwise window kb (genetic distance). recommend provide positions available. roll_size Radius rolling windows smooth log-p-values. Default 50. int_min_size Minimum number consecutive outlier SNPs order reported long-range LD region. Default 20. alpha_tukey Default 0.1. type-error rate outlier detection (corrected multiple testing). min_mac Minimum minor allele count (MAC) variants included. Default 10. max_iter Maximum number iterations outlier detection. Default 5. n_cores Number cores used. Default use parallelism. may use bigstatsr::nb_cores(). verbose Output information iterations? Default TRUE.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"gt_pca object, subclass bigSVD; S3 list elements: named list (S3 class \"big_SVD\") d, eigenvalues (singular values, .e. variances), u, scores sample component (left singular vectors) v, loadings (right singular vectors) center, centering vector, scale, scaling vector, method, string defining method (case 'autoSVD'), call, call generated object. Note: rather accessing elements directly, better use tidy augment. See gt_pca_tidiers. Note: encounter 'Error rollmean(): Parameter 'size' large.' roll_size exceeding number variants least one chromosomes. pre-specified roll_size, need reduce parameter. , try specifying reduced 'roll_size' avoid error.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"Using gt_pca_autoSVD requires reasonably large dataset, function iteratively removes regions long range LD.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_partialSVD.html","id":null,"dir":"Reference","previous_headings":"","what":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","title":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","text":"function performs Principal Component Analysis gen_tibble, partial SVD eigen decomposition covariance. works well number individuals much smaller number loci; otherwise, gt_pca_randomSVD() better option. function wrapper bigstatsr::big_SVD().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_partialSVD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","text":"","code":"gt_pca_partialSVD(x, k = 10, fun_scaling = bigsnpr::snp_scaleBinom())"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_partialSVD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","text":"x gen_tbl object k Number singular vectors/values compute. Default 10. algorithm used compute singular vectors/values. fun_scaling Usually can left unset, defaults bigsnpr::snp_scaleBinom(), appropriate function biallelic SNPs. Alternatively possible use custom function (see bigsnpr::snp_autoSVD() details.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_partialSVD.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","text":"gt_pca object, subclass bigSVD; S3 list elements: named list (S3 class \"big_SVD\") d, eigenvalues (singular values, .e. variances), u, scores sample component (left singular vectors) v, loadings (right singular vectors) center, centering vector, scale, scaling vector, method, string defining method (case 'partialSVD'), call, call generated object. Note: rather accessing elements directly, better use tidy augment. See gt_pca_tidiers.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_randomSVD.html","id":null,"dir":"Reference","previous_headings":"","what":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","title":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","text":"function performs Principal Component Analysis gen_tibble, randomised partial SVD based algorithm RSpectra (Yixuan Qiu Jiali Mei). algorithm linear time dimensions memory-efficient. Thus, can used large big.matrices. function wrapper bigstatsr::big_randomSVD()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_randomSVD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","text":"","code":"gt_pca_randomSVD( x, k = 10, fun_scaling = bigsnpr::snp_scaleBinom(), tol = 1e-04, verbose = FALSE, n_cores = 1, fun_prod = bigstatsr::big_prodVec, fun_cprod = bigstatsr::big_cprodVec )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_randomSVD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","text":"x gen_tbl object k Number singular vectors/values compute. Default 10. algorithm used compute singular vectors/values. fun_scaling Usually can left unset, defaults bigsnpr::snp_scaleBinom(), appropriate function biallelic SNPs. Alternatively possible use custom function (see bigsnpr::snp_autoSVD() details. tol Precision parameter svds. Default 1e-4. verbose progress printed? Default FALSE. n_cores Number cores used. fun_prod Function takes 6 arguments (order): matrix-like object X, vector x, vector row indices ind.row X, vector column indices ind.col X, vector column centers (corresponding ind.col), vector column scales (corresponding ind.col), compute product X (subsetted scaled) x. fun_cprod fun.prod, transpose X.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_randomSVD.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","text":"gt_pca object, subclass bigSVD; S3 list elements: named list (S3 class \"big_SVD\") d, eigenvalues (singular values, .e. variances), u, scores sample component (left singular vectors) v, loadings (right singular vectors) center, centering vector, scale, scaling vector, method, string defining method (case 'randomSVD'), call, call generated object. Note: rather accessing elements directly, better use tidy augment. See gt_pca_tidiers.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":null,"dir":"Reference","previous_headings":"","what":"pcadapt analysis on a gen_tibble object — gt_pcadapt","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"pcadapt algorithm detects genetic markers selection. based principal component analysis (PCA) genotypes individuals. method described Luu et al. (2017), See R package pcadapt, provides extensive documentation examples.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"","code":"gt_pcadapt(x, pca, k, n_cores = 1)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"x gen_tibble object. pca gt_pca object, returned gt_pca_partialSVD() gt_pca_randomSVD(). k Number principal components use analysis. n_cores Number cores use.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"object subclass gt_pcadapt, subclass mhtest.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"Internally, function uses snp_pcadapt function bigsnpr package.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":null,"dir":"Reference","previous_headings":"","what":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"function uses sliding-window approach look runs homozygosity (heterozygosity) diploid genome. function uses package selectRUNS, implements approach equivalent one PLINK.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"","code":"gt_roh_window( x, window_size = 15, threshold = 0.05, min_snp = 3, heterozygosity = FALSE, max_opp_window = 1, max_miss_window = 1, max_gap = 10^6, min_length_bps = 1000, min_density = 1/1000, max_opp_run = NULL, max_miss_run = NULL )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"x gen_tibble window_size size sliding window (number SNP loci) (default = 15) threshold threshold overlapping windows state (homozygous/heterozygous) call SNP RUN (default = 0.05) min_snp minimum n. SNP RUN (default = 3) heterozygosity look runs heterozygosity (instead homozygosity? (default = FALSE) max_opp_window max n. SNPs opposite type (e.g. heterozygous snps runs homozygosity) sliding window (default = 1) max_miss_window max. n. missing SNP sliding window (default = 1) max_gap max distance consecutive SNP still considered potential run (default = 10^6 bps) min_length_bps minimum length run bps (defaults 1000 bps = 1 kbps) min_density minimum n. SNP per kbps (defaults 0.1 = 1 SNP every 10 kbps) max_opp_run max n. opposite genotype SNPs run (optional) max_miss_run max n. missing SNPs run (optional)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"dataframe RUNs Homozygosity Heterozygosity analysed dataset. returned dataframe contains following seven columns: \"group\", \"id\", \"chrom\", \"nSNP\", \"\", \"\", \"lengthBps\" (group: population, breed, case/control etc.; id: individual identifier; chrom: chromosome run located; nSNP: number SNPs run; : starting position run, bps; : end position run, bps; lengthBps: size run)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"function returns data frame runs detected dataset. data frame can written csv file. data frame , turn, input functions detectRUNS package create plots produce statistics results (see plots statistics functions manual, /refer detectRUNS vignette). gen_tibble grouped, grouping variable used fill group table. Otherwise, group 'column' filled values 'id' column","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"","code":"# run the example only if we have the package installed if (requireNamespace(\"detectRUNS\", quietly = TRUE)) { sheep_ped <- system.file(\"extdata\", \"Kijas2016_Sheep_subset.ped\", package=\"detectRUNS\") sheep_gt <- tidypopgen::gen_tibble(sheep_ped, backingfile = tempfile(), quiet=TRUE) sheep_gt <- sheep_gt %>% group_by(population) sheep_roh <- gt_roh_window(sheep_gt) detectRUNS::plot_Runs(runs = sheep_roh) } #> N. of RUNS for individual H114 is: 27 #> N. of RUNS for individual H115 is: 29 #> N. of RUNS for individual H116 is: 28 #> N. of RUNS for individual H26 is: 25 #> N. of RUNS for individual H32 is: 21 #> N. of RUNS for individual H38 is: 16 #> N. of RUNS for individual H44 is: 14 #> N. of RUNS for individual H56 is: 14 #> N. of RUNS for individual H50 is: 29 #> N. of RUNS for individual H27 is: 18 #> N. of RUNS for individual H33 is: 21 #> N. of RUNS for individual H39 is: 17 #> N. of RUNS for individual H45 is: 18 #> N. of RUNS for individual H51 is: 29 #> N. of RUNS for individual H57 is: 20 #> N. of RUNS for individual H28 is: 13 #> N. of RUNS for individual H34 is: 18 #> N. of RUNS for individual H40 is: 28 #> N. of RUNS for individual H46 is: 29 #> N. of RUNS for individual H52 is: 20 #> N. of RUNS for individual H58 is: 13 #> N. of RUNS for individual H29 is: 17 #> N. of RUNS for individual H35 is: 27 #> N. of RUNS for individual H41 is: 19 #> N. of RUNS for individual H47 is: 22 #> N. of RUNS for individual H53 is: 25 #> N. of RUNS for individual H59 is: 28 #> N. of RUNS for individual H30 is: 19 #> N. of RUNS for individual H42 is: 20 #> N. of RUNS for individual H48 is: 32 #> N. of RUNS for individual H54 is: 20 #> N. of RUNS for individual H60 is: 17 #> N. of RUNS for individual H31 is: 15 #> N. of RUNS for individual H37 is: 17 #> N. of RUNS for individual H43 is: 14 #> N. of RUNS for individual H49 is: 19 #> N. of RUNS for individual H55 is: 33 #> N. of RUNS for individual H1 is: 21 #> N. of RUNS for individual H9 is: 13 #> N. of RUNS for individual H17 is: 29 #> N. of RUNS for individual H2 is: 19 #> N. of RUNS for individual H10 is: 20 #> N. of RUNS for individual H19 is: 22 #> N. of RUNS for individual H3 is: 25 #> N. of RUNS for individual H11 is: 21 #> N. of RUNS for individual H20 is: 36 #> N. of RUNS for individual H4 is: 20 #> N. of RUNS for individual H12 is: 17 #> N. of RUNS for individual H21 is: 25 #> N. of RUNS for individual H13 is: 22 #> N. of RUNS for individual H22 is: 30 #> N. of RUNS for individual H6 is: 17 #> N. of RUNS for individual H14 is: 20 #> N. of RUNS for individual H7 is: 31 #> N. of RUNS for individual H15 is: 15 #> N. of RUNS for individual H24 is: 22 #> N. of RUNS for individual H8 is: 23 #> N. of RUNS for individual H16 is: 35 #> N. of RUNS for individual H25 is: 22 #> N. of RUNS for individual H64 is: 30 #> N. of RUNS for individual H62 is: 20 #> N. of RUNS for individual H63 is: 11 #> N. of RUNS for individual H118 is: 30 #> N. of RUNS for individual H119 is: 27 #> N. of RUNS for individual H120 is: 28 #> N. of RUNS for individual H121 is: 31 #> N. of RUNS for individual H122 is: 31 #> N. of RUNS for individual H123 is: 22 #> N. of RUNS for individual H124 is: 31 #> N. of RUNS for individual H125 is: 22 #> N. of RUNS for individual H126 is: 26 #> N. of RUNS for individual H127 is: 28 #> N. of RUNS for individual H128 is: 33 #> N. of RUNS for individual H129 is: 19 #> N. of RUNS for individual H130 is: 30 #> N. of RUNS for individual H131 is: 33 #> N. of RUNS for individual H132 is: 30 #> N. of RUNS for individual H133 is: 33 #> N. of RUNS for individual H134 is: 27 #> N. of RUNS for individual H135 is: 27 #> N. of RUNS for individual H136 is: 17 #> N. of RUNS for individual H137 is: 33 #> N. of RUNS for individual H138 is: 23 #> N. of RUNS for individual H139 is: 32 #> N. of RUNS for individual H140 is: 27 #> N. of RUNS for individual H141 is: 28 #> N. of RUNS for individual H142 is: 27 #> N. of RUNS for individual H143 is: 24 #> N. of RUNS for individual H144 is: 26 #> N. of RUNS for individual H145 is: 32 #> N. of RUNS for individual H146 is: 23 #> N. of RUNS for individual H147 is: 23 #> N. of RUNS for individual H148 is: 25 #> N. of RUNS for individual H149 is: 26 #> N. of RUNS for individual H150 is: 31 #> N. of RUNS for individual H151 is: 36 #> N. of RUNS for individual H152 is: 26 #> N. of RUNS for individual H153 is: 27 #> N. of RUNS for individual H154 is: 31 #> N. of RUNS for individual H155 is: 32"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save.html","id":null,"dir":"Reference","previous_headings":"","what":"Save a gen_tibble — gt_save","title":"Save a gen_tibble — gt_save","text":"Save tibble (update backing files). gen_tibble object saved file extension .gt, togethe update .rds .bk files. Note multiple .gt files can linked .rds .bk files; generally, occurs create multiple subsets data. .gt file stores information subset full dataset interested , whilst .rds .bk file store full dataset. reload gen_tibble, can pass name .gt file gt_load().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save a gen_tibble — gt_save","text":"","code":"gt_save(x, file_name = NULL, quiet = FALSE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save a gen_tibble — gt_save","text":"x gen_tibble file_name file name, including full path. end .gt, extension added. quiet boolean suppress information hte files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Save a gen_tibble — gt_save","text":"file name path .gt file, together .rds .bk files","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save_light.html","id":null,"dir":"Reference","previous_headings":"","what":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","title":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","text":"light version gt_save resave bigSNP RDS backing file, used internally creating gen_tibble (just created , need resave )","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save_light.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","text":"","code":"gt_save_light(x, file_name = NULL, quiet = FALSE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save_light.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","text":"x gen_tibble file_name file name, including full path. end .gt, extension added. quiet boolean suppress information hte files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save_light.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","text":"file name path .gt file, together .rds .bk files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_set_imputed.html","id":null,"dir":"Reference","previous_headings":"","what":"Sets a gen_tibble to use imputed data — gt_set_imputed","title":"Sets a gen_tibble to use imputed data — gt_set_imputed","text":"function sets unsets use imputed data. analysis, PCA, allow missing data, use imputation, analysis might preferable allow missing data.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_set_imputed.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sets a gen_tibble to use imputed data — gt_set_imputed","text":"","code":"gt_set_imputed(x, set = NULL)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_set_imputed.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sets a gen_tibble to use imputed data — gt_set_imputed","text":"x gen_tibble set boolean defining whether imputed data used","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_to_aftable.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","title":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","text":"function equivalent anygeno_to_aftable(), aftable created directly gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_to_aftable.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","text":"","code":"gt_to_aftable(.x, adjust_pseudohaploid = TRUE, n_cores = bigstatsr::nb_cores())"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_to_aftable.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","text":".x gen_tibble adjust_pseudohaploid Genotypes pseudohaploid samples usually coded 0 2, even though one allele observed. adjust_pseudohaploid ensures observed allele count increases 1 pseudohaploid sample. TRUE (default), samples genotypes coded 1 among first 1000 SNPs automatically identified pseudohaploid. leads slightly accurate estimates f-statistics. Setting parameter FALSE treats samples diploid equivalent ADMIXTOOLS inbreed: option. Setting adjust_pseudohaploid integer n check first n SNPs instead first 1000 SNPs. n_cores Parallelize computation across n_cores cores.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_to_aftable.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","text":"list 3 elements: afs, counts, snp","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_uses_imputed.html","id":null,"dir":"Reference","previous_headings":"","what":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","title":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","text":"function checks dataset uses imputed data. Note possible dataset imputed currently using imputation.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_uses_imputed.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","text":"","code":"gt_uses_imputed(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_uses_imputed.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","text":"x gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_uses_imputed.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","text":"boolean TRUE FALSE depending whether dataset using imputed values","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_write_bigsnp_from_dfs.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a bigSNP object from data.frames — gt_write_bigsnp_from_dfs","title":"Create a bigSNP object from data.frames — gt_write_bigsnp_from_dfs","text":"function expects indiv_meta loci correct columns","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_write_bigsnp_from_dfs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a bigSNP object from data.frames — gt_write_bigsnp_from_dfs","text":"","code":"gt_write_bigsnp_from_dfs( genotypes, indiv_meta, loci, backingfile = NULL, ploidy = ploidy )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_write_bigsnp_from_dfs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a bigSNP object from data.frames — gt_write_bigsnp_from_dfs","text":"genotypes genotype matrix indiv_meta individual meta information loci loci table","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/identify_pseudohaploids.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify pseudohaploids — identify_pseudohaploids","title":"Identify pseudohaploids — identify_pseudohaploids","text":"Pseudohaploids coded homozygotes; find checking first 'n_test' loci call pseudohaploid zero heterozygosity (strategy employed admixtools)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/identify_pseudohaploids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify pseudohaploids — identify_pseudohaploids","text":"","code":"identify_pseudohaploids(x, n_test = 1000)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/identify_pseudohaploids.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify pseudohaploids — identify_pseudohaploids","text":"x gen_tibble n_test number loci tested","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/identify_pseudohaploids.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify pseudohaploids — identify_pseudohaploids","text":"numeric vector ploidy","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_het_obs.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate individual observed heterozygosity — indiv_het_obs","title":"Estimate individual observed heterozygosity — indiv_het_obs","text":"Estimate observed heterozygosity (H_obs) individual (.e. frequency loci heterozygous individual).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_het_obs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate individual observed heterozygosity — indiv_het_obs","text":"","code":"indiv_het_obs(.x, ...) # S3 method for class 'tbl_df' indiv_het_obs(.x, ...) # S3 method for class 'vctrs_bigSNP' indiv_het_obs(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_het_obs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate individual observed heterozygosity — indiv_het_obs","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_het_obs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate individual observed heterozygosity — indiv_het_obs","text":"vector heterozygosities, one per individuals gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_inbreeding.html","id":null,"dir":"Reference","previous_headings":"","what":"Individual inbreeding coefficient — indiv_inbreeding","title":"Individual inbreeding coefficient — indiv_inbreeding","text":"function calculates inbreeding coefficient individual based beta estimate Weir Goudet (2017).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_inbreeding.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Individual inbreeding coefficient — indiv_inbreeding","text":"","code":"indiv_inbreeding(.x, method = c(\"WG17\"), allele_sharing_mat = NULL, ...) # S3 method for class 'tbl_df' indiv_inbreeding(.x, method = c(\"WG17\"), allele_sharing_mat = NULL, ...) # S3 method for class 'vctrs_bigSNP' indiv_inbreeding(.x, method = c(\"WG17\"), allele_sharing_mat = NULL, ...) # S3 method for class 'grouped_df' indiv_inbreeding(.x, method = c(\"WG17\"), allele_sharing_mat = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_inbreeding.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Individual inbreeding coefficient — indiv_inbreeding","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. method currently \"WG17\" (Weir Goudet 2017). allele_sharing_mat optional relevant \"WG17\", matrix Allele Sharing returned pairwise_allele_sharing() as_matrix=TRUE. number statistics can derived Allele Sharing matrix, sometimes efficient pre-compute matrix. possible use grouped tibbles. ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_inbreeding.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Individual inbreeding coefficient — indiv_inbreeding","text":"numeric vector inbreeding coefficients.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_missingness.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate individual missingness — indiv_missingness","title":"Estimate individual missingness — indiv_missingness","text":"Estimate missingness individual (.e. frequency missing genotypes individual).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_missingness.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate individual missingness — indiv_missingness","text":"","code":"indiv_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'tbl_df' indiv_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'vctrs_bigSNP' indiv_missingness(.x, as_counts = FALSE, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_missingness.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate individual missingness — indiv_missingness","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. as_counts boolean defining whether count NAs (rather rate) returned. defaults FALSE (.e. rates returned default). ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_missingness.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate individual missingness — indiv_missingness","text":"vector heterozygosities, one per individuals gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_ploidy.html","id":null,"dir":"Reference","previous_headings":"","what":"Return individual ploidy — indiv_ploidy","title":"Return individual ploidy — indiv_ploidy","text":"Returns ploidy individual.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_ploidy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return individual ploidy — indiv_ploidy","text":"","code":"indiv_ploidy(.x, ...) # S3 method for class 'tbl_df' indiv_ploidy(.x, ...) # S3 method for class 'vctrs_bigSNP' indiv_ploidy(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_ploidy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return individual ploidy — indiv_ploidy","text":".x gen_tibble, vector class vctrs_bigSNP (usually genotype column gen_tibble object) ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_ploidy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return individual ploidy — indiv_ploidy","text":"vector ploidy, one per individuals gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_alt_freq.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate allele frequencies at each each locus — loci_alt_freq","title":"Estimate allele frequencies at each each locus — loci_alt_freq","text":"Allele frequencies can estimates minimum allele frequencies (MAF) loci_maf() frequency alternate allele (loci_alt_freq()). latter line genotypes matrix (e.g. extracted show_loci()). users interested MAF, raw frequencies might useful computing aggregated statistics.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_alt_freq.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate allele frequencies at each each locus — loci_alt_freq","text":"","code":"loci_alt_freq(.x, ...) # S3 method for class 'tbl_df' loci_alt_freq(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_alt_freq(.x, ...) # S3 method for class 'grouped_df' loci_alt_freq(.x, n_cores = bigstatsr::nb_cores(), ...) loci_maf(.x, ...) # S3 method for class 'tbl_df' loci_maf(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_maf(.x, ...) # S3 method for class 'grouped_df' loci_maf(.x, n_cores = bigstatsr::nb_cores(), ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_alt_freq.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate allele frequencies at each each locus — loci_alt_freq","text":".x vector class vctrs_bigSNP (usually genotypes column gen_tibble object), gen_tibble. ... arguments passed specific methods, currently unused. n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_alt_freq.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate allele frequencies at each each locus — loci_alt_freq","text":"vector frequencies, one per locus","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_chromosomes.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","title":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","text":"Extract loci chromosomes gen_tibble (directly genotype column).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_chromosomes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","text":"","code":"loci_chromosomes(.x, ...) # S3 method for class 'tbl_df' loci_chromosomes(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_chromosomes(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_chromosomes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","text":".x gen_tibble, vector class vctrs_bigSNP (usually genotype column gen_tibble object). ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_chromosomes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","text":"character vector chromosomes","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":null,"dir":"Reference","previous_headings":"","what":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"Return p-value exact test HWE.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"","code":"loci_hwe(.x, ...) # S3 method for class 'tbl_df' loci_hwe(.x, mid_p = TRUE, ...) # S3 method for class 'vctrs_bigSNP' loci_hwe(.x, mid_p = TRUE, ...) # S3 method for class 'grouped_df' loci_hwe(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":".x vector class vctrs_bigSNP (usually genotypes column gen_tibble object), gen_tibble. ... used. mid_p boolean whether mid-p value computed. Default TRUE, PLINK.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"vector probabilities HWE exact test, one per locus","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"function uses original C++ algorithm PLINK 1.90. NOTE tests function yet! Unit tests needed.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"C++ algorithm written Christopher Chang PLINK 1.90, based original code Jan Wigginton (code released GPL3).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":null,"dir":"Reference","previous_headings":"","what":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":"function uses clumping remove SNPs high LD. used default options, clumping based MAF similar standard pruning (done PLINK \"–indep-pairwise (size+1) 1 thr.r2\", results better spread SNPs chromosome.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":"","code":"loci_ld_clump(.x, ...) # S3 method for class 'tbl_df' loci_ld_clump(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_ld_clump( .x, S = NULL, thr_r2 = 0.2, size = 100/thr_r2, exclude = NULL, use_positions = TRUE, n_cores = 1, return_id = FALSE, ... ) # S3 method for class 'grouped_df' loci_ld_clump(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":".x gen_tibble object ... currently used. S vector loci statistics express importance SNP (important SNP, greater corresponding statistic). example, S follows standard normal distribution, \"important\" means significantly different 0, must use abs(S) instead.specified, MAFs computed used. thr_r2 Threshold squared correlation two SNPs. Default 0.2. size one SNP, window size around SNP compute correlations. Default 100 / thr.r2 clumping (0.2 -> 500; 0.1 -> 1000; 0.5 -> 200). use_positions = FALSE, window number SNPs, otherwise window kb (genetic distance). Ideally, use positions, provide sensible approach. exclude Vector SNP indices exclude anyway. example, can used exclude long-range LD regions (see Price2008). Another use can thresholding respect p-values associated S. use_positions boolean, TRUE (default), size kb, FALSE size number SNPs. n_cores number cores used return_id boolean whether id SNPs keep returned. defaults FALSE, returns vector booleans (TRUE FALSE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":"boolean vector indicating whether SNP kept ('return_id = FALSE', default), else vector SNP indices kept ('return_id = TRUE')","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":"missing values genotypes gen_tibble passed loci_ld_clump cause error. deal missingness, see gt_impute_simple().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_missingness.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate missingness at each locus — loci_missingness","title":"Estimate missingness at each locus — loci_missingness","text":"Estimate rate missingness locus.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_missingness.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate missingness at each locus — loci_missingness","text":"","code":"loci_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'tbl_df' loci_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'vctrs_bigSNP' loci_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'grouped_df' loci_missingness(.x, as_counts = FALSE, n_cores = bigstatsr::nb_cores(), ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_missingness.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate missingness at each locus — loci_missingness","text":".x vector class vctrs_bigSNP (usually genotypes column gen_tibble object), gen_tibble. as_counts boolean defining whether count NAs (rather rate) returned. defaults FALSE (.e. rates returned default). ... arguments passed specific methods. n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_missingness.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate missingness at each locus — loci_missingness","text":"vector frequencies, one per locus","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the names of loci in a gen_tibble — loci_names","title":"Get the names of loci in a gen_tibble — loci_names","text":"Extract loci names gen_tibble (directly genotype column).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the names of loci in a gen_tibble — loci_names","text":"","code":"loci_names(.x, ...) # S3 method for class 'tbl_df' loci_names(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_names(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_names.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the names of loci in a gen_tibble — loci_names","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_names.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the names of loci in a gen_tibble — loci_names","text":"character vector names","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transitions.html","id":null,"dir":"Reference","previous_headings":"","what":"Find transitions — loci_transitions","title":"Find transitions — loci_transitions","text":"Use loci table define loci transitions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transitions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find transitions — loci_transitions","text":"","code":"loci_transitions(.x, ...) # S3 method for class 'tbl_df' loci_transitions(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_transitions(.x, ...) # S3 method for class 'grouped_df' loci_transitions(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transitions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Find transitions — loci_transitions","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... arguments passed specific methods.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transitions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Find transitions — loci_transitions","text":"logical vector defining loci transitions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transversions.html","id":null,"dir":"Reference","previous_headings":"","what":"Find transversions — loci_transversions","title":"Find transversions — loci_transversions","text":"Use loci table define loci transversions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transversions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find transversions — loci_transversions","text":"","code":"loci_transversions(.x, ...) # S3 method for class 'tbl_df' loci_transversions(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_transversions(.x, ...) # S3 method for class 'grouped_df' loci_transversions(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transversions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Find transversions — loci_transversions","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... arguments passed specific methods.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transversions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Find transversions — loci_transversions","text":"logical vector defining loci transversions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/new_vctrs_bigsnp.html","id":null,"dir":"Reference","previous_headings":"","what":"create a vctrs_bigSNP — new_vctrs_bigsnp","title":"create a vctrs_bigSNP — new_vctrs_bigsnp","text":"create vctrs_bigSNP","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/new_vctrs_bigsnp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create a vctrs_bigSNP — new_vctrs_bigsnp","text":"","code":"new_vctrs_bigsnp(bigsnp_obj, bigsnp_file, indiv_id, ploidy = 2)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/new_vctrs_bigsnp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create a vctrs_bigSNP — new_vctrs_bigsnp","text":"bigsnp_obj bigsnp object bigsnp_file file bigsnp object saved indiv_id ids individuals ploidy ploidy samples (either single value, vector values mixed ploidy).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/new_vctrs_bigsnp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"create a vctrs_bigSNP — new_vctrs_bigsnp","text":"vctrs_bigSNP object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_allele_sharing.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","title":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","text":"function computes Allele Sharing matrix. Estimates Allele Sharing (hierfstat::matching())) pairs individuals (locus, gives 1 two individuals homozygous allele, 0 homozygous different allele, 1/2 least one individual heterozygous. Matching average 0, 1/2 1s)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_allele_sharing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","text":"","code":"pairwise_allele_sharing( x, as_matrix = FALSE, block_size = bigstatsr::block_size(count_loci(x)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_allele_sharing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","text":"x gen_tibble object. as_matrix boolean, determining whether results square symmetrical matrix (TRUE), tidied tibble (FALSE, default) block_size maximum number loci read . loci improve speed, tax memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_allele_sharing.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","text":"matrix allele sharing pairs individuals","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"function computes Genomic Relationship Matrix (GRM). estimated computing pairwise kinship coefficients (coancestries) pairs individuals matrix Allele Sharing follwng approach Weir Goudet 2017 based beta estimators).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"","code":"pairwise_grm( x, allele_sharing_mat = NULL, block_size = bigstatsr::block_size(count_loci(x)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"x gen_tibble object. allele_sharing_mat optional, matrix Allele Sharing returned pairwise_allele_sharing() as_matrix=TRUE. number statistics can derived Allele Sharing matrix, sometimes efficient pre-compute matrix. block_size size blocks use computation allele sharing matrix.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"matrix GR pairs individuals","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"GRM twice coancestry matrix (e.g. estimated hierfstat::beta.dosage() inb=FALSE).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"function computes IBS matrix.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"","code":"pairwise_ibs( x, as_matrix = FALSE, type = c(\"proportion\", \"adjusted_counts\", \"raw_counts\"), block_size = bigstatsr::block_size(count_loci(x)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"x gen_tibble object. as_matrix boolean, determining whether results square symmetrical matrix (TRUE), tidied tibble (FALSE, default) type one \"proportion\" (equivalent \"ibs\" PLINK), \"adjusted_counts\" (\"distance\" PLINK), \"raw_counts\" (counts identical alleles non-missing alleles, two quantities computed) block_size maximum number loci read . loci improve speed, tax memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"bigstatsr::FBM proportion adjusted counts, list two bigstatsr::FBM matrices, one counts IBS alleles, one number valid alleles (.e. 2n_loci - 2missing_loci)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"Note monomorphic sites currently counted. filter beforehand? plink ?","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_king.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","title":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","text":"function computes KING-robust estimator kinship.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_king.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","text":"","code":"pairwise_king( x, as_matrix = FALSE, block_size = bigstatsr::block_size(length(loci_names(x))) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_king.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","text":"x gen_tibble object. as_matrix boolean, determining whether results square symmetrical matrix (TRUE), tidied tibble (FALSE, default) block_size maximum number loci read . loci improve speed, tax memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_king.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","text":"Note monomorphic sites currently considered. Remove monomorphic sites running pairwise_king concern.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute pairwise population Fst — pairwise_pop_fst","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"function computes pairwise Fst. following methods implemented: 'Hudson': Hudson's formulation, derived Bhatia et al (2013) diploids. 'Nei86' : Gst according Nei (1986), derived Bhatia et al (2013) diploids. 'Nei87' : Fst according Nei (1987) - equivalent hierfstat::pairwise.neifst(), includes correction heterozygosity computing Ht 'WC84' : Weir Cockerham (1984), derived Bhatia et al (2013) diploids.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"","code":"pairwise_pop_fst( .x, by_locus = FALSE, method = c(\"Hudson\", \"Nei87\", \"Nei86\", \"WC84\"), n_cores = bigstatsr::nb_cores() )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute pairwise population Fst — pairwise_pop_fst","text":".x grouped gen_tibble (obtained using dplyr::group_by()) by_locus boolean, determining whether Fst returned locus(TRUE), single genome wide value obtained taking ratio mean numerator denominator (FALSE, default). method one 'Hudson', 'Nei86', 'Nei87', 'WC84' n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"tibble genome-wide pairwise Fst values pairwise combination row \"by_locus=FALSE\", else list including tibble genome-wide values well matrix pairwise Fst locus loci rows pairwise combinations columns.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"formulae, genome wide estimate obtained taking ratio mean numerators denominators relevant SNPs.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"Bhatia G, Patterson N, Sankararaman S, Price AL. Estimating Interpreting FST: Impact Rare Variants. Genome Research. 2013;23(9):1514–1521. Nei, M. (1987) Molecular Evolutionary Genetics. Columbia University Press","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute population specific FIS — pop_fis","title":"Compute population specific FIS — pop_fis","text":"function computes population specific FIS, using either approach Nei 1987 (computed hierfstat::basic.stats()) Weir Goudet 2017 (computed hierfstat::fis.dosage()).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute population specific FIS — pop_fis","text":"","code":"pop_fis( .x, method = c(\"Nei87\", \"WG17\"), by_locus = FALSE, include_global = FALSE, allele_sharing_mat = NULL )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute population specific FIS — pop_fis","text":".x grouped gen_tibble (obtained using dplyr::group_by()) method one \"Nei87\" (based Nei 1987, eqn 7.41) \"WG17\" (Weir Goudet 2017) compute FIS by_locus boolean, determining whether FIS returned locus(TRUE), single genome wide value (FALSE, default). Note relevant \"Nei87\", \"WG17\" always returns single value. include_global boolean determining whether, besides population specific estiamtes, global estimate appended. Note return vector n populations plus 1 (global value), matrix n+1 columns by_locus=TRUE. allele_sharing_mat optional relevant \"WG17\", matrix Allele Sharing returned pairwise_allele_sharing() as_matrix=TRUE. number statistics can derived Allele Sharing matrix, sometimes efficient pre-compute matrix.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute population specific FIS — pop_fis","text":"vector population specific fis (plus global value include_global=TRUE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute population specific FIS — pop_fis","text":"Nei M. (1987) Molecular Evolutionary Genetics. Columbia University Press Weir, BS Goudet J (2017) Unified Characterization Population Structure Relatedness. Genetics (2017) 206:2085","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute population specific Fst — pop_fst","title":"Compute population specific Fst — pop_fst","text":"function computes population specific Fst, using approach Weir Goudet 2017 (computed hierfstat::fst.dosage()).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute population specific Fst — pop_fst","text":"","code":"pop_fst(.x, include_global = FALSE, allele_sharing_mat = NULL)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute population specific Fst — pop_fst","text":".x grouped gen_tibble (obtained using dplyr::group_by()) include_global boolean determining whether, besides population specific Fst, global Fst appended. Note return vector n populations plus 1 (global value) allele_sharing_mat optional, matrix Allele Sharing returned pairwise_allele_sharing() as_matrix=TRUE. number statistics can derived Allele Sharing matrix,","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute population specific Fst — pop_fst","text":"vector population specific Fst (plus global value include_global=TRUE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute population specific Fst — pop_fst","text":"Weir, BS Goudet J (2017) Unified Characterization Population Structure Relatedness. Genetics (2017) 206:2085","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute basic population global statistics — pop_global_stats","title":"Compute basic population global statistics — pop_global_stats","text":"function computes basic population global statistics, following notation Nei 1987 (turn based Nei Chesser 1983): observed heterozygosity ( \\(\\hat{h}_o\\), column header Ho) expected heterozygosity, also known gene diversity ( \\(\\hat{h}_s\\), Hs) total heterozygosity ( \\(\\hat{h}_t\\), Ht) genetic differentiation subpopulations (\\(D_{st}\\), Dst) corrected total population diversity (\\(h'_t\\), Htp) corrected genetic differentiation subpopulations (\\(D'_{st}\\), Dstp) \\(\\hat{F}_{ST}\\) (column header, Fst) corrected \\(\\hat{F'}_{ST}\\) (column header Fstp) \\(\\hat{F}_{}\\) (column header, Fis) Jost's \\(\\hat{D}\\) (column header, Dest)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute basic population global statistics — pop_global_stats","text":"","code":"pop_global_stats(.x, by_locus = FALSE, n_cores = bigstatsr::nb_cores())"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute basic population global statistics — pop_global_stats","text":".x gen_tibble (usually grouped, obtained using dplyr::group_by(); use single population return number quantities NA/NaN) by_locus boolean, determining whether statistics returned locus(TRUE), single genome wide value (FALSE, default). n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute basic population global statistics — pop_global_stats","text":"tibble population statistics, populations rows statistics columns","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute basic population global statistics — pop_global_stats","text":"use notation Nei 1987. notation loci \\(m\\) alleles, case two alleles, m=2. Within population observed heterozygosity \\(\\hat{h}_o\\) locus \\(m\\) alleles defined : \\(\\hat{h}_o= 1-\\sum_{k=1}^{s} \\sum_{=1}^{m} \\hat{X}_{kii}/s\\) \\(\\hat{X}_{kii}\\) represents proportion homozygote \\(\\) sample \\(k\\)th population \\(s\\) number populations, following equation 7.38 Nei(1987) pp.164. Within population expected heterozygosity (gene diversity) \\(\\hat{h}_s\\) locus \\(m\\) alleles defined : \\(\\hat{h}_s=(\\tilde{n}/(\\tilde{n}-1))[1-\\sum_{=1}^{m}\\bar{\\hat{x}_i^2}-\\hat{h}_o/2\\tilde{n}]\\) \\(\\tilde{n}=s/\\sum_k 1/n_k\\) (.e harmonic mean \\(n_k\\)) \\(\\bar{\\hat{x}_i^2}=\\sum_k \\hat{x}_{ki}^2/s\\) following equation 7.39 Nei(1987) pp.164. Total heterozygosity (total gene diversity) \\(\\hat{h}_t\\) locus \\(m\\) alleles defined : \\(\\hat{h}_t = 1-\\sum_{=1}^{m} \\bar{\\hat{x}_i^2} + \\hat{h}_s/(\\tilde{n}s) - \\hat{h}_o/(2\\tilde{n}s)\\) \\(\\hat{x}_i=\\sum_k \\hat{x}_{ki}/s\\) following equation 7.40 Nei(1987) pp.164. amount gene diversity among samples \\(D_{ST}\\) defined : \\(D_{ST} = \\hat{h}_t - \\hat{h}_s\\) following equation provided text top page 165 Nei(1987). corrected amount gene diversity among samples \\(D'_{ST}\\) defined : \\(D'_{ST} = (s/(s-1))D'_{ST}\\) following equation provided text top page 165 Nei(1987). Total corrected heterozygosity (total gene diversity) \\(\\hat{h}_t\\) defined : \\(\\hat{h'}_t = \\hat{h}_s + D'_{ST}\\) following equation provided text top page 165 Nei(1987). \\(\\hat{F}_{}\\) defined : \\(\\hat{F}_{} = 1 - \\hat{h}_o/\\hat{h}_s\\) following equation 7.41 Nei(1987) pp.164. \\(\\hat{F}_{ST}\\) defined : \\(\\hat{F}_{ST} = 1 - \\hat{h}_s/\\hat{h}_t = D_{ST}/\\hat{h}_t\\) following equation 7.43 Nei(1987) pp.165. \\(\\hat{F'}_{ST}\\) defined : \\(\\hat{F'}_{ST} = D'_{ST}/\\hat{h'}_t\\) following explanation provided text top page 165 Nei(1987). Jost's \\(\\hat{D}\\) defined : \\(\\hat{D} = (s/(s-1))((\\hat{h'}_t-\\hat{h}_s)/(1-\\hat{h}_s))\\) defined Jost(2008) statistics first computed locus, averaged across loci (including monorphic locus) obtain genome-wide values. function uses algorithm hierfstat::basic.stats() optimized speed memory usage.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute basic population global statistics — pop_global_stats","text":"Nei M, Chesser R (1983) Estimation fixation indexes gene diversities. Annals Human Genetics, 47, 253-259. Nei M. (1987) Molecular Evolutionary Genetics. Columbia University Press, pp. 164-165. Jost L (2008) GST relatives measure differentiation. Molecular Ecology, 17, 4015-4026.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the population expected heterozygosity — pop_het_exp","title":"Compute the population expected heterozygosity — pop_het_exp","text":"function computes expected population heterozygosity (also referred gene diversity, avoid potentially misleading use term \"expected\" context), using formula Nei (1987).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the population expected heterozygosity — pop_het_exp","text":"","code":"pop_het_exp( .x, by_locus = FALSE, include_global = FALSE, n_cores = bigstatsr::nb_cores() ) pop_gene_div( .x, by_locus = FALSE, include_global = FALSE, n_cores = bigstatsr::nb_cores() )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the population expected heterozygosity — pop_het_exp","text":".x gen_tibble (usually grouped, obtained using dplyr::group_by(), otherwise full tibble considered belonging single population). by_locus boolean, determining whether Hs returned locus(TRUE), single genome wide value (FALSE, default). include_global boolean determining whether, besides population specific estiamtes, global estimate appended. Note return vector n populations plus 1 (global value), matrix n+1 columns by_locus=TRUE. n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the population expected heterozygosity — pop_het_exp","text":"vector mean population observed heterozygosities (by_locus=FALSE), matrix estimates locus (rows loci, columns populations, by_locus=TRUE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the population expected heterozygosity — pop_het_exp","text":"Within population expected heterozygosity (gene diversity) \\(\\hat{h}_s\\) locus \\(m\\) alleles defined : \\(\\hat{h}_s=\\tilde{n}/(\\tilde{n}-1)[1-\\sum_{}^{m}\\bar{\\hat{x}_i^2}-\\hat{h}_o/2\\tilde{n}]\\) \\(\\tilde{n}=s/\\sum_k 1/n_k\\) (.e harmonic mean \\(n_k\\)) \\(\\bar{\\hat{x}_i^2}=\\sum_k \\hat{x}_{ki}^2/s\\) following equation 7.39 Nei(1987) pp.164. specific case, two alleles, \\(m=2\\). \\(\\hat{h}_s\\) genome level population simply mean locus estimates population.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute the population expected heterozygosity — pop_het_exp","text":"Nei M. (1987) Molecular Evolutionary Genetics. Columbia University Press","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the population observed heterozygosity — pop_het_obs","title":"Compute the population observed heterozygosity — pop_het_obs","text":"function computes population heterozygosity, using formula Nei (1987).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the population observed heterozygosity — pop_het_obs","text":"","code":"pop_het_obs( .x, by_locus = FALSE, include_global = FALSE, n_cores = bigstatsr::nb_cores() )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the population observed heterozygosity — pop_het_obs","text":".x gen_tibble (usually grouped, obtained using dplyr::group_by(), otherwise full tibble considered belonging single population). by_locus boolean, determining whether Ho returned locus(TRUE), single genome wide value (FALSE, default). include_global boolean determining whether, besides population specific estiamtes, global estimate appended. Note return vector n populations plus 1 (global value), matrix n+1 columns by_locus=TRUE. n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the population observed heterozygosity — pop_het_obs","text":"vector mean population observed heterozygosities (by_locus=FALSE), matrix estimates locus (rows loci, columns populations, by_locus=TRUE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the population observed heterozygosity — pop_het_obs","text":"Within population observed heterozygosity \\(\\hat{h}_o\\) locus \\(m\\) alleles defined : \\(\\hat{h}_o= 1-\\sum_{k=1}^{s} \\sum_{=1}^{m} \\hat{X}_{kii}/s\\) \\(\\hat{X}_{kii}\\) represents proportion homozygote \\(\\) sample \\(k\\)th population \\(s\\) number populations, following equation 7.38 Nei(1987) pp.164. specific case, two alleles, \\(m=2\\). population specific estimates, sum done single value \\(k\\). \\(\\hat{h}_o\\) genome level simply mean locus estimates.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute the population observed heterozygosity — pop_het_obs","text":"Nei M. (1987) Molecular Evolutionary Genetics. Columbia University Press","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Predict scores of a PCA — predict.gt_pca","title":"Predict scores of a PCA — predict.gt_pca","text":"Predict PCA scores gt_pca, either original data projecting new data.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Predict scores of a PCA — predict.gt_pca","text":"","code":"# S3 method for class 'gt_pca' predict( object, new_data = NULL, project_method = c(\"none\", \"simple\", \"OADP\", \"least_squares\"), lsq_pcs = c(1, 2), block_size = NULL, n_cores = 1, ... )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Predict scores of a PCA — predict.gt_pca","text":"object gt_pca object new_data gen_tibble scores requested new dataset project_method string taking value either \"simple\", \"OADP\" (Online Augmentation, Decomposition, Procrustes (OADP) projection), \"least_squares\" (done SMARTPCA) lsq_pcs vector length two values two principal components use least square fitting. relevant ifproject_method = 'least_squares' block_size number loci read simultaneously (larger values speed computation, require memory) n_cores number cores ... used","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Predict scores of a PCA — predict.gt_pca","text":"matrix predictions, samples rows components columns. number components depends many estimated gt_pca object.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Predict scores of a PCA — predict.gt_pca","text":"Zhang et al (2020). Fast robust ancestry prediction using principal component analysis 36(11): 3439–3446.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Read and structure .Q files or existing matrices as q_matrix or q_matrix_list objects. — q_matrix","title":"Read and structure .Q files or existing matrices as q_matrix or q_matrix_list objects. — q_matrix","text":"function reads .Q matrix files generated external clustering algorithms (ADMIXTURE) transforms q_matrix q_matrix_list objects plotting.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read and structure .Q files or existing matrices as q_matrix or q_matrix_list objects. — q_matrix","text":"","code":"q_matrix(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read and structure .Q files or existing matrices as q_matrix or q_matrix_list objects. — q_matrix","text":"x can : path directory containing .Q files path single .Q file matrix dataframe list dataframes matrices","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read and structure .Q files or existing matrices as q_matrix or q_matrix_list objects. — q_matrix","text":"either: single q_matrix object q_matrix_list object containing list Q matrices list indices Q matrix separated K","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_indiv.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Quality Control report for individuals — qc_report_indiv","title":"Create a Quality Control report for individuals — qc_report_indiv","text":"#' Return QC information assess loci (Observed heterozygosity missingness).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_indiv.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Quality Control report for individuals — qc_report_indiv","text":"","code":"qc_report_indiv(.x, ...) # S3 method for class 'tbl_df' qc_report_indiv(.x, kings_threshold = NULL, ...) # S3 method for class 'grouped_df' qc_report_indiv(.x, kings_threshold = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_indiv.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Quality Control report for individuals — qc_report_indiv","text":".x either gen_tibble object grouped gen_tibble (obtained using dplyr::group_by()) ... arguments pass kings_threshold optional numeric, threshold relatedness sample","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_indiv.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Quality Control report for individuals — qc_report_indiv","text":"tibble 2 elements: het_obs missingness","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Quality Control report for loci — qc_report_loci","title":"Create a Quality Control report for loci — qc_report_loci","text":"Return QC information assess loci (MAF, missingness HWE test).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Quality Control report for loci — qc_report_loci","text":"","code":"qc_report_loci(.x, ...) # S3 method for class 'tbl_df' qc_report_loci(.x, ...) # S3 method for class 'grouped_df' qc_report_loci(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Quality Control report for loci — qc_report_loci","text":".x gen_tibble object. ... currently unused HWE test.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Quality Control report for loci — qc_report_loci","text":"tibble 3 elements: maf, missingness hwe_p","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":null,"dir":"Reference","previous_headings":"","what":"Combine two gen_tibbles — rbind.gen_tbl","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"function combined two gen_tibbles. defaults, subsets loci swaps ref alt alleles make two datasets compatible (behaviour can switched as_is). first object used \"reference\" , SNPs dataset flipped /alleles swapped needed. SNPs different alleles two datasets (.e. triallelic) also dropped. also options (default) attempt strand flipping match alleles (often needed human datasets different SNP chips), remove ambiguous alleles (C/G /T) correct strand can guessed.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"","code":"# S3 method for class 'gen_tbl' rbind( ..., as_is = FALSE, flip_strand = FALSE, use_position = FALSE, quiet = FALSE, backingfile = NULL )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"... two gen_tibble objects. Note function can take objects, rbind done sequentially large sets objects. as_is boolean determining whether loci left merging. FALSE (defaults), rbind attempt subset swap alleles needed. flip_strand boolean whether strand flipping checked match two datasets. set TRUE, ambiguous SNPs (.e. /T C/G) also removed. defaults FALSE use_position boolean whether combination chromosome position used matching SNPs. default, rbind uses locus name, set FALSE. using 'use_position=TRUE', make sure chromosomes coded way gen_tibbles (mix e.g. 'chr1', '1' 'chromosome1' can reasons unexpectedly large number variants dropped merging). quiet boolean whether omit reporting screen backingfile path prefix files used store merged data (.RDS store bigSNP object .bk file backing file FBM)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"gen_tibble merged data.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"rbind differs merging data plink, swaps order allele1 allele2 according minor allele frequency merging datasets. rbind flips /swaps alleles according reference dataset, according allele frequency.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind_dry_run.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","title":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","text":"function provides overview fate SNP two gen_tibble objects case merge. SNPs found objects kept. One object used reference, SNPs dataset flipped /alleles swapped needed. SNPs different alleles two datasets also dropped.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind_dry_run.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","text":"","code":"rbind_dry_run( ref, target, use_position = FALSE, flip_strand = FALSE, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind_dry_run.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","text":"ref either gen_tibble object, path PLINK bim file; alleles objects used template flip ones target /swap order necessary. target either gen_tibble object, path PLINK bim file use_position boolean whether combination chromosome position used matching SNPs. default, rbind uses locus name, set FALSE. using 'use_position=TRUE', make sure chromosomes coded way gen_tibbles (mix e.g. 'chr1', '1' 'chromosome1' can reasons unexpectedly large number variants dropped merging). flip_strand boolean whether strand flipping checked match two datasets. Ambiguous SNPs (.e. /T C/G) also removed. defaults FALSE quiet boolean whether omit reporting screen","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind_dry_run.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","text":"list two data.frames, named target ref. data.frame nrow() equal number loci respective dataset, column id locus name, boolean columns to_keep (valid loci kept merge), alleles_mismatched (loci found datasets mismatched alleles, leading loci dropped), to_flip (loci need flipped align two datasets, found target data.frame) to_swap (loci order alleles needs swapped align two datasets, target data.frame)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. generics augment, tidy ggplot2 autoplot","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/scale_fill_distruct.html","id":null,"dir":"Reference","previous_headings":"","what":"Scale constructor using the distruct colours — scale_fill_distruct","title":"Scale constructor using the distruct colours — scale_fill_distruct","text":"wrapper around ggplot2::scale_fill_manual(), using distruct colours distruct_colours.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/scale_fill_distruct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scale constructor using the distruct colours — scale_fill_distruct","text":"","code":"scale_fill_distruct(guide = \"none\", ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/scale_fill_distruct.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scale constructor using the distruct colours — scale_fill_distruct","text":"guide guide function passed ggplot2::scale_fill_manual(). Defaults \"none\", set \"legend\" legend required. ... parameters passed ggplot2::scale_fill_manual()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/scale_fill_distruct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Scale constructor using the distruct colours — scale_fill_distruct","text":"scale constructor used ggplot","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"The select verb for loci — select_loci","title":"The select verb for loci — select_loci","text":"equivalent dplyr::select() works genotype column gen_tibble, using mini-grammar available tidyselect. select-like evaluation access names loci (.e. can select based names, summary statistics loci; look select_loci_if() feature.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The select verb for loci — select_loci","text":"","code":"select_loci(.data, .sel_arg)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The select verb for loci — select_loci","text":".data gen_tibble .sel_arg one unquoted expression, using mini-grammar dplyr::select() select loci. Variable names can used positions data frame, expressions like x:y can used select range variables.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"The select verb for loci — select_loci","text":"gen_tibble subset loci.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The select verb for loci — select_loci","text":"Note select_loci verb modify backing FBM files, rather subsets list loci used stored gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci_if.html","id":null,"dir":"Reference","previous_headings":"","what":"The select_if verb for loci — select_loci_if","title":"The select_if verb for loci — select_loci_if","text":"equivalent dplyr::select_if() works genotype column gen_tibble. function access genotypes (thus can work summary statistics select), names loci (look select_loci() feature.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci_if.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The select_if verb for loci — select_loci_if","text":"","code":"select_loci_if(.data, .sel_logical)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci_if.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The select_if verb for loci — select_loci_if","text":".data gen_tibble .sel_logical logical vector length equal number loci, expression tidy evaluate vector. loci .sel_logical TRUE selected; NA treated FALSE.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci_if.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The select_if verb for loci — select_loci_if","text":"#' Note select_loci_if verb modify backing FBM files, rather subsets list loci used stored gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_genotypes.html","id":null,"dir":"Reference","previous_headings":"","what":"Show the genotypes of a gen_tibble — show_genotypes","title":"Show the genotypes of a gen_tibble — show_genotypes","text":"Extract genotypes (matrix) gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_genotypes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show the genotypes of a gen_tibble — show_genotypes","text":"","code":"show_genotypes(.x, indiv_indices = NULL, loci_indices = NULL, ...) # S3 method for class 'tbl_df' show_genotypes(.x, indiv_indices = NULL, loci_indices = NULL, ...) # S3 method for class 'vctrs_bigSNP' show_genotypes(.x, indiv_indices = NULL, loci_indices = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_genotypes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show the genotypes of a gen_tibble — show_genotypes","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. indiv_indices indices individuals loci_indices indices loci ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_genotypes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show the genotypes of a gen_tibble — show_genotypes","text":"matrix counts alternative alleles (see show_loci()) extract information alleles loci gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Show the loci information of a gen_tibble — show_loci","title":"Show the loci information of a gen_tibble — show_loci","text":"Extract set information loci gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show the loci information of a gen_tibble — show_loci","text":"","code":"show_loci(.x, ...) # S3 method for class 'tbl_df' show_loci(.x, ...) # S3 method for class 'vctrs_bigSNP' show_loci(.x, ...) show_loci(.x) <- value # S3 method for class 'tbl_df' show_loci(.x) <- value # S3 method for class 'vctrs_bigSNP' show_loci(.x) <- value"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show the loci information of a gen_tibble — show_loci","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... currently unused. value data.frame tibble loci information replace current one.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show the loci information of a gen_tibble — show_loci","text":"tibble::tibble information (see gen_tibble details compulsory columns always present)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_ploidy.html","id":null,"dir":"Reference","previous_headings":"","what":"Show the ploidy information of a gen_tibble — show_ploidy","title":"Show the ploidy information of a gen_tibble — show_ploidy","text":"Extract ploidy information gen_tibble. NOTE function return ploidy level individual (obtained indiv_ploidy); instead, returns integer either ploidy level individuals (e.g. 2 indicates individuals diploid), 0 indicate mixed ploidy.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_ploidy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show the ploidy information of a gen_tibble — show_ploidy","text":"","code":"show_ploidy(.x, ...) # S3 method for class 'tbl_df' show_ploidy(.x, ...) # S3 method for class 'vctrs_bigSNP' show_ploidy(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_ploidy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show the ploidy information of a gen_tibble — show_ploidy","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_ploidy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show the ploidy information of a gen_tibble — show_ploidy","text":"ploidy (0 indicates mixed ploidy)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_allele_sharing.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","title":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","text":"function computes Allele Sharing matrix. Estimates Allele Sharing (matching hierfstat)) pairs individuals (locus, gives 1 two individuals homozygous allele, 0 homozygous different allele, 1/2 least one individual heterozygous. Matching average 0, 1/2 1s)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_allele_sharing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","text":"","code":"snp_allele_sharing( X, ind.row = bigstatsr::rows_along(X), ind.col = bigstatsr::cols_along(X), block.size = bigstatsr::block_size(nrow(X)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_allele_sharing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","text":"X bigstatsr::FBM.code256 matrix (found genotypes slot bigsnpr::bigSNP object). ind.row optional vector row indices used. specified, rows used. use negative indices. ind.col optional vector column indices used. specified, columns used. use negative indices. block.size maximum number columns read . Note , optimise speed matrix operations, store memory 3 times columns.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_allele_sharing.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","text":"matrix allele sharing pairs individuals","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":"function computes IBS matrix.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":"","code":"snp_ibs( X, ind.row = bigstatsr::rows_along(X), ind.col = bigstatsr::cols_along(X), type = c(\"proportion\", \"adjusted_counts\", \"raw_counts\"), block.size = bigstatsr::block_size(nrow(X)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":"X bigstatsr::FBM.code256 matrix (found genotypes slot bigsnpr::bigSNP object). ind.row optional vector row indices used. specified, rows used. use negative indices. ind.col optional vector column indices used. specified, columns used. use negative indices. type one \"proportion\" (equivalent \"ibs\" PLINK), \"adjusted_counts\" (\"distance\" PLINK), \"raw_counts\" (counts identical alleles non-missing alleles, two quantities computed) block.size maximum number columns read . Note , optimise speed matrix operations, store memory 3 times columns.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":".counts = TRUE function returns list two bigstatsr::FBM matrices, one counts IBS alleles (.e. 2*n loci), one valid alleles (.e. 2 * n_loci - 2 * missing_loci). .counts = FALSE returns single matrix IBS proportions.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":"Note monomorphic sites currently counted. filter beforehand? plink ?","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_king.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the KING-robust Matrix for a bigSNP object — snp_king","title":"Compute the KING-robust Matrix for a bigSNP object — snp_king","text":"function computes KING-robust estimator kinship.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_king.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the KING-robust Matrix for a bigSNP object — snp_king","text":"","code":"snp_king( X, ind.row = bigstatsr::rows_along(X), ind.col = bigstatsr::cols_along(X), block.size = bigstatsr::block_size(nrow(X)) * 4 )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_king.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the KING-robust Matrix for a bigSNP object — snp_king","text":"X bigstatsr::FBM.code256 matrix (found genotypes slot bigsnpr::bigSNP object). ind.row optional vector row indices used. specified, rows used. use negative indices. ind.col optional vector column indices used. specified, columns used. use negative indices. block.size maximum number columns read .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/stopifnot_gen_tibble.html","id":null,"dir":"Reference","previous_headings":"","what":"Test if a tibble is really gen_tibble — stopifnot_gen_tibble","title":"Test if a tibble is really gen_tibble — stopifnot_gen_tibble","text":"dplyr operations strip subclass tibble. function used check tibble , reality, still class gen_tbl","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/stopifnot_gen_tibble.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test if a tibble is really gen_tibble — stopifnot_gen_tibble","text":"","code":"stopifnot_gen_tibble(.x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/stopifnot_gen_tibble.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test if a tibble is really gen_tibble — stopifnot_gen_tibble","text":".x tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/subset_bigSNP.html","id":null,"dir":"Reference","previous_headings":"","what":"Subset a bigSNP object — subset_bigSNP","title":"Subset a bigSNP object — subset_bigSNP","text":"function subsets bigsnpr::bigSNP object, creating new backing file information subsetted reorders required.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/subset_bigSNP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subset a bigSNP object — subset_bigSNP","text":"","code":"subset_bigSNP( X, indiv_indices = NULL, loci_indices = NULL, swap_indices = NULL, backingfile = NULL )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/subset_bigSNP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subset a bigSNP object — subset_bigSNP","text":"X bigsnpr::bigSNP object subset indiv_indices indices individuals (rows) keep loci_indices indices loci (columns) keep swap_indices indices loci alleles swapped (bim table genotypes) backingfile backing file (null, tempfile used)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/subset_bigSNP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subset a bigSNP object — subset_bigSNP","text":"bigsnpr::bigSNP object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary.q_matrix_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarise a Q matrix list — summary.q_matrix_list","title":"Summarise a Q matrix list — summary.q_matrix_list","text":"Takes q_matrix_list object returns summary Q files object based number repeats K value.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary.q_matrix_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarise a Q matrix list — summary.q_matrix_list","text":"","code":"# S3 method for class 'q_matrix_list' summary(object, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary.q_matrix_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarise a Q matrix list — summary.q_matrix_list","text":"object q_matrix_list object. ... currently used","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary.q_matrix_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summarise a Q matrix list — summary.q_matrix_list","text":"summary number repeats K value.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary_rbind_dry_run.html","id":null,"dir":"Reference","previous_headings":"","what":"Print a summary of a merge report — summary.rbind_report","title":"Print a summary of a merge report — summary.rbind_report","text":"function creates summary merge report generated rbind_dry_run()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary_rbind_dry_run.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print a summary of a merge report — summary.rbind_report","text":"","code":"# S3 method for class 'rbind_report' summary(object, ..., ref_label = \"reference\", target_label = \"target\")"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary_rbind_dry_run.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print a summary of a merge report — summary.rbind_report","text":"object list generated rbind_dry_run() ... unused (necessary compatibility generic function) ref_label label reference dataset (defaults \"reference\") target_label label target dataset (defaults \"target\")","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary_rbind_dry_run.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print a summary of a merge report — summary.rbind_report","text":"NULL (prints summary console)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/theme_distruct.html","id":null,"dir":"Reference","previous_headings":"","what":"A theme to match the output of distruct — theme_distruct","title":"A theme to match the output of distruct — theme_distruct","text":"theme remove plot decorations, matching look plots created distruct.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/theme_distruct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A theme to match the output of distruct — theme_distruct","text":"","code":"theme_distruct()"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/theme_distruct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A theme to match the output of distruct — theme_distruct","text":"ggplot2::theme","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.gt_dapc.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a gt_dapc object — tidy.gt_dapc","title":"Tidy a gt_dapc object — tidy.gt_dapc","text":"summarizes information components gt_dapc tidypopgen package. parameter matrix determines element returned.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.gt_dapc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a gt_dapc object — tidy.gt_dapc","text":"","code":"# S3 method for class 'gt_dapc' tidy(x, matrix = \"eigenvalues\", ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.gt_dapc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a gt_dapc object — tidy.gt_dapc","text":"x gt_dapc object (returned gt_dapc()). matrix Character specifying component DAPC tidied. \"samples\", \"scores\", \"x\": returns information map original space least discriminant axes. \"v\", \"rotation\", \"loadings\" \"variables\": returns information map discriminant axes space back original space (.e. genotype frequencies). Note different loadings linking PCA scores (available element $loadings dapc object). \"d\", \"eigenvalues\" \"lds\": returns information eigenvalues. ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.gt_dapc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tidy a gt_dapc object — tidy.gt_dapc","text":"tibble::tibble columns depending component DAPC tidied. \"scores\" row tidied output corresponds original data PCA space. columns : row ID original observation (.e. rowname original data). LD Integer indicating principal component. value score observation particular principal component. , location observation PCA space. matrix \"loadings\", row tidied output corresponds information principle components original space. columns : row variable labels (colnames) data set PCA performed. LD integer vector indicating principal component. value value eigenvector (axis score) indicated principal component. \"eigenvalues\", columns : LD integer vector indicating discriminant axis. std.dev Standard deviation (.e. sqrt(eig/(n-1))) explained DA (compatibility prcomp. cumulative Cumulative variation explained principal components component (note phrased percentage total variance, since many methods estimate truncated SVD.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a Q matrix — tidy.q_matrix","title":"Tidy a Q matrix — tidy.q_matrix","text":"Takes q_matrix object, matrix, returns tidied tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a Q matrix — tidy.q_matrix","text":"","code":"# S3 method for class 'q_matrix' tidy(x, data, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a Q matrix — tidy.q_matrix","text":"x Q matrix object (returned q_matrix). data associated tibble (e.g. gen_tibble), individuals order data used generate Q matrix ... currently used","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tidy a Q matrix — tidy.q_matrix","text":"tidied tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a gt_pca object — tidy.gt_pca","title":"Tidy a gt_pca object — tidy.gt_pca","text":"summarizes information components gt_pca tidypopgen package. parameter matrix determines element returned. Column names tidied output match returned broom::tidy.prcomp, tidier standard PCA objects returned stats::prcomp.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a gt_pca object — tidy.gt_pca","text":"","code":"# S3 method for class 'gt_pca' tidy(x, matrix = \"eigenvalues\", ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a gt_pca object — tidy.gt_pca","text":"x gt_pca object returned one gt_pca_* functions. matrix Character specifying component PCA tidied. \"samples\", \"scores\", \"x\": returns information map original space principle components space (equivalent product u d). \"v\", \"rotation\", \"loadings\" \"variables\": returns information map principle components space back original space. \"d\", \"eigenvalues\" \"pcs\": returns information eigenvalues. ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tidy a gt_pca object — tidy.gt_pca","text":"tibble::tibble columns depending component PCA tidied. \"scores\" row tidied output corresponds original data PCA space. columns : row ID original observation (.e. rowname original data). PC Integer indicating principal component. value score observation particular principal component. , location observation PCA space. matrix \"loadings\", row tidied output corresponds information principle components original space. columns : row variable labels (colnames) data set PCA performed. PC integer vector indicating principal component. value value eigenvector (axis score) indicated principal component. \"eigenvalues\", columns : PC integer vector indicating principal component. std.dev Standard deviation (.e. sqrt(eig/(n-1))) explained PC (compatibility prcomp. cumulative Cumulative variation explained principal components component (note phrased percentage total variance, since many methods estimate truncated SVD.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidypopgen-package.html","id":null,"dir":"Reference","previous_headings":"","what":"tidypopgen: Tidy Population Genetics — tidypopgen-package","title":"tidypopgen: Tidy Population Genetics — tidypopgen-package","text":"provide tidy grammar population genetics, facilitating manipulation analysis data biallelic single nucleotide polymorphisms (SNPs).","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidypopgen-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"tidypopgen: Tidy Population Genetics — tidypopgen-package","text":"Maintainer: Andrea Manica am315@cam.ac.uk (ORCID) Authors: Evie Carter","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_cpp.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert vcf to FBM. — vcf_to_fbm_cpp","title":"Convert vcf to FBM. — vcf_to_fbm_cpp","text":"Convert vcf file Filebacked Big Matrix (FBM) object. work even large vcf files fit memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_cpp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert vcf to FBM. — vcf_to_fbm_cpp","text":"","code":"vcf_to_fbm_cpp( vcf_path, chunk_size = NULL, backingfile = NULL, n_cores = 1, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_cpp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert vcf to FBM. — vcf_to_fbm_cpp","text":"vcf_path path vcf chunk_size chunk size use vcf loading file. NULL, best guess made. backingfile name file use backing file FBM. NULL, vcf path used. n_cores number cores use reading vcf file. Default 1.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_cpp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert vcf to FBM. — vcf_to_fbm_cpp","text":"path resulting rds file class bigSNP.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_vcfR.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","title":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","text":"Convert vcf file Filebacked Big Matrix (FBM) object. work even large vcf files fit memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_vcfR.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","text":"","code":"vcf_to_fbm_vcfR(vcf_path, chunk_size = NULL, backingfile = NULL, quiet = FALSE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_vcfR.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","text":"vcf_path path vcf chunk_size chunk size use vcf loading file backingfile name file use backing file","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_vcfR.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","text":"path resulting rds file class bigSNP.","code":""}] +[{"path":"https://evolecolgroup.github.io/tidypopgen/CODE_OF_CONDUCT.html","id":null,"dir":"","previous_headings":"","what":"Contributor Code of Conduct","title":"Contributor Code of Conduct","text":"contributors maintainers project, pledge respect people contribute reporting issues, posting feature requests, updating documentation, submitting pull requests patches, activities. committed making participation project harassment-free experience everyone, regardless level experience, gender, gender identity expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion. Examples unacceptable behavior participants include use sexual language imagery, derogatory comments personal attacks, trolling, public private harassment, insults, unprofessional conduct. Project maintainers right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct. Project maintainers follow Code Conduct may removed project team. Instances abusive, harassing, otherwise unacceptable behavior may reported opening issue contacting one project maintainers. Code Conduct adapted Contributor Covenant (https://www.contributor-covenant.org), version 1.0.0, available https://contributor-covenant.org/version/1/0/0/.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to tidypopgen","title":"Contributing to tidypopgen","text":"document outlines contribute development tidypopgen. package maintained voluntary basis, help always appreciated.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"the-basic-process-of-contributing","dir":"","previous_headings":"","what":"The basic process of contributing","title":"Contributing to tidypopgen","text":"Development work tidypopgen occurs dev branch. , want propose changes, work dev. Start forking project onto github repository, make changes directly fork (either dev branch, make custom branch). updating documentation checking tests pass (see ), start Pull Request. proposed changes reviewed, might asked fix/improve code. can iterative process, requiring rounds revision depending complexity code. Functions documented using roxygen. changes affects documentation , rebuild . root directory package, simply run: implemented new functionality, patched bug, consider whether add appropriate unit test. tidypopgen uses testthat framework unit tests. make sure tests work : Finally, submit push request, check changes don’t break build. can check, also builds vignette runs tests.: Make sure resolved warnings notes raised devtools::check()! followed 3 steps, ready make Pull Request. changes go automatic continuous integration, check impact changes multiple platforms. everything goes well, see green tick submission.","code":"devtools::document() devtools::test() devtools::check()"},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to tidypopgen","text":"spot typos, spelling mistakes, grammatical errors documentation, fix directly file describes function. .R file R directory, .Rd file man directory. .Rd files automatically generated roxygen2 edited hand. recommend study first roxygen2 comments work.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"functional-changes","dir":"","previous_headings":"","what":"Functional changes","title":"Contributing to tidypopgen","text":"want make change impacts functioning tidypopgen, ’s good idea first file issue explaining mind. change meant fix bug, add minimal reprex. good reprex also perfect starting point writing unit test, accompany functional change code. Unit tests also essential fixing bugs, can demonstrate fix work, prevent future changes undoing work. unit testing, use testthat; find tests tests, file dedicated function, following convention test_my_function.R naming files. creating tests, try make use built-datasets, rather adding data files package. Ideally, body Pull Request include phrase Fixes #issue-number, issue_number number Github. way, Pull Request automatically linked issue, issue closed Pull Request merged . user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html. continuous integration checks Pull Request reduce test coverage.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Functional changes","what":"Code style","title":"Contributing to tidypopgen","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. Lots commenting code helps mantainability; , doubt, always add explanation new code.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"compiling-on-mac","dir":"","previous_headings":"","what":"Compiling on Mac","title":"Contributing to tidypopgen","text":"develop Mac, need install additional software, encounter issues Clang finding correct path. information available CRAN page","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to tidypopgen","text":"Please note tidyverse project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"tidy-data-in-population-genetics","dir":"Articles","previous_headings":"","what":"tidy data in population genetics","title":"Overview","text":"fundamental tenet tidy data observation row variable column, value cell. Applying logic population genetic data means individual row, individual metadata (population, sex, phenotype, etc) variables. Genotypes locus can also thought variables, however, due large number loci restricted values genotype can take, inefficient store individual standard columns. tidypopgen, represent data gen_tbl, subclass tibble three compulsory columns: id individual (character, must unique individual), population giving population individuals belong (character), genotypes (stored compressed format File-Backed Matrix, vector tibble providing row indices matrix individual). real data reside disk, attribute bigsnp genotype column contains information access . also additional attribute , loci provides information loci, including column indices represent locus FBM. vector row indices table loci can subsetted reordered without changing data disk; thus, operation gen_tibble fast shapes indices genotype matrix rather matrix . loci tibble includes columns big_index index FBM, name locus name (character, must unique), chromosome chromosome (integer, known, otherwise set NA), position position chromosome (integer, known, otherwise set NA), genetic_dist genetic distance chromosome (numeric, known, else set 0) allele_ref reference allele (character), allele_alt alternate allele (character, can 0 monomorphic loci, following convention plink). Additional individual metadata can stored columns main gen_tbl, whilst additional loci information (position centimorgans) can added columns loci attribute table. principle, possible use use multiple ways compress genotypes. tidypopgen currently uses bigSNP object package bigsnpr. fast well documented, mostly geared towards diploid data. tidypopgen expands object deal different levels ploidy, including multiple ploidy within single dataset; however, functions currently incompatible ploidy levels 2 (return clear error message avoid computing anything incorrectly).","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"the-gen_tibble","dir":"Articles","previous_headings":"The grammar of population genetics","what":"The gen_tibble","title":"Overview","text":"Given information individuals, genotypes, loci: can create simple gen_tibble object (class gen_tbl) : provided information three files underlying genotype information stored. don’t want keep files, used tmp directory; normally want use working directory files cleared R end session. important files deleted moved, gen_tibble stores paths future use. Now let’s look gen_tibble: discussed , tibble, genotypes contains indices individuals FBM values, FBM attribute. retrieve genotypes (compressed FBM), use: want extract information loci genotypes (stored attribute column), say: Note , passing gen_tibble function works genotypes, generally necessary pass column genotypes call: However, function used within dplyr verb mutate, need pass genotype column function: , simply:","code":"library(tidypopgen) #> Loading required package: dplyr #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union #> Loading required package: tibble example_indiv_meta <- data.frame (id=c(\"a\",\"b\",\"c\",\"d\",\"e\"), population = c(\"pop1\",\"pop1\",\"pop2\",\"pop2\",\"pop2\")) example_genotypes <- rbind(c(1, 1, 0, 1, 1, 0), c(2, 0, 0, 0,NA, 0), c(1, 2, 0, 0, 1, 1), c(0, 2, 0, 1, 2, 1), c(1, 1,NA, 2, 1, 0)) example_loci <- data.frame(name=c(\"rs1\",\"rs2\",\"rs3\",\"rs4\",\"x1\",\"x2\"), chromosome=c(1,1,1,1,2,2), position=c(3,5,65,343,23,456), genetic_dist = c(0,0,0,0,0,0), allele_ref = c(\"A\",\"T\",\"C\",\"G\",\"C\",\"T\"), allele_alt = c(\"T\",\"C\", NA,\"C\",\"G\",\"A\")) example_gt <- gen_tibble(example_genotypes, indiv_meta = example_indiv_meta, loci=example_loci, backingfile = tempfile()) #> #> gen_tibble saved to /tmp/Rtmpw9DdD6/file1e84387848a.gt #> using bigSNP file: /tmp/Rtmpw9DdD6/file1e84387848a.rds #> with backing file: /tmp/Rtmpw9DdD6/file1e84387848a.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/Rtmpw9DdD6/file1e84387848a.gt') example_gt #> # A gen_tibble: 6 loci #> # A tibble: 5 × 3 #> id population genotypes #> #> 1 a pop1 1 #> 2 b pop1 2 #> 3 c pop2 3 #> 4 d pop2 4 #> 5 e pop2 5 example_gt %>% show_genotypes() #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 1 1 0 1 1 0 #> [2,] 2 0 0 0 NA 0 #> [3,] 1 2 0 0 1 1 #> [4,] 0 2 0 1 2 1 #> [5,] 1 1 NA 2 1 0 example_gt %>% show_loci() #> # A tibble: 6 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 1 rs1 1 3 0 A T 1 #> 2 2 rs2 1 5 0 T C 1 #> 3 3 rs3 1 65 0 C NA 1 #> 4 4 rs4 1 343 0 G C 1 #> 5 5 x1 2 23 0 C G 2 #> 6 6 x2 2 456 0 T A 2 example_gt %>% indiv_het_obs() #> [1] 0.6666667 0.0000000 0.5000000 0.3333333 0.6000000 example_gt %>% mutate (het_obs = indiv_het_obs(.data$genotypes)) #> # A gen_tibble: 6 loci #> # A tibble: 5 × 4 #> id population genotypes het_obs #> #> 1 a pop1 1 0.667 #> 2 b pop1 2 0 #> 3 c pop2 3 0.5 #> 4 d pop2 4 0.333 #> 5 e pop2 5 0.6 example_gt %>% mutate (het_obs = indiv_het_obs(genotypes)) #> # A gen_tibble: 6 loci #> # A tibble: 5 × 4 #> id population genotypes het_obs #> #> 1 a pop1 1 0.667 #> 2 b pop1 2 0 #> 3 c pop2 3 0.5 #> 4 d pop2 4 0.333 #> 5 e pop2 5 0.6"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"standard-dplyr-verbs-to-manipulate-the-tibble","dir":"Articles","previous_headings":"","what":"Standard dplyr verbs to manipulate the tibble","title":"Overview","text":"individual metadata can processed usual tidyverse grammar. , can filter individuals population number functions compute population genetics quantities individual, individual observed heterozygosity. can compute simply : filtering: can use mutate add observed heterozygosity column gen_tibble (, note functions work genotypes don’t need passed arguments tibble passed directly , column genotypes provided used within dplyr verbs mutate): number functions estimate quantities individual level, prefixed indiv_.","code":"example_pop1 <- example_gt %>% filter (population==\"pop2\") example_pop1 #> # A gen_tibble: 6 loci #> # A tibble: 3 × 3 #> id population genotypes #> #> 1 c pop2 3 #> 2 d pop2 4 #> 3 e pop2 5 example_gt %>% indiv_het_obs() #> [1] 0.6666667 0.0000000 0.5000000 0.3333333 0.6000000 example_gt %>% filter (population==\"pop2\") %>% indiv_het_obs() #> [1] 0.5000000 0.3333333 0.6000000 example_gt %>% mutate(het_obs = indiv_het_obs(genotypes)) #> # A gen_tibble: 6 loci #> # A tibble: 5 × 4 #> id population genotypes het_obs #> #> 1 a pop1 1 0.667 #> 2 b pop1 2 0 #> 3 c pop2 3 0.5 #> 4 d pop2 4 0.333 #> 5 e pop2 5 0.6"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"using-verbs-on-loci","dir":"Articles","previous_headings":"","what":"Using verbs on loci","title":"Overview","text":"Since genotypes loci stored compressed list one column, possible use standard dplyr verbs . However, tidypopgen provides number specialised verbs, postfixed _loci, manipulate loci. key operation loci selection (removal). compressed nature genotypes imposes constraints possible grammar. selection, two verbs: select_loci select_loci_if. select_loci understands concise-minilanguage spoken standard dplyr::select allows easily refer variables names. However, select_loci criteria can based actual genotypes (e.g. heterozygosity missingness). , use select_loci_if, can operate genotypes blind names loci. Let us start looking loci names simple dataset: can see two categories loci, one starting “rs” “x”. wanted select loci “rs” code, use: gives us gen_tibble 4 loci, expected. can confirm correct loci : Let us check indeed impacted individual heterozygosity can also subset reorder passing indices: operation helpful merging datasets fully overlap loci (later). limit select_loci can directly summarise genotypes. can separately feed result set indices. example, might want impose minimum minor allele frequency. loci_maf() allows us inspect minimum allele frequencies gen_tibble: can now create vector indices loci minimum allele frequency (MAF) larger 0.2, use select: Note passing variable directly select deprecated, use all_of wrap . select_loci_if allows us avoid creating temporary variable store indices: Note , need tidy evaluate loci_maf within select_loci_if verb, need provide column want use (even though genotypes). Also note , select_loci_if, can reorder loci. select_loci_if flexible; example, filter loci MAF greater 0.2 also chromosome 2. can use similar approach select alleles given chromosome: Incidentally, loci_maf() one several functions compute quantities locus; can identified start loci_.","code":"loci_names(example_gt) #> [1] \"rs1\" \"rs2\" \"rs3\" \"rs4\" \"x1\" \"x2\" example_sub <- example_gt %>% select_loci (starts_with(\"rs\")) example_sub #> # A gen_tibble: 4 loci #> # A tibble: 5 × 3 #> id population genotypes #> #> 1 a pop1 1 #> 2 b pop1 2 #> 3 c pop2 3 #> 4 d pop2 4 #> 5 e pop2 5 loci_names(example_sub) #> [1] \"rs1\" \"rs2\" \"rs3\" \"rs4\" example_sub %>% indiv_het_obs() #> [1] 0.5000000 0.0000000 0.1666667 0.1666667 0.4000000 example_gt %>% select_loci (c(2,6,1)) %>% show_loci() #> # A tibble: 3 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 2 rs2 1 5 0 T C 1 #> 2 6 x2 2 456 0 T A 2 #> 3 1 rs1 1 3 0 A T 1 example_gt %>% select_loci (c(2,6,1)) %>% show_genotypes() #> [,1] [,2] [,3] #> [1,] 1 0 1 #> [2,] 0 0 2 #> [3,] 2 1 1 #> [4,] 2 1 0 #> [5,] 1 0 1 example_gt %>% loci_maf() #> [1] 0.500 0.400 0.000 0.400 0.375 0.200 sel_indices <- which((example_gt %>% loci_maf())>0.2) example_gt %>% select_loci (all_of(sel_indices)) %>% show_loci() #> # A tibble: 4 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 1 rs1 1 3 0 A T 1 #> 2 2 rs2 1 5 0 T C 1 #> 3 4 rs4 1 343 0 G C 1 #> 4 5 x1 2 23 0 C G 2 example_gt_sub <- example_gt %>% select_loci_if(loci_maf(genotypes)>0.2) example_gt_sub %>% show_genotypes() #> [,1] [,2] [,3] [,4] #> [1,] 1 1 1 1 #> [2,] 2 0 0 NA #> [3,] 1 2 0 1 #> [4,] 0 2 1 2 #> [5,] 1 1 2 1 example_gt %>% select_loci_if(loci_chromosomes(genotypes)==2 & loci_maf(genotypes)>0.2) %>% show_loci() #> # A tibble: 1 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 5 x1 2 23 0 C G 2"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"grouping-individuals-in-populations","dir":"Articles","previous_headings":"","what":"Grouping individuals in populations","title":"Overview","text":"population genetics, generally interested computing quantities describe groups individuals (.e. populations). Grouping can used number ways. starting point, can group population get pop sizes: functions return one result per individual (indiv_het_obs used ), can use summarise, returns new tibble one line per population. example, can count number individuals per population, well mean heterozygosity : However, note somewhat inefficient, computing pop averages requires multiple access data. efficient approach : way, compute individual heterozygosities one go (optimising file access time), generate population summaries. functions return quantity per locus (e.g. loci_maf), can use group_by together group_map apply functions populations: details syntax group_map, see help page. functions, loci_maf(), also method grouped tibbles allows even easier syntax: reality, grouped methods nothing wrapper appropriate group_map syntax, make life little bit simpler. Certain metrics analyses naturally defined grouped tibble refer populations, distance metrics among populations. example: type functions prefixed pop.","code":"example_gt %>% group_by(population) %>% tally() #> # A tibble: 2 × 2 #> population n #> #> 1 pop1 2 #> 2 pop2 3 example_gt %>% group_by(population) %>% summarise(n= n(), mean_het = mean(indiv_het_obs(genotypes))) #> # A tibble: 2 × 3 #> population n mean_het #> #> 1 pop1 2 0.333 #> 2 pop2 3 0.478 example_gt %>% mutate(het_obs = indiv_het_obs(genotypes)) %>% group_by(population) %>% summarise(n= n(), mean_het = mean(het_obs)) #> # A tibble: 2 × 3 #> population n mean_het #> #> 1 pop1 2 0.333 #> 2 pop2 3 0.478 example_gt %>% group_by(population) %>% group_map(.f = ~loci_maf(.x)) #> [[1]] #> [1] 0.25 0.25 0.00 0.25 0.50 0.00 #> #> [[2]] #> [1] 0.3333333 0.1666667 0.0000000 0.5000000 0.3333333 0.3333333 example_gt %>% group_by(population) %>% loci_maf() #> [[1]] #> [1] 0.25 0.25 0.00 0.25 0.50 0.00 #> #> [[2]] #> [1] 0.3333333 0.1666667 0.0000000 0.5000000 0.3333333 0.3333333 # not reimplemented yet! example_gt %>% group_by(population) %>% pairwise_pop_fst() #> Whilst this function should work, it has not been extensively tested. Check your results to ensure they make sense #> # A tibble: 1 × 3 #> population_1 population_2 value #> #> 1 pop1 pop2 0.0258"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"saving-and-reading-data","dir":"Articles","previous_headings":"","what":"Saving and reading data","title":"Overview","text":"can save gen_tibble gt_save(). command save file extension .gt. Together .rds .bk files, .gt file include information stored gen_tibble. Note , whilst .rds .bk file share name, .gt file can named differently (, default, specific name given, gt_save use pattern .rds .bk file). , let us save file: ever need retrieve location .bk .rds files gen_tibble, can use: later session, reload data : can see genotypes recovered correctly. saw beginning vignette, possible create gen_tibble data data.frames tibbles. can use function wrangle small datasets custom formats, commonly SNP data stored PLINK bed files VCF files. gen_tibble can directly read types files (including gzipped vcf files), just need provide path file first argument gen_tibble; example, want read PLINK bed file, can simply use: vignette, don’t want keep files, using temporary path backing files, normal instances, can simply omit backingfile parameter, .rds .bk file saved name path original .bed file. can also export data various formats family functions gt_as_*(). functions, gt_as_hierfstat(), gt_as_genind() gt_as_genlight() return object appropriate type; functions, gt_as_plink() gt_as_geno_lea() write file appropriate format, return name file completion. example, export PLINK .bed file, simply use: also write .bim .fam file save together .bed file. Note , main tibble, id, population sex preserved .fam file. also possible write .ped .raw files specifying type=\"ped\" type=\"raw\" gt_as_plink() (see help page gt_as_plink() details).","code":"gt_file_name <- gt_save(example_gt) #> #> gen_tibble saved to /tmp/Rtmpw9DdD6/file1e84387848a.gt #> using bigSNP file: /tmp/Rtmpw9DdD6/file1e84387848a.rds #> with backing file: /tmp/Rtmpw9DdD6/file1e84387848a.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/Rtmpw9DdD6/file1e84387848a.gt') gt_file_name #> [1] \"/tmp/Rtmpw9DdD6/file1e84387848a.gt\" \"/tmp/Rtmpw9DdD6/file1e84387848a.rds\" #> [3] \"/tmp/Rtmpw9DdD6/file1e84387848a.bk\" gt_get_file_names(example_gt) #> [1] \"/tmp/Rtmpw9DdD6/file1e84387848a.rds\" \"/tmp/Rtmpw9DdD6/file1e84387848a.bk\" new_example_gt <- gt_load(gt_file_name[1]) new_example_gt %>% show_genotypes() #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 1 1 0 1 1 0 #> [2,] 2 0 0 0 NA 0 #> [3,] 1 2 0 0 1 1 #> [4,] 0 2 0 1 2 1 #> [5,] 1 1 NA 2 1 0 bed_path_pop_a <- system.file(\"extdata/pop_a.bed\", package = \"tidypopgen\") pop_a_gt <- gen_tibble(bed_path_pop_a, backingfile = tempfile(\"pop_a_\")) #> #> gen_tibble saved to /tmp/Rtmpw9DdD6/pop_a_1e845eb44469.gt #> using bigSNP file: /tmp/Rtmpw9DdD6/pop_a_1e845eb44469.rds #> with backing file: /tmp/Rtmpw9DdD6/pop_a_1e845eb44469.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/Rtmpw9DdD6/pop_a_1e845eb44469.gt') gt_as_plink(example_gt, file = tempfile(\"new_bed_\")) #> [1] \"/tmp/Rtmpw9DdD6/new_bed_1e8446591f04.bed\""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"merging-data","dir":"Articles","previous_headings":"","what":"Merging data","title":"Overview","text":"Merging data different sources common problem, especially human population genetics wealth SNP chips available. tidypopgen, merging enacted rbind operation gen_tibbles. datasets loci, merge trivial. , necessary subset loci, ensure data coded reference alternate alleles (swap needed). Additionally, data come SNP chips, added complication strand always consistent, might also necessary flip strand (case, ambiguous SNPs filtered). rbind method gen_tibbles number parameters allow us control behaviour merge. Let us start bringing two sample datasets (note use tempfiles store data; real applications, usually avoid defining backingfile let function create backing files bed file stored): inspect : one: using small datasets, real life, rbind operations demanding. performing operation, can run rbind_dry_run: Note , default, rbind flip strand remove ambiguous SNPs (relevant merging different SNP chips), need set flip_strand TRUE. report object contains details locus either kept removed, usually report sufficient make decisions whether want go ahead. happy likely outcome, can proceed rbind. Note data saved disk. can either provide path prefix, ‘.RDS’ ‘.bk’ appended bigSNP file backing file; let function save files path original backing file first object). NOTE: vignette, save temporary directory, real life want save directory able retrieve file later date!!! Let’s check resulting gen_tibble: Note values genotype column (corresponds id FBM file) changed reflect new, larger FBM datasets. can look subsetted loci (note used first population reference determine strand order alleles): , note big_index values changed compared original files, generated new FBM merged data. default, rbind using loci names match two datasets. option ‘use_position = TRUE’ forces matching chromosome position; note common source problems merging coding chromosomes (e.g. dataset ‘chromosome1’ ‘chr1’). using ‘use_position = TRUE’, also make sure two datasets aligned reference genome assembly.","code":"bed_path_pop_a <- system.file(\"extdata/pop_a.bed\", package = \"tidypopgen\") bigsnp_path_a <- bigsnpr::snp_readBed(bed_path_pop_a, backingfile = tempfile(\"pop_a_\")) pop_a_gt <- gen_tibble(bigsnp_path_a) #> #> gen_tibble saved to /tmp/Rtmpw9DdD6/pop_a_1e844950b6e2.gt #> using bigSNP file: /tmp/Rtmpw9DdD6/pop_a_1e844950b6e2.rds #> with backing file: /tmp/Rtmpw9DdD6/pop_a_1e844950b6e2.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/Rtmpw9DdD6/pop_a_1e844950b6e2.gt') bed_path_pop_b <- system.file(\"extdata/pop_b.bed\", package = \"tidypopgen\") bigsnp_path_b <- bigsnpr::snp_readBed(bed_path_pop_b, backingfile = tempfile(\"pop_b_\")) pop_b_gt <- gen_tibble(bigsnp_path_b) #> #> gen_tibble saved to /tmp/Rtmpw9DdD6/pop_b_1e842df68a88.gt #> using bigSNP file: /tmp/Rtmpw9DdD6/pop_b_1e842df68a88.rds #> with backing file: /tmp/Rtmpw9DdD6/pop_b_1e842df68a88.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/Rtmpw9DdD6/pop_b_1e842df68a88.gt') pop_a_gt #> # A gen_tibble: 16 loci #> # A tibble: 5 × 3 #> id population genotypes #> #> 1 GRC24 pop_a 1 #> 2 GRC25 pop_a 2 #> 3 GRC26 pop_a 3 #> 4 GRC27 pop_a 4 #> 5 GRC28 pop_a 5 pop_b_gt #> # A gen_tibble: 17 loci #> # A tibble: 3 × 3 #> id population genotypes #> #> 1 SL088 pop_b 1 #> 2 SL1329 pop_b 2 #> 3 SL1108 pop_b 3 report <- rbind_dry_run(pop_a_gt, pop_b_gt, flip_strand = TRUE) #> harmonising loci between two datasets #> flip_strand = TRUE ; remove_ambiguous = TRUE #> ----------------------------- #> dataset: reference #> number of SNPs: 16 reduced to 12 #> ( 2 are ambiguous, of which 2 were removed) #> ----------------------------- #> dataset: target #> number of SNPs: 17 reduced to 12 #> ( 5 were flipped to match the reference set) #> ( 2 are ambiguous, of which 2 were removed) # #create merge merged_gt <- rbind(pop_a_gt, pop_b_gt, flip_strand = TRUE, backingfile = file.path(tempdir(),\"gt_merged\")) #> harmonising loci between two datasets #> flip_strand = TRUE ; remove_ambiguous = TRUE #> ----------------------------- #> dataset: reference #> number of SNPs: 16 reduced to 12 #> ( 2 are ambiguous, of which 2 were removed) #> ----------------------------- #> dataset: target #> number of SNPs: 17 reduced to 12 #> ( 5 were flipped to match the reference set) #> ( 2 are ambiguous, of which 2 were removed) #> #> gen_tibble saved to /tmp/Rtmpw9DdD6/gt_merged.gt #> using bigSNP file: /tmp/Rtmpw9DdD6/gt_merged.rds #> with backing file: /tmp/Rtmpw9DdD6/gt_merged.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/Rtmpw9DdD6/gt_merged.gt') merged_gt #> # A gen_tibble: 12 loci #> # A tibble: 8 × 3 #> id population genotypes #> #> 1 GRC24 pop_a 1 #> 2 GRC25 pop_a 2 #> 3 GRC26 pop_a 3 #> 4 GRC27 pop_a 4 #> 5 GRC28 pop_a 5 #> 6 SL088 pop_b 6 #> 7 SL1329 pop_b 7 #> 8 SL1108 pop_b 8 merged_gt %>% show_loci() #> # A tibble: 12 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt #> #> 1 1 rs3094315 1 752566 0 A G #> 2 2 rs3131972 1 752721 0 G A #> 3 3 rs12124819 1 776546 0 A G #> 4 4 rs11240777 1 798959 0 G A #> 5 5 rs1110052 1 873558 0 G T #> 6 6 rs6657048 1 957640 0 C T #> 7 7 rs2488991 1 994391 0 T G #> 8 8 rs2862633 2 61974443 0 G A #> 9 9 rs28569024 2 139008811 0 T C #> 10 10 rs10106770 2 235832763 0 G A #> 11 11 rs11942835 3 155913651 0 T C #> 12 12 rs5945676 23 51433071 0 T G #> # ℹ 1 more variable: chr_int "},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a01_overview.html","id":"imputation","dir":"Articles","previous_headings":"","what":"Imputation","title":"Overview","text":"Many genetic analysis (e.g. PCA) allow missing data. many software implementations, missing gentoypes imputed fly, often simplistic manner. tidypopgen, encourage taking step explicitly, running analysis. Let us start dataset missing genotypes: can visualise amount missingness : attempt run PCA dataset, get: Note using gt_pca_autoSVD small dataset likely cause error, see manual page details. possible obviate problem filtering loci missing data, might lose lot loci. alternative impute missing data. tidypopgen provides wrappers two fast imputation approaches available bigsnpr, simple imputation (gt_impute_simple) based frequency alleles locus (random sampling, using mean mode), sophisticated approach (gt_impute_xgboost) uses boosted trees try predict likely genotype. methods fine impute missing genotypes, used sophisticated imputation (e.g. low coverage genomes). use simple approach fix dataset: can now check dataset indeed imputed: However, note gen_tibble stores raw data imputed data. Even imputation, imputed data used default: indeed, summarise missingness, still get: can manually force gen_tibble use imputed data: However, generally needed, can keep gen_tibble set use raw data: let functions need imputation use automatically: Note , function finished, gen_tibble back using raw genotypes: details PCA analysis found vignette population genetic analysis.","code":"bed_file <- system.file(\"extdata\", \"example-missing.bed\", package = \"bigsnpr\") missing_gt <- gen_tibble(bed_file, backingfile = tempfile(\"missing_\")) #> #> gen_tibble saved to /tmp/Rtmpw9DdD6/missing_1e8416d6b7c2.gt #> using bigSNP file: /tmp/Rtmpw9DdD6/missing_1e8416d6b7c2.rds #> with backing file: /tmp/Rtmpw9DdD6/missing_1e8416d6b7c2.bk #> make sure that you do NOT delete those files! #> to reload the gen_tibble in another session, use: #> gt_load('/tmp/Rtmpw9DdD6/missing_1e8416d6b7c2.gt') missing_gt #> # A gen_tibble: 500 loci #> # A tibble: 200 × 3 #> id population genotypes #> #> 1 ind_1 fam_1 1 #> 2 ind_2 fam_2 2 #> 3 ind_3 fam_3 3 #> 4 ind_4 fam_4 4 #> 5 ind_5 fam_5 5 #> 6 ind_6 fam_6 6 #> 7 ind_7 fam_7 7 #> 8 ind_8 fam_8 8 #> 9 ind_9 fam_9 9 #> 10 ind_10 fam_10 10 #> # ℹ 190 more rows missing_gt %>% loci_missingness() %>% hist() missing_pca <- missing_gt %>% gt_pca_autoSVD() #> Error: You can't have missing values in 'G'. missing_gt <- gt_impute_simple(missing_gt, method = \"mode\") gt_has_imputed(missing_gt) #> [1] TRUE gt_uses_imputed(missing_gt) #> [1] FALSE missing_gt %>% loci_missingness() %>% hist() gt_set_imputed(missing_gt, set = TRUE) missing_gt %>% loci_missingness() %>% hist() gt_set_imputed(missing_gt, set = FALSE) missing_gt %>% loci_missingness() %>% hist() missing_pca <- missing_gt %>% gt_pca_partialSVD() missing_pca #> === PCA of gen_tibble object === #> Method: [1] \"partialSVD\" #> #> Call ($call):gt_pca_partialSVD(x = .) #> #> Eigenvalues ($d): #> 146.859 106.219 90.352 80.983 69.332 68.427 ... #> #> Principal component scores ($u): #> matrix with 200 rows (individuals) and 10 columns (axes) #> #> Loadings (Principal axes) ($v): #> matrix with 500 rows (SNPs) and 10 columns (axes) gt_uses_imputed(missing_gt) #> [1] FALSE missing_gt %>% loci_missingness() %>% hist()"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"quality-control-for-snp-datasets","dir":"Articles","previous_headings":"","what":"Quality control for SNP datasets","title":"Quality Control","text":"tidypopgen two key functions examine quality data across loci across individuals: qc_report_loci qc_report_indiv. vignette uses simulated data set illustrate methods data cleaning.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"read-data-into-gen_tibble-format","dir":"Articles","previous_headings":"","what":"Read data into gen_tibble format","title":"Quality Control","text":"#Quality control individuals output qc_report_indiv supplies observed heterozygosity per individual, rate missingness per individual standard. data can also visualised using autoplot: can see individuals low missingness. wanted filter individuals remove 4.5% genotypes missing, can use filter. wanted remove outliers particularly high low heterozygosity, can using filter. example, remove observations lie 3 standard deviations mean. Next, can look relatedness within sample. parameter kings_threshold provided qc_report_indiv(), report also calculates KING coefficient relatedness matrix using sample. kings_threshold used provide output largest possible group related individuals third column to_keep. boolean column recommends individuals remove (FALSE) keep (TRUE) achieve unrelated sample. can remove recommended individuals using: can now view summary cleaned data set , showing data reduced 12 9 individuals.","code":"library(tidypopgen) ## Loading required package: dplyr ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union ## Loading required package: tibble data <- gen_tibble(system.file(\"extdata/related/families.bed\", package=\"tidypopgen\"), quiet = TRUE, backingfile = tempfile(), valid_alleles = c(\"1\",\"2\")) individual_report <- qc_report_indiv(data) summary(individual_report) ## het_obs missingness ## Min. :0.3467 Min. :0.03018 ## 1st Qu.:0.3736 1st Qu.:0.03642 ## Median :0.3790 Median :0.03798 ## Mean :0.3799 Mean :0.03867 ## 3rd Qu.:0.3901 3rd Qu.:0.04110 ## Max. :0.4015 Max. :0.04579 autoplot(individual_report) data <- data %>% filter(indiv_missingness(genotypes)<0.045) nrow(data) ## [1] 10 mean_val <- mean(individual_report$het_obs) sd_val <- stats::sd(individual_report$het_obs) lower <- mean_val - 3*(sd_val) upper <- mean_val + 3*(sd_val) data <- data %>% filter(indiv_het_obs(genotypes) > lower) data <- data %>% filter(indiv_het_obs(genotypes) < upper) nrow(data) ## [1] 10 individual_report <- qc_report_indiv(data, kings_threshold = 0.177) summary(individual_report) ## het_obs missingness to_keep id ## Min. :0.3467 Min. :0.03018 Mode :logical Min. : 1.00 ## 1st Qu.:0.3757 1st Qu.:0.03642 FALSE:1 1st Qu.: 4.25 ## Median :0.3790 Median :0.03746 TRUE :9 Median : 6.50 ## Mean :0.3812 Mean :0.03725 Mean : 6.60 ## 3rd Qu.:0.3957 3rd Qu.:0.04006 3rd Qu.: 9.50 ## Max. :0.4015 Max. :0.04266 Max. :12.00 data <- data %>% filter(id %in% individual_report$id & individual_report$to_keep == TRUE) summary(data) ## id genotypes ## Min. : 1 Length:9 ## 1st Qu.: 4 Class :character ## Median : 6 Mode :character ## Mean : 6 ## 3rd Qu.: 8 ## Max. :11"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"quality-control-for-loci","dir":"Articles","previous_headings":"","what":"Quality control for loci","title":"Quality Control","text":"output qc_report_loci supplies minor allele frequency, rate missingness, Hardy-Weinberg exact p-value SNP. data can visualised autoplot : Using ‘overview’ provides Upset plot, designed show intersection different sets way Venn diagram. SNPs can divided ‘sets’ pass predefined quality control threshold; set SNPs missingness given threshold, set SNPs MAF given threshold, set SNPs Hardy-Weinberg exact p-value falls given significance level. thresholds parameter, (percentage missingness accepted, minor allele frequency cutoff, Hardy-Weinberg equilibrium p-value) can adjusted using parameters provided autoplot. example: upset plot visualises 961 SNPs within respective sets. number second bar indicates 262 SNPs occur 3 sets, meaning 262 SNPs pass QC thresholds. combined total first second bars represents number SNPs pass MAF HWE thresholds, 939 SNPs. examine QC measure detail, can plot different summary panel. can begin consider quality control raw data set. Let’s start filtering SNPs according minor allele frequency. can visualise MAF distribution using: can see monomorphic SNPs data set. Let’s filter loci minor allele frequency lower 2%, using select_loci_if. , select SNPs MAF greater 2%. operation equivalent plink –maf 0.02. Following , can remove SNPs high rate missingness. Lets say want remove SNPs missing 5% individuals, equivalent using plink –geno 0.05 can see SNPs low missingness, 5% threshold, , however, missingness threshold. remove SNPs, can use select_loci_if. Finally, may want remove SNPs show significant deviation Hardy-Weinberg equilibrium, study design requires. visualise SNPs significant p-values Hardy-Weinberg exact test, can call autoplot: None SNPs data significant, however may circumstances want cut extreme cases, data real, cases indicate genotyping errors.","code":"loci_report <- qc_report_loci(data) summary(loci_report) ## snp_id maf missingness hwe_p ## Min. : 1 Min. :0.0000 Min. :0.00000 Min. :0.00144 ## 1st Qu.:241 1st Qu.:0.1667 1st Qu.:0.00000 1st Qu.:0.35500 ## Median :481 Median :0.2778 Median :0.00000 Median :0.52941 ## Mean :481 Mean :0.2682 Mean :0.03723 Mean :0.50607 ## 3rd Qu.:721 3rd Qu.:0.3889 3rd Qu.:0.11111 3rd Qu.:0.67059 ## Max. :961 Max. :0.5000 Max. :0.33333 Max. :0.76964 autoplot(loci_report, type = \"overview\") autoplot(loci_report, type = \"overview\", miss_threshold = 0.03, maf_threshold = 0.02, hwe_p = 0.01) autoplot(loci_report, type = \"all\", miss_threshold = 0.03, maf_threshold = 0.02, hwe_p = 0.01) autoplot(loci_report, type = \"maf\") data <- data %>% select_loci_if(loci_maf(genotypes)>0.02) count_loci(data) ## [1] 941 autoplot(loci_report, type = \"missing\", miss_threshold = 0.05) data <- data %>% select_loci_if(loci_missingness(genotypes)<0.05) count_loci(data) ## [1] 679 autoplot(loci_report,type = \"significant hwe\", hwe_p = 0.01) data <- data %>% select_loci_if(loci_hwe(genotypes)>0.01) count_loci(data) ## [1] 677"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"linkage-disequilibrium","dir":"Articles","previous_headings":"","what":"Linkage Disequilibrium","title":"Quality Control","text":"analyses, may necessary control linkage data set. tidypopgen provides LD clumping. option similar –indep-pairwise flag plink, results even distribution loci compared LD pruning. explore clumping preferable pruning, see https://privefl.github.io/bigsnpr/articles/pruning-vs-clumping.html LD clumping requires data set missingness. means need create imputed data set LD pruning, can quickly gt_impute_simple. example, want remove SNPs correlation greater 0.2 windows 10 SNPs time, can set parameters thr_r2 size respectively. loci_ld_clump provides boolean vector length list SNPs, telling us keep data set. can use list create pruned version data:","code":"imputed_data <- gt_impute_simple(data, method = \"random\") to_keep_LD <- loci_ld_clump(imputed_data, thr_r2 = 0.2, size = 10) head(to_keep_LD) ## [1] FALSE FALSE FALSE FALSE FALSE FALSE ld_data <- imputed_data %>% select_loci_if(loci_ld_clump(genotypes, thr_r2 = 0.2, size = 10))"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"save","dir":"Articles","previous_headings":"","what":"Save","title":"Quality Control","text":"benefit operating gen_tibble quality control step can observed visually, easily reversed necessary. happy quality data, can create save final quality controlled version gen_tibble using gt_save.","code":"gt_save(ld_data, file_name = tempfile()) ## ## gen_tibble saved to /tmp/RtmpjyR3xY/file1ed5274867b3.gt ## using bigSNP file: /tmp/RtmpjyR3xY/file1ed5766ee7e3.rds ## with backing file: /tmp/RtmpjyR3xY/file1ed5766ee7e3.bk ## make sure that you do NOT delete those files! ## to reload the gen_tibble in another session, use: ## gt_load('/tmp/RtmpjyR3xY/file1ed5274867b3.gt') ## [1] \"/tmp/RtmpjyR3xY/file1ed5274867b3.gt\" ## [2] \"/tmp/RtmpjyR3xY/file1ed5766ee7e3.rds\" ## [3] \"/tmp/RtmpjyR3xY/file1ed5766ee7e3.bk\""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"grouping-data","dir":"Articles","previous_headings":"","what":"Grouping data","title":"Quality Control","text":"quality control measures, gen_tibble includes multiple datasets may want group population running quality control. can done using group_by. First, lets add imaginary population data gen_tibble: can group population run quality control group: loci report receive calculate Hardy-Weinberg equilibrium SNP within population separately, providing Bonferroni corrected p-value SNP. Similarly, can run quality control report individuals within population: important related individuals, background population structure can affect filtering relatives.","code":"data <- data %>% mutate(population = c(rep(\"A\", 4), rep(\"B\", 5))) grouped_loci_report <- data %>% group_by(population) %>% qc_report_loci() head(grouped_loci_report) ## # A tibble: 6 × 4 ## snp_id maf missingness hwe_p ## ## 1 2 0.389 0 1 ## 2 3 0.167 0 1 ## 3 5 0.278 0 0.4 ## 4 7 0.333 0 0.333 ## 5 8 0.333 0 0.4 ## 6 10 0.444 0 0.492 grouped_individual_report <- data %>% group_by(population) %>% qc_report_indiv(kings_threshold = 0.177) head(grouped_individual_report) ## # A tibble: 6 × 4 ## het_obs missingness to_keep id ## ## 1 0.262 0 TRUE 1 ## 2 0.251 0 TRUE 2 ## 3 0.258 0 TRUE 4 ## 4 0.270 0 TRUE 5 ## 5 0.262 0 TRUE 6 ## 6 0.285 0 TRUE 7"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a02_qc.html","id":"grouped-functions","dir":"Articles","previous_headings":"","what":"Grouped functions","title":"Quality Control","text":"also possible run loci indiv functions grouped data. useful want run quality control group data, don’t want split data separate gen_tibbles. Grouped functions built efficiency surpass use applying function group_map.","code":"loci_maf_grouped <- data %>% group_by(population) %>% loci_maf()"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"an-example-workflow-with-real-data","dir":"Articles","previous_headings":"","what":"An example workflow with real data","title":"Example workflow with tidypopgen","text":"explore genetic structure Anolis punctatus South America, using data Prates et al 2018. downloaded vcf file genotypes “https://github.com/ivanprates/2018_Anolis_EcolEvol/blob/master/data/VCFtools_SNMF_punctatus_t70_s10_n46/punctatus_t70_s10_n46_filtered.recode.vcf?raw=true” compressed vcf.gz file. read data compressed vcf : Now let’s inspect gen_tibble: can see 46 individuals, 3249 loci. Note don’t information population vcf. information can found another file github repository (“https://github.com/ivanprates/2018_Anolis_EcolEvol/raw/master/data/plot_order_punctatus_n46.csv). add population information manually. Let’s start reading file: ids VCF different format ones just got pop csv. need bit string wrangling, looks easy, just need remove “punc_”: Let us simplify ids, “punc_” prefix Now can bring pop information:","code":"library(tidypopgen) #> Loading required package: dplyr #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union #> Loading required package: tibble vcf_path <- system.file(\"/extdata/anolis/punctatus_t70_s10_n46_filtered.recode.vcf.gz\", package = \"tidypopgen\") anole_gt <- gen_tibble(vcf_path, quiet = TRUE, backingfile = tempfile(\"anolis_\")) anole_gt #> # A gen_tibble: 3249 loci #> # A tibble: 46 × 2 #> id genotypes #> #> 1 punc_BM288 1 #> 2 punc_GN71 2 #> 3 punc_H1907 3 #> 4 punc_H1911 4 #> 5 punc_H2546 5 #> 6 punc_IBSPCRIB0361 6 #> 7 punc_ICST764 7 #> 8 punc_JFT459 8 #> 9 punc_JFT773 9 #> 10 punc_LG1299 10 #> # ℹ 36 more rows pops_path <- system.file(\"/extdata/anolis/plot_order_punctatus_n46.csv\", package = \"tidypopgen\") pops <- readr::read_csv(pops_path) #> Rows: 46 Columns: 3 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \",\" #> chr (2): ID, pop #> dbl (1): plot_order #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. pops #> # A tibble: 46 × 3 #> ID plot_order pop #> #> 1 BM288 18 Eam #> 2 GN71 21 Eam #> 3 H1907 6 Wam #> 4 H1911 4 Wam #> 5 H2546 7 Wam #> 6 IBSPCRIB0361 34 AF #> 7 ICST764 31 AF #> 8 JFT459 37 AF #> 9 JFT773 38 AF #> 10 LG1299 44 AF #> # ℹ 36 more rows anole_gt <- anole_gt %>% mutate(id = gsub('punc_',\"\",.data$id,)) anole_gt #> # A gen_tibble: 3249 loci #> # A tibble: 46 × 2 #> id genotypes #> #> 1 BM288 1 #> 2 GN71 2 #> 3 H1907 3 #> 4 H1911 4 #> 5 H2546 5 #> 6 IBSPCRIB0361 6 #> 7 ICST764 7 #> 8 JFT459 8 #> 9 JFT773 9 #> 10 LG1299 10 #> # ℹ 36 more rows anole_gt <- anole_gt %>% mutate(population = pops$pop[match(pops$ID,.data$id)]) anole_gt #> # A gen_tibble: 3249 loci #> # A tibble: 46 × 3 #> id genotypes population #> #> 1 BM288 1 Eam #> 2 GN71 2 Eam #> 3 H1907 3 Wam #> 4 H1911 4 Wam #> 5 H2546 5 Wam #> 6 IBSPCRIB0361 6 AF #> 7 ICST764 7 AF #> 8 JFT459 8 AF #> 9 JFT773 9 AF #> 10 LG1299 10 AF #> # ℹ 36 more rows"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"pca","dir":"Articles","previous_headings":"","what":"PCA","title":"Example workflow with tidypopgen","text":"easy. loci already filtered cleaned, don’t need QC. Let us jump straight analysis run PCA: OK, jumped quickly. missing data, need first impute : now: Let us look object: print function (implicitly called type name object) gives us information important elements object (names elements stored). can extract elements tidy function, returns tibble can easily used analysis, e.g.: can return information eigenvalues, scores loadings pca. also autoplot method allows visualise elements (type screeplot eigenvalues, type scores scores, loadings loadings: plot sample principal coordinates space, can simply use: autoplots deliberately kept simple: just way quickly inspect results. generate ggplot2 objects, can embellished usual ggplot2 grammar: complex/publication ready plots, want add PC scores tibble, can create custom plot ggplot2. can easily add data augment method: now can use ggplot2 directly generate plot: can see three population separate nicely PCA, just one individual Wam sitting -Wam individuals Eam. also possible inspect loci contribute given component: using information loci table, easily embellish plot, example colouring chromosome maf. complex plots, can augment loci table loadings using augment_loci():","code":"anole_pca <- anole_gt %>% gt_pca_partialSVD(k=30) #> Error: You can't have missing values in 'X'. anole_gt <- gt_impute_simple(anole_gt, method = \"mode\") anole_pca <- anole_gt %>% gt_pca_partialSVD(k=30) anole_pca #> === PCA of gen_tibble object === #> Method: [1] \"partialSVD\" #> #> Call ($call):gt_pca_partialSVD(x = ., k = 30) #> #> Eigenvalues ($d): #> 351.891 192.527 113.562 104.427 87.615 83.476 ... #> #> Principal component scores ($u): #> matrix with 46 rows (individuals) and 30 columns (axes) #> #> Loadings (Principal axes) ($v): #> matrix with 3249 rows (SNPs) and 30 columns (axes) tidy(anole_pca, matrix=\"eigenvalues\") #> # A tibble: 30 × 3 #> PC std.dev cumulative #> #> 1 1 51.9 51.9 #> 2 2 28.4 80.3 #> 3 3 16.7 97.0 #> 4 4 15.4 112. #> 5 5 12.9 125. #> 6 6 12.3 138. #> 7 7 10.2 148. #> 8 8 9.92 158. #> 9 9 9.13 167. #> 10 10 8.80 176. #> # ℹ 20 more rows autoplot(anole_pca, type=\"screeplot\") autoplot(anole_pca, type =\"scores\") library(ggplot2) autoplot(anole_pca, type = \"scores\") + aes(color = anole_gt$population) + labs(color = \"population\") anole_gt <- augment(anole_pca , data = anole_gt) anole_gt %>% ggplot(aes(.fittedPC1, .fittedPC2, color = population)) + geom_point() autoplot(anole_pca, type = \"loadings\") anole_gt_load <- augment_loci(anole_pca, data= anole_gt)"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"explore-population-structure-with-dapc","dir":"Articles","previous_headings":"","what":"Explore population structure with DAPC","title":"Example workflow with tidypopgen","text":"DAPC powerful tool investigate population structure. advantage scaling well large datasets. assumptions STRUCTURE ADMIXTURE (also limits power). first step determine number genetic clusters dataset. DAPC can either used test -priori hypothesis, can use data suggest number clusters. case, strong expectations structure study system, let data inform number possible genetic clusters. use k-clustering algorithm applied principal components (allowing us reduce dimensions thousands loci just tens components). need decide many components use; decision often made based plot cumulative explained variance components. Using tidy gt_pca object allows us easily obtain quantities, trivial plot : Note , working truncated SVD algorithm PCA, can easily phrase eigenvalues terms proportion total variance, cumulative y axis simply shows cumulative sum eigenvalues. Ideally, looking point curve starts flattening. case, can see clear flattening, PC 10 increase explained variance markedly decelerated. can now find clusters based 10 PCs: define k values explore, default 1 5 used (can change setting k parameter change range). choose appropriate k, plot number clusters measure fit. BIC shown good metric many scenarios: looking minimum value BIC. clear elbow (minimum BIC increases increasing k). However, notice quick levelling decrease BIC 3 clusters. Arguably, sufficient capture main structure (makes sense given saw PCA). can also use number algorithmic approaches (based original find.clusters() function adegenet) choose best k value plot gt_cluster_pca_best_k(). use defaults (BIC “diffNgroup”, see help page gt_cluster_pca_best_k() description various options): algorithm confirms choice. Note function simply adds element $best_k gt_cluster_pca object: decided wanted explore different value, simply overwrite number anole_clusters$best_k<-5 case, happy option 3 clusters, can run DAPC: Note gt_dapc() takes automatically number clusters anole_clusters object, can change behaviour setting parameters (see help page gt_dapc()). print object, given information important elements object find (saw gt_pca): , elements can obtained tidiers (matrix equal eigenvalues, scores,ld_loadings loci_loadings): can visualised autoplot: pca, tidy method can used extract information gt_dapc objects. example, want create bar plot eigenvalues (since two), simply use: can plot scores : can inspect assignment DAPC autoplot using type components, ordering samples original population labels: clear separation observed plotting LD scores, individual modelled mixture: assignments 100% probability single cluster. Finally, can explore loci biggest impact separating clusters (either drift selection): strong outlier, suggesting drift across many loci created signal picked DAPC. Note anole_dapc class gt_dapc, subclass dapc adegenet. means functions written work dapc objects work box (exception adegenet::predict.dapc, work underlying pca object different). example, can obtain standard dapc plot :","code":"library(ggplot2) tidy(anole_pca,matrix=\"eigenvalues\") %>% ggplot(mapping =aes(x=PC, y=cumulative)) + geom_point() anole_clusters <- gt_cluster_pca(anole_pca, n_pca = 10) autoplot(anole_clusters) anole_clusters <- gt_cluster_pca_best_k(anole_clusters) #> Using BIC with criterion diffNgroup: 3 clusters anole_clusters$best_k #> [1] 3 anole_dapc <- gt_dapc(anole_clusters) anole_dapc #> === DAPC of gen_tibble object === #> Call ($call):gt_dapc(x = anole_clusters) #> #> Eigenvalues ($eig): #> 727.414 218.045 #> #> LD scores ($ind.coord): #> matrix with 46 rows (individuals) and 2 columns (LD axes) #> #> Loadings by PC ($loadings): #> matrix with 2 rows (PC axes) and 2 columns (LD axes) #> #> Loadings by locus($var.load): #> matrix with 3249 rows (loci) and 2 columns (LD axes) tidy(anole_dapc, matrix=\"eigenvalues\") #> # A tibble: 2 × 3 #> LD eigenvalue cumulative #> #> 1 1 727. 727. #> 2 2 218. 945. autoplot(anole_dapc, type=\"screeplot\") tidy(anole_dapc, matrix=\"eigenvalues\") %>% ggplot(aes(x=LD,y=eigenvalue)) + geom_col() autoplot(anole_dapc, type=\"scores\") autoplot(anole_dapc, type=\"components\", group = anole_gt$population) autoplot(anole_dapc, \"loadings\") library(adegenet) #> Loading required package: ade4 #> #> /// adegenet 2.1.10 is loaded //////////// #> #> > overview: '?adegenet' #> > tutorials/doc/questions: 'adegenetWeb()' #> > bug reports/feature requests: adegenetIssues() scatter(anole_dapc, posi.da=\"bottomright\")"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"clustering-with-snmf","dir":"Articles","previous_headings":"","what":"Clustering with sNMF","title":"Example workflow with tidypopgen","text":"sNMF fast clustering algorithm provides results similar STRUCTURE ADMIXTURE. can run directly R. first generate file genotype data: Note .geno file placed default directory using name backing file gen_tibble Now can run K clusters k=1 k=10. use just one repeat, ideally run multiple repetitions K: can examine suitability K values plotting : can see K = 3 sensible choice, 3 represents ‘elbow’ plot. can select fastest run using: plot clusters, can begin extracting Q matrix snmf object, covert q_matrix object used tidypopgen: can quickly plot can tidy q matrix tibble, returning format suitable plotting: complex plots, can add clusters tibble, can create custom plot ggplot2. can easily add data augment method: now can use ggplot2 directly generate plot:","code":"geno_file <- gt_as_geno_lea(anole_gt) geno_file #> [1] \"/tmp/Rtmpun9qPy/anolis_1f1f194a7919.geno\" library(LEA) anole_snmf <- snmf(input.file = geno_file, K = 1:10, entropy = TRUE, repetitions = 3, alpha = 100 ) plot(anole_snmf, cex = 1.2, pch = 19) ce <- cross.entropy(anole_snmf, K = 3) quick_run <- which.min(ce) q_mat <- LEA::Q(anole_snmf, K = 3, run = quick_run) q_mat <- q_matrix(q_mat) head(q_mat) #> .Q1 .Q2 .Q3 #> [1,] 9.999e-05 9.999e-05 9.998e-01 #> [2,] 9.999e-05 9.999e-05 9.998e-01 #> [3,] 9.998e-01 9.999e-05 9.999e-05 #> [4,] 9.998e-01 9.999e-05 9.999e-05 #> [5,] 9.998e-01 9.999e-05 9.999e-05 #> [6,] 9.999e-05 9.998e-01 9.999e-05 anole_gt <- anole_gt %>% group_by(population) autoplot(q_mat, data = anole_gt, annotate_group = TRUE) tidy_q <- tidy(q_mat, anole_gt) head(tidy_q) #> # A tibble: 6 × 5 #> .Q1 .Q2 .Q3 id group #> #> 1 9.999e-05 9.999e-05 9.998e-01 BM288 Eam #> 2 9.999e-05 9.999e-05 9.998e-01 GN71 Eam #> 3 9.998e-01 9.999e-05 9.999e-05 H1907 Wam #> 4 9.998e-01 9.999e-05 9.999e-05 H1911 Wam #> 5 9.998e-01 9.999e-05 9.999e-05 H2546 Wam #> 6 9.999e-05 9.998e-01 9.999e-05 IBSPCRIB0361 AF anole_gt_sNMF <- augment(q_mat, data = anole_gt) anole_gt_sNMF <- anole_gt_sNMF %>% tidyr::pivot_longer(cols = dplyr::starts_with(\".Q\"), names_to = \"q\", values_to = \"percentage\") %>% dplyr::mutate(percentage = as.numeric(percentage)) %>% dplyr::group_by(id) %>% dplyr::mutate(dominant_q = max(percentage)) %>% dplyr::ungroup() %>% dplyr::arrange(population, dplyr::desc(dominant_q)) %>% dplyr::mutate(plot_order = dplyr::row_number(), id = factor(id, levels = unique(id))) plt <- ggplot2::ggplot(anole_gt_sNMF, ggplot2::aes(x = id, y = percentage, fill = q)) + ggplot2::geom_col(width = 1, position = ggplot2::position_stack(reverse = TRUE))+ ggplot2::labs(y = \"Population Structure for K = 3\") + theme_distruct() + scale_fill_distruct() plt"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a03_example_clustering_and_dapc.html","id":"admixture-and-handling-multiple-q-matrices","dir":"Articles","previous_headings":"","what":"ADMIXTURE and handling multiple Q matrices","title":"Example workflow with tidypopgen","text":"Usually, clustering algorithms run multiple times different values K. function q_matrix() can take path directory containing results multiple runs clustering algorithm (ADMIXTURE), read .Q files, summarise single q_matrix_list object. analysis , snmf(), ran 3 repetitions value K. exemplify q_matrix() can read directly output folders, can write outputs temporary file: read back q_matrix_list: q_matrix read summarised .Q files analysis,can access single matrix list selecting run number K value interest. example, like view second run K = 3: Similarly , can autoplot matrices selecting q_matrix_list: way, tidypopgen integrates external clustering software (ADMIXTURE STRUCTURE) seamlessly quick, easy plotting.","code":"runs <- c(1:3) k_values <- c(1:10) q_matrices <- list() dir <- tempdir() for(x in k_values){ q_matrices[[x]] <- list() for(i in runs){ q_matrices[[x]][[i]] <- LEA::Q(anole_snmf, K = x, run = i) write.table(q_matrices[[x]][[i]], file = paste0(dir,\"/K\",x,\"run\",i,\".Q\"), col.names = FALSE, row.names = FALSE, quote = FALSE) } } q_list <- read_q_files(dir) summary(q_list) #> Admixture results for multiple runs: #> k 1 2 3 4 5 6 7 8 9 10 #> n 3 3 3 3 3 3 3 3 3 3 #> with slots: #> $Q for Q matrices get_q_matrix(q_list, k = 3, run = 2) #> .Q1 .Q2 .Q3 #> [1,] 0.000099990 0.000099990 0.99980000 #> [2,] 0.000099990 0.000099990 0.99980000 #> [3,] 0.999800000 0.000099990 0.00009999 #> [4,] 0.999800000 0.000099990 0.00009999 #> [5,] 0.999800000 0.000099990 0.00009999 #> [6,] 0.000099990 0.999800000 0.00009999 #> [7,] 0.000099990 0.801337000 0.19856300 #> [8,] 0.000099990 0.999800000 0.00009999 #> [9,] 0.000099990 0.999800000 0.00009999 #> [10,] 0.000099990 0.999800000 0.00009999 #> [11,] 0.559491000 0.181639000 0.25887000 #> [12,] 0.811919000 0.034168200 0.15391300 #> [13,] 0.234834000 0.000099991 0.76506600 #> [14,] 0.999800000 0.000099990 0.00009999 #> [15,] 0.000099990 0.000099990 0.99980000 #> [16,] 0.999800000 0.000099990 0.00009999 #> [17,] 0.000099990 0.000099990 0.99980000 #> [18,] 0.999800000 0.000099990 0.00009999 #> [19,] 0.030865000 0.214975000 0.75416000 #> [20,] 0.000099990 0.000099990 0.99980000 #> [21,] 0.016124800 0.392110000 0.59176500 #> [22,] 0.000099990 0.000099990 0.99980000 #> [23,] 0.000099990 0.000099990 0.99980000 #> [24,] 0.000099990 0.000099990 0.99980000 #> [25,] 0.000099990 0.999800000 0.00009999 #> [26,] 0.000099990 0.999800000 0.00009999 #> [27,] 0.000099990 0.999800000 0.00009999 #> [28,] 0.000099990 0.999800000 0.00009999 #> [29,] 0.000099990 0.999800000 0.00009999 #> [30,] 0.999800000 0.000099990 0.00009999 #> [31,] 0.000099991 0.036791300 0.96310900 #> [32,] 0.073108700 0.135951000 0.79094000 #> [33,] 0.000099990 0.999800000 0.00009999 #> [34,] 0.999800000 0.000099990 0.00009999 #> [35,] 0.000099991 0.030821400 0.96907900 #> [36,] 0.206381000 0.000099991 0.79351900 #> [37,] 0.254406000 0.000099991 0.74549400 #> [38,] 0.000099990 0.999800000 0.00009999 #> [39,] 0.000099990 0.999800000 0.00009999 #> [40,] 0.000099991 0.033945100 0.96595500 #> [41,] 0.000099991 0.342076000 0.65782400 #> [42,] 0.000099990 0.999800000 0.00009999 #> [43,] 0.000099990 0.999800000 0.00009999 #> [44,] 0.000099991 0.806520000 0.19338000 #> [45,] 0.850262000 0.027241300 0.12249600 #> [46,] 0.999800000 0.000099990 0.00009999 #> attr(,\"class\") #> [1] \"q_matrix\" \"q_matrix\" \"matrix\" \"array\" autoplot(get_q_matrix(q_list, k = 3, run = 2), data = anole_gt)"},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"file-management-and-reading-data","dir":"Articles","previous_headings":"","what":"File management and reading data:","title":"PLINK cheatsheet","text":"PLINK flags –update-alleles, –allele1234, –alleleACGT, alter coding alleles. tidypopgen, valid alleles supplied reading gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"quality-control","dir":"Articles","previous_headings":"","what":"Quality control:","title":"PLINK cheatsheet","text":"filter variants tidypopgen, similar way PLINK flags –extract –autosome, necessary use gen_tibble select_loci_if(). example: select autosomal loci way –autosome. alternatively: select loci previously defined set way –extract. Similarly, filter individuals, might performed –keep PLINK, requires using filter:","code":"data %>% select_loci_if(loci_chromosomes(genotypes) %in% c(1:22)) #> # A gen_tibble: 15 loci #> # A tibble: 5 × 3 #> id population genotypes #> #> 1 GRC24 pop_a 1 #> 2 GRC25 pop_a 2 #> 3 GRC26 pop_a 3 #> 4 GRC27 pop_a 4 #> 5 GRC28 pop_a 5 my_snps <- c(\"rs4477212\",\"rs3094315\",\"rs3131972\",\"rs12124819\",\"rs11240777\") data %>% select_loci_if(loci_names(genotypes) %in% my_snps) %>% show_loci() #> # A tibble: 5 × 8 #> big_index name chromosome position genetic_dist allele_ref allele_alt chr_int #> #> 1 1 rs44… 1 82154 0 A NA 1 #> 2 2 rs30… 1 752566 0 A G 1 #> 3 3 rs31… 1 752721 0 G A 1 #> 4 4 rs12… 1 776546 0 A NA 1 #> 5 5 rs11… 1 798959 0 G A 1 my_individuals <- c(\"GRC14300079\", \"GRC14300142\", \"GRC14300159\") data %>% filter(id %in% my_individuals) #> # A gen_tibble: 16 loci #> # A tibble: 0 × 3 #> # ℹ 3 variables: id , population , genotypes "},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"quality-control-for-linkage","dir":"Articles","previous_headings":"","what":"Quality control for linkage","title":"PLINK cheatsheet","text":"Linkage managed clumping tidypopgen loci_ld_clump(). option similar –indep-pairwise flag PLINK, results even distribution loci compared LD pruning. explore clumping preferable pruning, see https://privefl.github.io/bigsnpr/articles/pruning-vs-clumping.html","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"quality-control-for-relatedness-king","dir":"Articles","previous_headings":"","what":"Quality control for relatedness (KING)","title":"PLINK cheatsheet","text":"pairwise_king() implements KING-robust estimator kinship equivalent –kinship KING. remove related individuals, instead using –unrelated –degree, user can pass resulting kinship matrix relatedness threshold filter_high_relatedness, return largest possible set unrelated individuals.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/articles/a99_plink_cheatsheet.html","id":"merging-datasets","dir":"Articles","previous_headings":"","what":"Merging datasets:","title":"PLINK cheatsheet","text":"PLINK, data merging can fail due strand inconsistencies addressed prior merging. PLINK documentation suggests users try ‘trial flip’ data address , ‘unflip’ errors remain. tidypopgen, data merged rbind, strand inconsistencies identified automatically flipped, avoiding multiple rounds flipping merging. PLINK allow users identify inconsistencies prior merging –flip-scan, functionality included tidypopgen rbind_dry_run(). rbind_dry_run() reports numeric overlap datasets, alongside number SNPs ‘flip’ new target dataset, well number ambiguous SNPs. Data merged one set time, equivalent –merge-list.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Evie Carter. Author. Andrea Manica. Author, maintainer.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Carter E, Manica (2024). tidypopgen: Tidy Population Genetics. R package version 0.0.0.9020, https://evolecolgroup.github.io/tidypopgen.","code":"@Manual{, title = {tidypopgen: Tidy Population Genetics}, author = {Evie Carter and Andrea Manica}, year = {2024}, note = {R package version 0.0.0.9020}, url = {https://evolecolgroup.github.io/tidypopgen}, }"},{"path":"https://evolecolgroup.github.io/tidypopgen/index.html","id":"tidypopgen-","dir":"","previous_headings":"","what":"Tidy Population Genetics","title":"Tidy Population Genetics","text":"goal tidypopgen provide tidy grammar population genetics, facilitating manipulation analysis genetic data. Currently, focussed biallelic single nucleotide polymorphisms (SNPs). making available preview version package. Everything work, vigilant functions tested extensively. Also, syntax functions still slightly flux, names order parameters might change. Make sure don’t rely position giving multiple parameters function, change trigger informative error code allow update.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Tidy Population Genetics","text":"can install latest version tidypopgen directly r-universe (reccomended): Alternatively, can install tidypopgenusing devtools (might need set development environment, can bit complex):","code":"install.packages('tidypopgen', repos = \"https://evolecolgroup.r-universe.dev\") install.packages(\"devtools\") devtools::install_github(\"EvolEcolGroup/tidypopgen\")"},{"path":"https://evolecolgroup.github.io/tidypopgen/index.html","id":"examples","dir":"","previous_headings":"","what":"Examples","title":"Tidy Population Genetics","text":"several vignettes designed teach use tidypopgen. ‘overview’ vignette explains data structures designed, provides illustration grammar used manipulate individuals loci. ‘example workflow’ vignette provides fully annotated example run population genetics analysis tidypopgen. ‘quality control’ vignette illustrates tidypopgen functions help running fully QC dataset analysis. Finally, provide ‘PLINK cheatsheet’ aimed translating common tasks performed PLINK tidypopgen commands.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/index.html","id":"when-something-does-not-work","dir":"","previous_headings":"","what":"When something does not work","title":"Tidy Population Genetics","text":"preview version tidypopgen. Everything work, elements extensively tested. something work, check issues GitHub see whether problem already reported. , feel free create new issue. Please make sure updated latest version tidypopgen Github, well updating packages system, provide reproducible example developers investigate problem. Ideally, try create minimalistic dataset reproduces error, much easier (thus faster!) developers track problem.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/annotate_group_info.html","id":null,"dir":"Reference","previous_headings":"","what":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","title":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","text":"Add vertical lines separate individuals different populations, add optional x labels names","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/annotate_group_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","text":"","code":"annotate_group_info(q_tbl)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/annotate_group_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","text":"q_tbl tidied q_matrix block, adjacent ","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/annotate_group_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Annotate an adxmiture barplot with information about the populations — annotate_group_info","text":"modifier ggplot, added usual '+'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment.gt_dapc.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment data with information from a gt_dapc object — augment.gt_dapc","title":"Augment data with information from a gt_dapc object — augment.gt_dapc","text":"Augment gt_dapc accepts model object dataset adds scores observation dataset. Scores component stored separate column, given name pattern \".fittedLD1\", \".fittedLD2\", etc. consistency broom::augment.prcomp, column \".rownames\" also returned; copy 'id', ensures scripts written data augmented broom::augment.prcomp work box (especially helpful adapting plotting scripts).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment.gt_dapc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment data with information from a gt_dapc object — augment.gt_dapc","text":"","code":"# S3 method for class 'gt_dapc' augment(x, data = NULL, k = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment.gt_dapc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment data with information from a gt_dapc object — augment.gt_dapc","text":"x gt_dapc object returned gt_dapc(). data gen_tibble used run PCA. k number components add ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment.gt_dapc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment data with information from a gt_dapc object — augment.gt_dapc","text":" gen_tibble containing original data along additional columns containing observation's projection PCA space.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment data with information from a gt_pca object — augment_gt_pca","title":"Augment data with information from a gt_pca object — augment_gt_pca","text":"Augment gt_pca accepts model object dataset adds scores observation dataset. Scores component stored separate column, given name pattern \".fittedPC1\", \".fittedPC2\", etc. consistency broom::augment.prcomp, column \".rownames\" also returned; copy 'id', ensures scripts written data augmented broom::augment.prcomp work box (especially helpful adapting plotting scripts).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment data with information from a gt_pca object — augment_gt_pca","text":"","code":"# S3 method for class 'gt_pca' augment(x, data = NULL, k = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment data with information from a gt_pca object — augment_gt_pca","text":"x gt_pca object returned one gt_pca_* functions. data gen_tibble used run PCA. k number components add ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment data with information from a gt_pca object — augment_gt_pca","text":" gen_tibble containing original data along additional columns containing observation's projection PCA space.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment the loci table with information from a analysis object — augment_loci","title":"Augment the loci table with information from a analysis object — augment_loci","text":"augment_loci add columns loci table gen_tibble related information given analysis.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment the loci table with information from a analysis object — augment_loci","text":"","code":"augment_loci(x, data, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment the loci table with information from a analysis object — augment_loci","text":"x object returned one gt_ functions (e.g. gt_pca()). data gen_tibble used run PCA. ... Additional parameters passed individual methods.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment the loci table with information from a analysis object — augment_loci","text":"gen_tibble additional columns added loci tibble (accessible show_loci(). data missing, tibble information, column .rownames giving loci names.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","title":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","text":"Augment gt_pca accepts model object gen_tibble adds loadings locus loci table. Loadings component stored separate column, given name pattern \".loadingPC1\", \".loadingPC2\", etc. data missing, tibble loadings returned.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","text":"","code":"# S3 method for class 'gt_pca' augment_loci(x, data = NULL, k = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","text":"x gt_pca object returned one gt_pca_* functions. data gen_tibble used run PCA. k number components add ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_loci_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment the loci table with information from a gt_pca object — augment_loci_gt_pca","text":"gen_tibble loadings added loci tibble (accessible show_loci(). data missing, tibble loadings.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Augment data with information from a q_matrix object — augment_q_matrix","title":"Augment data with information from a q_matrix object — augment_q_matrix","text":"Augment q_matrix accepts model object dataset adds Q values observation dataset. Q values stored separate columns, given name pattern \".Q1\",\".Q2\", etc. consistency broom::augment.prcomp, column \".rownames\" also returned; copy 'id', ensures scripts written data augmented broom::augment.prcomp work box (especially helpful adapting plotting scripts).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Augment data with information from a q_matrix object — augment_q_matrix","text":"","code":"# S3 method for class 'q_matrix' augment(x, data = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Augment data with information from a q_matrix object — augment_q_matrix","text":"x q_matrix object data gen_tibble used run clustering algorithm ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/augment_q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Augment data with information from a q_matrix object — augment_q_matrix","text":" gen_tibble containing original data along additional columns containing observation's Q values.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for q_matrix objects — autoplot.q_matrix","title":"Autoplots for q_matrix objects — autoplot.q_matrix","text":"Autoplots q_matrix objects","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for q_matrix objects — autoplot.q_matrix","text":"","code":"# S3 method for class 'q_matrix' autoplot(object, data = NULL, annotate_group = TRUE, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for q_matrix objects — autoplot.q_matrix","text":"object Q matrix object (returned q_matrix()). data associated tibble (e.g. gen_tibble), individuals order data used generate Q matrix annotate_group Boolean determining whether annotate plot group information ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for q_matrix objects — autoplot.q_matrix","text":"barplot individuals, coloured ancestry proportion","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"qc_report_indiv, following types plots available: scatter: plot missingness observed heterozygosity within individuals. relatedness: histogram paired kinship coefficients","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"","code":"# S3 method for class 'qc_report_indiv' autoplot( object, type = c(\"scatter\", \"relatedness\"), miss_threshold = NULL, kings_threshold = kings_threshold, ... )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"object object class qc_report_indiv type type plot (scatter,relatedness) miss_threshold threshold accepted rate missingness within individuals kings_threshold optional numeric, threshold relatedness sample ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for qc_report_indiv objects — autoplot.qc_report_indiv","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"qc_report_loci, following types plots available: overview: UpSet plot, giving counts snps threshold missingness, minor allele frequency, Hardy-Weinberg equilibrium P-value, visualising interaction : four panel plot, containing missing high maf, missing low maf, hwe, significant hwe plots missing: histogram proportion missing data missing low maf: histogram proportion missing data snps low minor allele freqency missing high maf:histogram proportion missing data snps high minor allele freqency maf: histogram minor allele frequency hwe: histogram HWE exact test p-values significant hwe: histogram significant HWE exact test p-values","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"","code":"# S3 method for class 'qc_report_loci' autoplot( object, type = c(\"overview\", \"all\", \"missing\", \"missing low maf\", \"missing high maf\", \"maf\", \"hwe\", \"significant hwe\"), maf_threshold = NULL, miss_threshold = NULL, hwe_p = NULL, ... )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"object object class qc_report_loci type type plot (one overview, , missing, missing low maf, missing high maf, maf, hwe, significant hwe) maf_threshold threshold accepted rate minor allele frequency loci miss_threshold threshold accepted rate missingness per loci hwe_p threshold significance Hardy-Weinberg exact p-values ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for qc_report_loci objects — autoplot.qc_report_loci","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_admix.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for gt_admix objects — autoplot_gt_admix","title":"Autoplots for gt_admix objects — autoplot_gt_admix","text":"gt_admix, following types plots available: cv: cross-validation error value k barplot standard barplot admixture proportions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_admix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for gt_admix objects — autoplot_gt_admix","text":"","code":"# S3 method for class 'gt_admix' autoplot(object, type = c(\"cv\", \"barplot\"), k = NULL, run = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_admix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for gt_admix objects — autoplot_gt_admix","text":"object object class gt_admixture type type plot (one \"cv\", \"boxplot\") k value k plot (barplot type ) param repeat repeat plot (barplot type ) run run plot (barplot type ) ... used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_admix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for gt_admix objects — autoplot_gt_admix","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_admix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for gt_admix objects — autoplot_gt_admix","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"gt_cluster_pca, autoplot produces plot metric choice ('BIC', 'AIC' 'WSS') number clusters (k). plot can used infer best value k, corresponds smallest value metric (minimum 'elbow' shaped curve). cases, 'elbow' metric keeps decreasing increasing k; cases, customary choose value k decrease metric reaches plateau. programmatic way choosing k, use gt_cluster_pca_best_k().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"","code":"# S3 method for class 'gt_cluster_pca' autoplot(object, metric = c(\"BIC\", \"AIC\", \"WSS\"), ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"object object class gt_dapc metric metric plot y axies, one 'BIC', 'AIC', 'WSS' (sum squares) ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for gt_cluster_pca objects — autoplot.gt_cluster_pca","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for gt_dapc objects — autoplot.gt_dapc","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"gt_dapc, following types plots available: screeplot: plot eigenvalues discriminant axes scores scatterplot scores individual two discriminant axes (defined ld) loadings plot loadings loci discriminant axis (chosen ld) components bar plot showing probability assignment cluster","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"","code":"# S3 method for class 'gt_dapc' autoplot( object, type = c(\"screeplot\", \"scores\", \"loadings\", \"components\"), ld = NULL, group = NULL, n_col = 1, ... )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"object object class gt_dapc type type plot (one \"screeplot\", \"scores\" \"loadings\") ld principal components plotted: scores, pair values e.g. c(1,2); loadings either one values. group vector group memberships order individuals \"components\" plot. NULL, clusters used DAPC used. n_col loadings plots, multiple LD axis plotted, many columns used. ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for gt_dapc objects — autoplot.gt_dapc","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for gt_pca objects — autoplot_gt_pca","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"gt_pca, following types plots available: screeplot: plot eigenvalues principal components (currently plots singular value) scores scatterplot scores individual two principal components (defined pc) loadings plot loadings loci given component (chosen pc)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"","code":"# S3 method for class 'gt_pca' autoplot(object, type = c(\"screeplot\", \"scores\", \"loadings\"), k = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"object object class gt_pca type type plot (one \"screeplot\", \"scores\" \"loadings\") k principal components plotted: scores, pair values e.g. c(1,2); loadings either one values. ... currently used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for gt_pca objects — autoplot_gt_pca","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"gt_pcadapt, following types plots available: qq: qunatile-quantile plot p-values pcadapt (wrapping bigsnpr::snp_qq()) manhattan manhattan plot p-values pcadapt (wrapping bigsnpr::snp_manhattan())","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"","code":"# S3 method for class 'gt_pcadapt' autoplot(object, type = c(\"qq\", \"manhattan\"), ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"object object class gt_pcadapt type type plot (one \"qq\", \"mnahattan\") ... arguments passed bigsnpr::snp_qq() bigsnpr::snp_manhattan().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"ggplot2 object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Autoplots for gt_pcadapt objects — autoplot_gt_pcadapt","text":"autoplot produces simple plots quickly inspect object. customisable; recommend use ggplot2 produce publication ready plots.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/c.gt_admix.html","id":null,"dir":"Reference","previous_headings":"","what":"Combine method for gt_admix objects — c.gt_admix","title":"Combine method for gt_admix objects — c.gt_admix","text":"Combine method gt_admix objects","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/c.gt_admix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Combine method for gt_admix objects — c.gt_admix","text":"","code":"# S3 method for class 'gt_admix' c(...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/c.gt_admix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Combine method for gt_admix objects — c.gt_admix","text":"... list gt_admix objects","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/c.gt_admix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Combine method for gt_admix objects — c.gt_admix","text":"gt_admix object combined data","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Count the number of loci in a gen_tibble — count_loci","title":"Count the number of loci in a gen_tibble — count_loci","text":"Count number loci gen_tibble (directly genotype column).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count the number of loci in a gen_tibble — count_loci","text":"","code":"count_loci(.x, ...) # S3 method for class 'tbl_df' count_loci(.x, ...) # S3 method for class 'vctrs_bigSNP' count_loci(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count the number of loci in a gen_tibble — count_loci","text":".x gen_tibble, vector class vctrs_bigSNP (usually genotype column gen_tibble object). ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Count the number of loci in a gen_tibble — count_loci","text":"number loci","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":null,"dir":"Reference","previous_headings":"","what":"Counts the number of individuals in a vcf file — count_vcf_individuals","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"Count number VCF individuals first parsing header, getting first line, separating tabs.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"","code":"count_vcf_individuals(file)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"file name path vcf file (can compressed)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"number individuals (integer)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Counts the number of individuals in a vcf file — count_vcf_individuals","text":"author Henrik Bengtsson original countLines R.utils; Andrea Manica modified version focussed vcf; Max Carter-Brown modified file .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":null,"dir":"Reference","previous_headings":"","what":"Counts the number of variants in a vcf file — count_vcf_variants","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"Count number VCF variants first parsing header, rapidly counting number platform-independent newlines (CR, LF, CR+LF), including last line neither.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"","code":"count_vcf_variants(file, chunk_size = 5e+07)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"file name path vcf file (can compressed) chunk_size number bytes read chunk.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"number variants (integer)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Counts the number of variants in a vcf file — count_vcf_variants","text":"author Henrik Bengtsson original countLines R.utils; Andrea Manica modified version focussed vcf","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/distruct_colours.html","id":null,"dir":"Reference","previous_headings":"","what":"Distruct colours — distruct_colours","title":"Distruct colours — distruct_colours","text":"Colours palette used distruct","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/distruct_colours.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Distruct colours — distruct_colours","text":"","code":"distruct_colours"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/distruct_colours.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Distruct colours — distruct_colours","text":"vector 60 hex colours","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/filter_high_relatedness.html","id":null,"dir":"Reference","previous_headings":"","what":"Filter individuals based on a relationship threshold — filter_high_relatedness","title":"Filter individuals based on a relationship threshold — filter_high_relatedness","text":"function takes matrix x y individuals containing relatedness coefficients returns maximum set individuals contains relationships given threshold.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/filter_high_relatedness.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Filter individuals based on a relationship threshold — filter_high_relatedness","text":"","code":"filter_high_relatedness( matrix, .x = NULL, kings_threshold = NULL, verbose = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/filter_high_relatedness.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Filter individuals based on a relationship threshold — filter_high_relatedness","text":"matrix square symmetric matrix individuals containing relationship coefficients .x gen_tibble object kings_threshold threshold verbose boolean whether report screen","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/filter_high_relatedness.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Filter individuals based on a relationship threshold — filter_high_relatedness","text":"list '1' individual ID's retain, '2' individual ID's remove, '3' boolean individuals keep TRUE individuals remove FALSE","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":null,"dir":"Reference","previous_headings":"","what":"Flip the strand of alleles — flip","title":"Flip the strand of alleles — flip","text":"function takes vector bases recodes .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Flip the strand of alleles — flip","text":"","code":"flip(bases)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Flip the strand of alleles — flip","text":"bases vector characters. valid characters \"\", \"T\", \"C\" \"G\".","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Flip the strand of alleles — flip","text":"vector recoded bases","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/flip.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Flip the strand of alleles — flip","text":"Note check bases valid. Also, missing alleles \"m\" kept \"m\".","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":null,"dir":"Reference","previous_headings":"","what":"Constructor for a gen_tibble — gen_tibble","title":"Constructor for a gen_tibble — gen_tibble","text":"gen_tibble stores genotypes individuals tidy format. DESCRIBE format","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Constructor for a gen_tibble — gen_tibble","text":"","code":"gen_tibble( x, ..., valid_alleles = c(\"A\", \"T\", \"C\", \"G\"), missing_alleles = c(\"0\", \".\"), backingfile = NULL, quiet = FALSE ) # S3 method for class 'character' gen_tibble( x, ..., parser = c(\"vcfR\", \"cpp\"), n_cores = 1, chunk_size = NULL, valid_alleles = c(\"A\", \"T\", \"C\", \"G\"), missing_alleles = c(\"0\", \".\"), backingfile = NULL, quiet = FALSE ) # S3 method for class 'matrix' gen_tibble( x, indiv_meta, loci, ..., ploidy = 2, valid_alleles = c(\"A\", \"T\", \"C\", \"G\"), missing_alleles = c(\"0\", \".\"), backingfile = NULL, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Constructor for a gen_tibble — gen_tibble","text":"x can : string giving path PLINK BED PED file. associated BIM FAM files BED, MAP PED expected directory file name. string giving path RDS file storing bigSNP object bigsnpr package (usually created bigsnpr::snp_readBed()) string giving path vcf file. Note currently read whole vcf memory vcfR, smallish VCF can imported. biallelic SNPs considered. string giving path packedancestry .geno file. associated .ind .snp files expected directory share file name prefix. genotype matrix dosages (0, 1, 2, NA) giving dosage alternate allele. ... x name vcf file, additional arguments passed vcfR::read.vcfR(). Otherwise, unused. valid_alleles vector valid allele values; defaults '','T', 'C' 'G'. missing_alleles vector values BIM file/loci dataframe indicate missing value allele value (e.g. monomorphic locus one allele). defaults '0' '.' (PLINK 1.9). backingfile path, including file name without extension, backing files used store data (given .bk .RDS automatically). needed x already .RDS file. x .BED VCF file backingfile left NULL, backing file saved directory bed file, using file name different file type (.bk rather .bed). x genotype matrix backingfile NULL, temporary file created (note R delete end session!) quiet provide information files used store data parser name parser used VCF, either \"cpp\" use fast C++ parser, \"vcfR\" use R package vcfR. latter slower robust; \"cpp\" gives error, try using \"vcfR\" case VCF unusual structure. n_cores number cores use parallel processing chunk_size number loci individuals (depending format) processed time (currently used x vcf packedancestry file) indiv_meta list, data.frame tibble compulsory columns 'id' 'population', plus additional metadata interest. used x genotype matrix. Otherwise information extracted directly files. loci data.frame tibble, compulsory columns 'name', 'chromosome', 'position','genetic_dist', 'allele_ref' 'allele_alt'. used x genotype matrix. Otherwise information extracted directly files. ploidy ploidy samples (either single value, vector values mixed ploidy). used creating gen_tibble matrix data; otherwise, ploidy determined automatically data read.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Constructor for a gen_tibble — gen_tibble","text":"object class gen_tbl.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Constructor for a gen_tibble — gen_tibble","text":"VCF files: fast cpp parser used default. cpp vcfR parsers attempt establish ploidy first variant; variant found sex chromosome (mtDNA), parser fail 'Error: genotype max_ploidy alleles...'. successful import VCF, change order variants first chromosome autosome using tool vcftools. Currently, biallelic SNPs supported. haploid variants (e.g. sex chromosomes) included VCF, transformed homozygous calls. Instead, reference alleles counted 0 alternative alleles counted 1. packedancestry files: loading packedancestry files, missing alleles converted 'X' NA","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_p_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Return a single P matrix from a gt_admix object — get_p_matrix","title":"Return a single P matrix from a gt_admix object — get_p_matrix","text":"function retrieves single P matrix gt_admix object based specified k value run number.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_p_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return a single P matrix from a gt_admix object — get_p_matrix","text":"","code":"get_p_matrix(x, ..., k, run)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_p_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return a single P matrix from a gt_admix object — get_p_matrix","text":"x gt_admix object containing P matrices ... used k k value desired P matrix run run number desired P matrix","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_p_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return a single P matrix from a gt_admix object — get_p_matrix","text":"single P matrix gt_admix object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Return a single Q matrix from a gt_admix object — get_q_matrix","title":"Return a single Q matrix from a gt_admix object — get_q_matrix","text":"function retrieves single Q matrix gt_admix object based specified k value run number.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return a single Q matrix from a gt_admix object — get_q_matrix","text":"","code":"get_q_matrix(x, ..., k, run)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return a single Q matrix from a gt_admix object — get_q_matrix","text":"x gt_admix object containing multiple Q matrices ... used k k value desired Q matrix run run number desired Q matrix","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/get_q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return a single Q matrix from a gt_admix object — get_q_matrix","text":"single Q matrix gt_admix object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_admixture.html","id":null,"dir":"Reference","previous_headings":"","what":"Run ADMIXTURE from R — gt_admixture","title":"Run ADMIXTURE from R — gt_admixture","text":"function runs ADMIXTURE, taking either gen_tibble file input. wrapper runs ADMIXTURE command line, reads output R. can run multiple values k multiple repeats k.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_admixture.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run ADMIXTURE from R — gt_admixture","text":"","code":"gt_admixture( x, k, n_runs = 1, crossval = FALSE, n_cores = 1, seed = NULL, conda_env = \"none\" )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_admixture.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run ADMIXTURE from R — gt_admixture","text":"x gen_tibble character giving path input PLINK bed file k integer giving number clusters n_runs number runs k value (defaults 1) crossval boolean, cross validation used assess fit (defaults ot FALSE) n_cores number cores (defaults 1) seed seed random number generator (defaults NULL) conda_env name conda environment use. \"none\" forces use local copy, whilst string direct function use custom conda environment.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_admixture.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run ADMIXTURE from R — gt_admixture","text":"object class gt_admix consisting list following elements: k number clusters Q matrix admixture proportions P matrix allele frequencies log log output generated ADMIXTURE (usually printed screen running command line) cv cross validation error (crossval TRUE) loglik log likelihood model id id column input gen_tibble (applicable) group group column input gen_tibble (applicable)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_admixture.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Run ADMIXTURE from R — gt_admixture","text":"wrapper command line program ADMIXTURE. can either use binary present main environment, use copy installed conda environment.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genind.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","title":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","text":"function converts gen_tibble genind object adegenet","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genind.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","text":"","code":"gt_as_genind(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genind.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","text":"x gen_tibble, population coded 'population'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genind.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gen_tibble to a genind object from adegenet — gt_as_genind","text":"genind object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genlight.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","title":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","text":"function converts gen_tibble genlight object adegenet","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genlight.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","text":"","code":"gt_as_genlight(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genlight.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","text":"x gen_tibble, population coded 'population'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genlight.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gen_tibble to a genlight object from adegenet — gt_as_genlight","text":"genlight object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_geno_lea.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","title":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","text":"function writes .geno file fom gen_tibble. Unless file path given, file suffix .geno written location .rds .bk files underpin gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_geno_lea.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","text":"","code":"gt_as_geno_lea(x, file = NULL)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_geno_lea.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","text":"x gen_tibble file .geno filename path, NULL (default) use location backing files.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_geno_lea.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gentibble to a .geno file for sNMF from the LEA package — gt_as_geno_lea","text":"path .geno file","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_hierfstat.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","title":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","text":"function converts gen_tibble data.frame formatted used hierfstat functions.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_hierfstat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","text":"","code":"gt_as_hierfstat(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_hierfstat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","text":"x gen_tibble, population coded 'population'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_hierfstat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gen_tibble to a data.frame compatible with hierfstat — gt_as_hierfstat","text":"data.frame column 'pop' column representing genotypes (alleles recoded 1 2)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":null,"dir":"Reference","previous_headings":"","what":"Export a gen_tibble object to PLINK bed format — gt_as_plink","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"function exports information gen_tibble object PLINK bed, ped raw file (associated files, .e. .bim .fam .bed; .fam .ped).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"","code":"gt_as_plink( x, file = NULL, type = c(\"bed\", \"ped\", \"raw\"), overwrite = TRUE, chromosomes_as_int = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"x gen_tibble object file character string giving path output file. left NULL, output file path prefix backingfile. type one \"bed\", \"ped\" \"raw\" overwrite boolean whether overwrite file. chromosomes_as_int boolean whether use integer representation chromosomes","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"path saved file","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_plink.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Export a gen_tibble object to PLINK bed format — gt_as_plink","text":"gen_tibble read vcf format, family.ID resulting plink files sample.ID.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_vcf.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gen_tibble to a VCF — gt_as_vcf","title":"Convert a gen_tibble to a VCF — gt_as_vcf","text":"function write VCF gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_vcf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gen_tibble to a VCF — gt_as_vcf","text":"","code":"gt_as_vcf(x, file = NULL, chunk_size = NULL, overwrite = FALSE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_vcf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gen_tibble to a VCF — gt_as_vcf","text":"x gen_tibble, population coded 'population' file .vcf file name path, NULL (default) use location backing files. chunk_size number loci processed time. Automatically set left NULL overwrite logical, file overwritten already exists?","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_as_vcf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a gen_tibble to a VCF — gt_as_vcf","text":"path .vcf file","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Run K-clustering on principal components — gt_cluster_pca","title":"Run K-clustering on principal components — gt_cluster_pca","text":"function implements clustering procedure used Discriminant Analysis Principal Components (DAPC, Jombart et al. 2010). procedure consists running successive K-means increasing number clusters (k), transforming data using principal component analysis (PCA). model, several statistical measures goodness fit computed, allows choose optimal k using function gt_cluster_pca_best_k(). See details description select optimal k vignette(\"adegenet-dapc\") tutorial.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run K-clustering on principal components — gt_cluster_pca","text":"","code":"gt_cluster_pca( x = NULL, n_pca = NULL, k_clusters = c(1, round(nrow(x$u)/10)), method = c(\"kmeans\", \"ward\"), n_iter = 1e+05, n_start = 10, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run K-clustering on principal components — gt_cluster_pca","text":"x gt_pca object returned one gt_pca_* functions. n_pca number principal components fed LDA. k_clusters number clusters explore, either single value, vector length 2 giving minimum maximum (e.g. 1:5). left NULL, use 1 number pca components divided 10 (reasonable guess). method either 'kmeans' 'ward' n_iter number iterations kmeans (used method=\"kmeans\") n_start number starting points kmeans (used method=\"kmeans\") quiet boolean whether silence outputting information screen (defaults FALSE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run K-clustering on principal components — gt_cluster_pca","text":"gt_cluster_pca object, subclass gt_pca additional element 'cluster', list elements: 'method' clustering method (either kmeans ward) 'n_pca' number principal components used clustering 'k' k values explored function 'WSS' within sum squares k 'AIC' AIC k 'BIC' BIC k 'groups' list, element giving group assignments given k","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":null,"dir":"Reference","previous_headings":"","what":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"function selects best k value based chosen metric criterion. equivalent plotting metric k values, selecting k fulfils given criterion (see details explanation criterion). function simply adds element 'best_k' gt_cluster_pca returned gt_cluster_pca(). choice can -ridden simply assigning different value element (e.g. object x desired k 8, simply use x$best_k <- 8)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"","code":"gt_cluster_pca_best_k( x, stat = c(\"BIC\", \"AIC\", \"WSS\"), criterion = c(\"diffNgroup\", \"min\", \"goesup\", \"smoothNgoesup\", \"goodfit\"), quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"x gt_cluster_pca object obtained gt_cluster_pca() stat statistics, one \"BIC\", \"AIC\" \"WSS\" criterion one \"diffNgroup\", \"min\", \"goesup\", \"smoothNgoesup\", \"goodfit\", see details discussion approach. quiet boolean whether silence outputting information screen (defaults FALSE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"'gt_cluster_pca' object added element 'best_k'","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"analysis data simulated various population genetics models (see reference) suggested ad-hoc rule selection optimal number clusters. First important result BIC seems efficient AIC WSS select appropriate number clusters (see example). rule thumb consists increasing K longer leads appreciable improvement fit (.e., decrease BIC). simple models (island models), BIC decreases reaches optimal K, increases. cases, best rule amounts choosing lowest K. models stepping stones, decrease BIC often continues optimal K, much less steep, change slope can taken indication best k lies. function provides programmatic way select k. Note highly recommended look graph BIC versus numbers clusters, understand validate programmatic selection. criteria available function : \"diffNgroup\": differences successive values summary statistics (default, BIC) split two groups using Ward's clustering method (see ?hclust), differentiate sharp decrease mild decreases increases. retained K one first group switch. criterion appears work well island/hierarchical models, decently isolation distance models, albeit unstability. can confounded initial, sharp decrease test statistics. UNSURE CRITERION USE, USE ONE. \"min\": model minimum summary statistics (specified stat argument, BIC default) retained. likely work simple island model, using BIC. likely fail models relating stepping stones, BIC always decreases (albeit small amount) K increases. general, approach tends -estimate number clusters. \"goesup\": selected model K increasing number clusters leads increasing summary statistics. Suffers inaccuracy, since ) steep decrease might follow small 'bump' increase statistics, ii) increase might never happen, happen negligible decreases. likely work clear-cut island models. \"smoothNgoesup\": variant \"goesup\", summary statistics first smoothed using lowess approach. meant accurate \"goesup\" less prone stopping small 'bumps' decrease statistics. \"goodfit\": another criterion seeking good fit minimum number clusters. approach rely differences successive statistics, absolute fit. selects model smallest K overall fit given threshold.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_cluster_pca_best_k.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Find the best number of clusters based on principal components — gt_cluster_pca_best_k","text":"Jombart T, Devillard S Balloux F (2010) Discriminant analysis principal components: new method analysis genetically structured populations. BMC Genetics 11:94. doi:10.1186/1471-2156-11-94","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":null,"dir":"Reference","previous_headings":"","what":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"function implements Discriminant Analysis Principal Components (DAPC, Jombart et al. 2010). method describes diversity pre-defined groups. groups unknown, use gt_cluster_pca() infer genetic clusters. See 'details' section succinct description method, vignette package adegenet (\"adegenet-dapc\") tutorial. function returns objects class adegenet::dapc compatible methods adegenet; graphical methods DAPC documented adegenet::scatter.dapc (see ?scatter.dapc).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"","code":"gt_dapc( x, pop = NULL, n_pca = NULL, n_da = NULL, loadings_by_locus = TRUE, pca_info = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"x object class gt_pca, subclass gt_cluster_pca pop either factor indicating group membership individuals; integer defining desired k x gt_cluster_pca; NULL, 'x' gt_cluster_pca contain element 'best_k', usually generated gt_cluster_pca_best_k(), used select clustering level. n_pca number principal components used Discriminant Analysis. NULL, k-1 used. n_da integer indicating number axes retained Discriminant Analysis step. loadings_by_locus logical indicating whether loadings contribution locus stored (TRUE, default) (FALSE). output can useful, can also create large matrices lot loci many dimensions. pca_info logical indicating whether information prior PCA stored (TRUE, default) (FALSE). information required predict group membership new individuals using predict, makes object slightly bigger.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"object class adegenet::dapc","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"Discriminant Analysis Principal Components (DAPC) designed investigate genetic structure biological populations. multivariate method consists two-steps procedure. First, genetic data transformed (centred, possibly scaled) submitted Principal Component Analysis (PCA). Second, principal components PCA submitted Linear Discriminant Analysis (LDA). trivial matrix operation allows express discriminant functions linear combination alleles, therefore allowing one compute allele contributions. details computation DAPC found indicated reference.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_dapc.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Discriminant Analysis of Principal Components for gen_tibble — gt_dapc","text":"Jombart T, Devillard S Balloux F (2010) Discriminant analysis principal components: new method analysis genetically structured populations. BMC Genetics 11:94. doi:10.1186/1471-2156-11-94 Thia, J. . (2023). Guidelines standardizing application discriminant analysis principal components genotype data. Molecular Ecology Resources, 23, 523–538. https://doi.org/10.1111/1755-0998.13706","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_extract_f2.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","title":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","text":"function prepares data various ADMIXTOOLS 2 functions fro package ADMIXTOOLS 2. takes gen_tibble, computes allele frequencies blocked f2-statistics, writes results outdir. equivalent admixtools::extract_f2().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_extract_f2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","text":"","code":"gt_extract_f2( .x, outdir = NULL, blgsize = 0.05, maxmem = 8000, maxmiss = 0, minmaf = 0, maxmaf = 0.5, minac2 = FALSE, outpop = NULL, outpop_scale = TRUE, transitions = TRUE, transversions = TRUE, overwrite = FALSE, adjust_pseudohaploid = TRUE, fst = TRUE, afprod = TRUE, poly_only = c(\"f2\"), apply_corr = TRUE, n_cores = 1, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_extract_f2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","text":".x gen_tibble outdir Directory data stored. blgsize SNP block size Morgan. Default 0.05 (5 cM). blgsize 100 greater, interpreted base pair distance rather centimorgan distance. maxmem Maximum amount memory used. required amount memory exceeds maxmem, allele frequency data split blocks, computation performed separately block pair. put precise cap amount memory used (used point). Set parameter lower values run memory running function. Set higher values function slow lots memory. maxmiss Discard SNPs missing fraction populations higher maxmiss minmaf Discard SNPs minor allele frequency less minmaf maxmaf Discard SNPs minor allele frequency greater maxmaf minac2 Discard SNPs allele count lower 2 population (default FALSE). option set TRUE computing f3-statistics one population consists mostly pseudohaploid samples. Otherwise heterozygosity estimates thus f3-estimates can biased. minac2 == 2 discard SNPs allele count lower 2 non-singleton population (option experimental based hypothesis using SNPs allele count lower 2 leads biases non-singleton populations). Note , minac2 option discards SNPs allele count lower 2 population, qp3pop function discard SNPs allele count lower 2 first (target) population (first argument prefix genotype file; .e. applied directly genotype file, via precomputing f2 gen_tibble). outpop Keep SNPs heterozygous population outpop_scale Scale f2-statistics inverse outpop heterozygosity (1/(p*(1-p))). Providing outpop setting outpop_scale TRUE give results original qpGraph outpop parameter set, disadvantage treating one population different others. may limit use f2-statistics models. transitions Set FALSE exclude transition SNPs transversions Set FALSE exclude transversion SNPs overwrite Overwrite existing files outdir adjust_pseudohaploid Genotypes pseudohaploid samples usually coded 0 2, even though one allele observed. adjust_pseudohaploid ensures observed allele count increases 1 pseudohaploid sample. TRUE (default), samples genotypes coded 1 among first 1000 SNPs automatically identified pseudohaploid. leads slightly accurate estimates f-statistics. Setting parameter FALSE treats samples diploid equivalent ADMIXTOOLS inbreed: option. Setting adjust_pseudohaploid integer n check first n SNPs instead first 1000 SNPs. fst Write files pairwise FST every population pair. Setting FALSE can make extract_f2 faster require less memory. afprod Write files allele frequency products every population pair. Setting FALSE can make extract_f2 faster require less memory. poly_only Specify whether SNPs identical allele frequencies every population discarded (poly_only = TRUE), whether used (poly_only = FALSE). default (poly_only = c(\"f2\")), SNPs used compute FST allele frequency products, compute f2 (default option original ADMIXTOOLS). apply_corr Apply small-sample-size correction computing f2-statistics (default TRUE) n_cores Parallelize computation across n_cores cores. quiet Suppress printing progress updates","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_extract_f2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute and store blocked f2 statistics for ADMIXTOOLS 2 — gt_extract_f2","text":"SNP metadata (invisibly)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_get_file_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","title":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","text":"function return names files used store data gen_tibble. Specifically, returns .rds file storing big","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_get_file_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","text":"","code":"gt_get_file_names(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_get_file_names.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","text":"x gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_get_file_names.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the names of files storing the genotypes of a gen_tibble — gt_get_file_names","text":"character vector names paths two files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_has_imputed.html","id":null,"dir":"Reference","previous_headings":"","what":"Checks if a gen_tibble has been imputed — gt_has_imputed","title":"Checks if a gen_tibble has been imputed — gt_has_imputed","text":"function checks dataset imputed. Note imputation mean imputed values used.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_has_imputed.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checks if a gen_tibble has been imputed — gt_has_imputed","text":"","code":"gt_has_imputed(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_has_imputed.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checks if a gen_tibble has been imputed — gt_has_imputed","text":"x gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_has_imputed.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checks if a gen_tibble has been imputed — gt_has_imputed","text":"boolean TRUE FALSE depending whether dataset imputed","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":null,"dir":"Reference","previous_headings":"","what":"Simple imputation based on allele frequencies — gt_impute_simple","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"function provides simple imputation algorithm gen_tibble objects using mode, mean sampling allele frequencies. locus imputed independently (thus linkage information ignored).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"","code":"gt_impute_simple(x, method = c(\"mode\", \"mean0\", \"random\"), n_cores = 1)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"x gen_tibble missing data method one 'mode': frequent genotype 'mean0': mean rounded nearest integer 'random': randomly sample genotype based observed allele frequencies n_cores number cores used","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"gen_tibble imputed genotypes","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simple imputation based on allele frequencies — gt_impute_simple","text":"function wrapper around bigsnpr::snp_fastImputeSimple().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_load.html","id":null,"dir":"Reference","previous_headings":"","what":"Load a gen_tibble — gt_load","title":"Load a gen_tibble — gt_load","text":"Load gen_tibble previously saved gt_save(). .rds .bk files moved, found automatically. moved, use reattach_to point .rds file (.bk file needs directory .rds file).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_load.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load a gen_tibble — gt_load","text":"","code":"gt_load(file = NULL, reattach_to = NULL)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_load.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load a gen_tibble — gt_load","text":"file file name, including full path. end .gt, extension added. reattach_to file name, including full path, .rds file moved. assumes .bk file found path. able leave NULL unless moved files.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_load.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load a gen_tibble — gt_load","text":"gen_tibble","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_order_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Order the loci table of a gen_tibble — gt_order_loci","title":"Order the loci table of a gen_tibble — gt_order_loci","text":"function reorders loci table positions within chromosome sequential. also re-saves genotypes new file backed matrix new order, can used functions loci_ld_clump() gt_pca_autoSVD(). loci table already ordered, original gen_tibble returned.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_order_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Order the loci table of a gen_tibble — gt_order_loci","text":"","code":"gt_order_loci(.x, use_current_table = FALSE, quiet = FALSE, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_order_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Order the loci table of a gen_tibble — gt_order_loci","text":".x gen_tibble use_current_table boolean, FALSE (default), table reordered; TRUE, current loci table, might reordered manually, used, positions within chromosome sequential quiet boolean suppress information files ... arguments","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_order_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Order the loci table of a gen_tibble — gt_order_loci","text":"gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Principal Component Analysis for gen_tibble objects — gt_pca","title":"Principal Component Analysis for gen_tibble objects — gt_pca","text":"number PCA methods available gen_tibble objects. mostly designed work large datasets, compute limited number components. smaller datasets, gt_partialSVD allows use partial (truncated) SVD fit PCA; method suitable number individuals much smaller number loci. larger dataset, gt_randomSVD appropriate. Finally, method specifically designed dealing LD large datasets, gt_autoSVD. Whilst arguably best option, somewhat data hungry, suitable large datasets (hundreds individuals several hundred thousands markers, larger).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Principal Component Analysis for gen_tibble objects — gt_pca","text":"NOTE: using gt_pca_autoSVD small dataset likely cause error, see man page details. NOTE: monomorphic markers must removed PCA computed. error message 'Error: variables zero scaling; remove attempting scale.' indicates monomorphic markers present.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":null,"dir":"Reference","previous_headings":"","what":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"function performs Principal Component Analysis gen_tibble, using fast truncated SVD initial pruning iterative removal long-range LD regions. function wrapper bigsnpr::snp_autoSVD()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"","code":"gt_pca_autoSVD( x, k = 10, fun_scaling = bigsnpr::snp_scaleBinom(), thr_r2 = 0.2, use_positions = TRUE, size = 100/thr_r2, roll_size = 50, int_min_size = 20, alpha_tukey = 0.05, min_mac = 10, max_iter = 5, n_cores = 1, verbose = TRUE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"x gen_tbl object k Number singular vectors/values compute. Default 10. algorithm used compute singular vectors/values. fun_scaling Usually can left unset, defaults bigsnpr::snp_scaleBinom(), appropriate function biallelic SNPs. Alternatively possible use custom function (see bigsnpr::snp_autoSVD() details. thr_r2 Threshold squared correlation two SNPs. Default 0.2. Use NA want skip clumping step. size use_positions boolean whether position used define size, whether size number SNPs. Default TRUE size one SNP, window size around SNP compute correlations. Default 100 / thr_r2 clumping (0.2 -> 500; 0.1 -> 1000; 0.5 -> 200). providing infos.pos (NULL, default), window number SNPs, otherwise window kb (genetic distance). recommend provide positions available. roll_size Radius rolling windows smooth log-p-values. Default 50. int_min_size Minimum number consecutive outlier SNPs order reported long-range LD region. Default 20. alpha_tukey Default 0.1. type-error rate outlier detection (corrected multiple testing). min_mac Minimum minor allele count (MAC) variants included. Default 10. max_iter Maximum number iterations outlier detection. Default 5. n_cores Number cores used. Default use parallelism. may use bigstatsr::nb_cores(). verbose Output information iterations? Default TRUE.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"gt_pca object, subclass bigSVD; S3 list elements: named list (S3 class \"big_SVD\") d, eigenvalues (singular values, .e. variances), u, scores sample component (left singular vectors) v, loadings (right singular vectors) center, centering vector, scale, scaling vector, method, string defining method (case 'autoSVD'), call, call generated object. Note: rather accessing elements directly, better use tidy augment. See gt_pca_tidiers. Note: encounter 'Error rollmean(): Parameter 'size' large.' roll_size exceeding number variants least one chromosomes. pre-specified roll_size, need reduce parameter. , try specifying reduced 'roll_size' avoid error.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"PCA controlling for LD for gen_tibble objects — gt_pca_autoSVD","text":"Using gt_pca_autoSVD requires reasonably large dataset, function iteratively removes regions long range LD.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_partialSVD.html","id":null,"dir":"Reference","previous_headings":"","what":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","title":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","text":"function performs Principal Component Analysis gen_tibble, partial SVD eigen decomposition covariance. works well number individuals much smaller number loci; otherwise, gt_pca_randomSVD() better option. function wrapper bigstatsr::big_SVD().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_partialSVD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","text":"","code":"gt_pca_partialSVD(x, k = 10, fun_scaling = bigsnpr::snp_scaleBinom())"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_partialSVD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","text":"x gen_tbl object k Number singular vectors/values compute. Default 10. algorithm used compute singular vectors/values. fun_scaling Usually can left unset, defaults bigsnpr::snp_scaleBinom(), appropriate function biallelic SNPs. Alternatively possible use custom function (see bigsnpr::snp_autoSVD() details.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_partialSVD.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"PCA for gen_tibble objects by partial SVD — gt_pca_partialSVD","text":"gt_pca object, subclass bigSVD; S3 list elements: named list (S3 class \"big_SVD\") d, eigenvalues (singular values, .e. variances), u, scores sample component (left singular vectors) v, loadings (right singular vectors) center, centering vector, scale, scaling vector, method, string defining method (case 'partialSVD'), call, call generated object. Note: rather accessing elements directly, better use tidy augment. See gt_pca_tidiers.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_randomSVD.html","id":null,"dir":"Reference","previous_headings":"","what":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","title":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","text":"function performs Principal Component Analysis gen_tibble, randomised partial SVD based algorithm RSpectra (Yixuan Qiu Jiali Mei). algorithm linear time dimensions memory-efficient. Thus, can used large big.matrices. function wrapper bigstatsr::big_randomSVD()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_randomSVD.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","text":"","code":"gt_pca_randomSVD( x, k = 10, fun_scaling = bigsnpr::snp_scaleBinom(), tol = 1e-04, verbose = FALSE, n_cores = 1, fun_prod = bigstatsr::big_prodVec, fun_cprod = bigstatsr::big_cprodVec )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_randomSVD.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","text":"x gen_tbl object k Number singular vectors/values compute. Default 10. algorithm used compute singular vectors/values. fun_scaling Usually can left unset, defaults bigsnpr::snp_scaleBinom(), appropriate function biallelic SNPs. Alternatively possible use custom function (see bigsnpr::snp_autoSVD() details. tol Precision parameter svds. Default 1e-4. verbose progress printed? Default FALSE. n_cores Number cores used. fun_prod Function takes 6 arguments (order): matrix-like object X, vector x, vector row indices ind.row X, vector column indices ind.col X, vector column centers (corresponding ind.col), vector column scales (corresponding ind.col), compute product X (subsetted scaled) x. fun_cprod fun.prod, transpose X.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_randomSVD.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"PCA for gen_tibble objects by randomized partial SVD — gt_pca_randomSVD","text":"gt_pca object, subclass bigSVD; S3 list elements: named list (S3 class \"big_SVD\") d, eigenvalues (singular values, .e. variances), u, scores sample component (left singular vectors) v, loadings (right singular vectors) center, centering vector, scale, scaling vector, method, string defining method (case 'randomSVD'), call, call generated object. Note: rather accessing elements directly, better use tidy augment. See gt_pca_tidiers.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":null,"dir":"Reference","previous_headings":"","what":"pcadapt analysis on a gen_tibble object — gt_pcadapt","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"pcadapt algorithm detects genetic markers selection. based principal component analysis (PCA) genotypes individuals. method described Luu et al. (2017), See R package pcadapt, provides extensive documentation examples.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"","code":"gt_pcadapt(x, pca, k, n_cores = 1)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"x gen_tibble object. pca gt_pca object, returned gt_pca_partialSVD() gt_pca_randomSVD(). k Number principal components use analysis. n_cores Number cores use.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"object subclass gt_pcadapt, subclass mhtest.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_pcadapt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"pcadapt analysis on a gen_tibble object — gt_pcadapt","text":"Internally, function uses snp_pcadapt function bigsnpr package.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":null,"dir":"Reference","previous_headings":"","what":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"function uses sliding-window approach look runs homozygosity (heterozygosity) diploid genome. function uses package selectRUNS, implements approach equivalent one PLINK.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"","code":"gt_roh_window( x, window_size = 15, threshold = 0.05, min_snp = 3, heterozygosity = FALSE, max_opp_window = 1, max_miss_window = 1, max_gap = 10^6, min_length_bps = 1000, min_density = 1/1000, max_opp_run = NULL, max_miss_run = NULL )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"x gen_tibble window_size size sliding window (number SNP loci) (default = 15) threshold threshold overlapping windows state (homozygous/heterozygous) call SNP RUN (default = 0.05) min_snp minimum n. SNP RUN (default = 3) heterozygosity look runs heterozygosity (instead homozygosity? (default = FALSE) max_opp_window max n. SNPs opposite type (e.g. heterozygous snps runs homozygosity) sliding window (default = 1) max_miss_window max. n. missing SNP sliding window (default = 1) max_gap max distance consecutive SNP still considered potential run (default = 10^6 bps) min_length_bps minimum length run bps (defaults 1000 bps = 1 kbps) min_density minimum n. SNP per kbps (defaults 0.1 = 1 SNP every 10 kbps) max_opp_run max n. opposite genotype SNPs run (optional) max_miss_run max n. missing SNPs run (optional)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"dataframe RUNs Homozygosity Heterozygosity analysed dataset. returned dataframe contains following seven columns: \"group\", \"id\", \"chrom\", \"nSNP\", \"\", \"\", \"lengthBps\" (group: population, breed, case/control etc.; id: individual identifier; chrom: chromosome run located; nSNP: number SNPs run; : starting position run, bps; : end position run, bps; lengthBps: size run)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"function returns data frame runs detected dataset. data frame can written csv file. data frame , turn, input functions detectRUNS package create plots produce statistics results (see plots statistics functions manual, /refer detectRUNS vignette). gen_tibble grouped, grouping variable used fill group table. Otherwise, group 'column' filled values 'id' column","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_roh_window.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Detect runs of homozygosity using a sliding-window approach — gt_roh_window","text":"","code":"# run the example only if we have the package installed if (requireNamespace(\"detectRUNS\", quietly = TRUE)) { sheep_ped <- system.file(\"extdata\", \"Kijas2016_Sheep_subset.ped\", package=\"detectRUNS\") sheep_gt <- tidypopgen::gen_tibble(sheep_ped, backingfile = tempfile(), quiet=TRUE) sheep_gt <- sheep_gt %>% group_by(population) sheep_roh <- gt_roh_window(sheep_gt) detectRUNS::plot_Runs(runs = sheep_roh) } #> N. of RUNS for individual H114 is: 27 #> N. of RUNS for individual H115 is: 29 #> N. of RUNS for individual H116 is: 28 #> N. of RUNS for individual H26 is: 25 #> N. of RUNS for individual H32 is: 21 #> N. of RUNS for individual H38 is: 16 #> N. of RUNS for individual H44 is: 14 #> N. of RUNS for individual H56 is: 14 #> N. of RUNS for individual H50 is: 29 #> N. of RUNS for individual H27 is: 18 #> N. of RUNS for individual H33 is: 21 #> N. of RUNS for individual H39 is: 17 #> N. of RUNS for individual H45 is: 18 #> N. of RUNS for individual H51 is: 29 #> N. of RUNS for individual H57 is: 20 #> N. of RUNS for individual H28 is: 13 #> N. of RUNS for individual H34 is: 18 #> N. of RUNS for individual H40 is: 28 #> N. of RUNS for individual H46 is: 29 #> N. of RUNS for individual H52 is: 20 #> N. of RUNS for individual H58 is: 13 #> N. of RUNS for individual H29 is: 17 #> N. of RUNS for individual H35 is: 27 #> N. of RUNS for individual H41 is: 19 #> N. of RUNS for individual H47 is: 22 #> N. of RUNS for individual H53 is: 25 #> N. of RUNS for individual H59 is: 28 #> N. of RUNS for individual H30 is: 19 #> N. of RUNS for individual H42 is: 20 #> N. of RUNS for individual H48 is: 32 #> N. of RUNS for individual H54 is: 20 #> N. of RUNS for individual H60 is: 17 #> N. of RUNS for individual H31 is: 15 #> N. of RUNS for individual H37 is: 17 #> N. of RUNS for individual H43 is: 14 #> N. of RUNS for individual H49 is: 19 #> N. of RUNS for individual H55 is: 33 #> N. of RUNS for individual H1 is: 21 #> N. of RUNS for individual H9 is: 13 #> N. of RUNS for individual H17 is: 29 #> N. of RUNS for individual H2 is: 19 #> N. of RUNS for individual H10 is: 20 #> N. of RUNS for individual H19 is: 22 #> N. of RUNS for individual H3 is: 25 #> N. of RUNS for individual H11 is: 21 #> N. of RUNS for individual H20 is: 36 #> N. of RUNS for individual H4 is: 20 #> N. of RUNS for individual H12 is: 17 #> N. of RUNS for individual H21 is: 25 #> N. of RUNS for individual H13 is: 22 #> N. of RUNS for individual H22 is: 30 #> N. of RUNS for individual H6 is: 17 #> N. of RUNS for individual H14 is: 20 #> N. of RUNS for individual H7 is: 31 #> N. of RUNS for individual H15 is: 15 #> N. of RUNS for individual H24 is: 22 #> N. of RUNS for individual H8 is: 23 #> N. of RUNS for individual H16 is: 35 #> N. of RUNS for individual H25 is: 22 #> N. of RUNS for individual H64 is: 30 #> N. of RUNS for individual H62 is: 20 #> N. of RUNS for individual H63 is: 11 #> N. of RUNS for individual H118 is: 30 #> N. of RUNS for individual H119 is: 27 #> N. of RUNS for individual H120 is: 28 #> N. of RUNS for individual H121 is: 31 #> N. of RUNS for individual H122 is: 31 #> N. of RUNS for individual H123 is: 22 #> N. of RUNS for individual H124 is: 31 #> N. of RUNS for individual H125 is: 22 #> N. of RUNS for individual H126 is: 26 #> N. of RUNS for individual H127 is: 28 #> N. of RUNS for individual H128 is: 33 #> N. of RUNS for individual H129 is: 19 #> N. of RUNS for individual H130 is: 30 #> N. of RUNS for individual H131 is: 33 #> N. of RUNS for individual H132 is: 30 #> N. of RUNS for individual H133 is: 33 #> N. of RUNS for individual H134 is: 27 #> N. of RUNS for individual H135 is: 27 #> N. of RUNS for individual H136 is: 17 #> N. of RUNS for individual H137 is: 33 #> N. of RUNS for individual H138 is: 23 #> N. of RUNS for individual H139 is: 32 #> N. of RUNS for individual H140 is: 27 #> N. of RUNS for individual H141 is: 28 #> N. of RUNS for individual H142 is: 27 #> N. of RUNS for individual H143 is: 24 #> N. of RUNS for individual H144 is: 26 #> N. of RUNS for individual H145 is: 32 #> N. of RUNS for individual H146 is: 23 #> N. of RUNS for individual H147 is: 23 #> N. of RUNS for individual H148 is: 25 #> N. of RUNS for individual H149 is: 26 #> N. of RUNS for individual H150 is: 31 #> N. of RUNS for individual H151 is: 36 #> N. of RUNS for individual H152 is: 26 #> N. of RUNS for individual H153 is: 27 #> N. of RUNS for individual H154 is: 31 #> N. of RUNS for individual H155 is: 32"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save.html","id":null,"dir":"Reference","previous_headings":"","what":"Save a gen_tibble — gt_save","title":"Save a gen_tibble — gt_save","text":"Save tibble (update backing files). gen_tibble object saved file extension .gt, togethe update .rds .bk files. Note multiple .gt files can linked .rds .bk files; generally, occurs create multiple subsets data. .gt file stores information subset full dataset interested , whilst .rds .bk file store full dataset. reload gen_tibble, can pass name .gt file gt_load().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save a gen_tibble — gt_save","text":"","code":"gt_save(x, file_name = NULL, quiet = FALSE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save a gen_tibble — gt_save","text":"x gen_tibble file_name file name, including full path. end .gt, extension added. quiet boolean suppress information files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Save a gen_tibble — gt_save","text":"file name path .gt file, together .rds .bk files","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save_light.html","id":null,"dir":"Reference","previous_headings":"","what":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","title":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","text":"light version gt_save resave bigSNP RDS backing file, used internally creating gen_tibble (just created , need resave )","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save_light.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","text":"","code":"gt_save_light(x, file_name = NULL, quiet = FALSE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save_light.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","text":"x gen_tibble file_name file name, including full path. end .gt, extension added. quiet boolean suppress information hte files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_save_light.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"a light version of gt_save that does not resave the bigSNP RDS or backing file, to be used internally when creating a gen_tibble (if we have just created it, there is not need to resave it) — gt_save_light","text":"file name path .gt file, together .rds .bk files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_set_imputed.html","id":null,"dir":"Reference","previous_headings":"","what":"Sets a gen_tibble to use imputed data — gt_set_imputed","title":"Sets a gen_tibble to use imputed data — gt_set_imputed","text":"function sets unsets use imputed data. analysis, PCA, allow missing data, use imputation, analysis might preferable allow missing data.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_set_imputed.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sets a gen_tibble to use imputed data — gt_set_imputed","text":"","code":"gt_set_imputed(x, set = NULL)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_set_imputed.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sets a gen_tibble to use imputed data — gt_set_imputed","text":"x gen_tibble set boolean defining whether imputed data used","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_to_aftable.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","title":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","text":"function equivalent anygeno_to_aftable(), aftable created directly gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_to_aftable.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","text":"","code":"gt_to_aftable(.x, adjust_pseudohaploid = TRUE, n_cores = bigstatsr::nb_cores())"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_to_aftable.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","text":".x gen_tibble adjust_pseudohaploid Genotypes pseudohaploid samples usually coded 0 2, even though one allele observed. adjust_pseudohaploid ensures observed allele count increases 1 pseudohaploid sample. TRUE (default), samples genotypes coded 1 among first 1000 SNPs automatically identified pseudohaploid. leads slightly accurate estimates f-statistics. Setting parameter FALSE treats samples diploid equivalent ADMIXTOOLS inbreed: option. Setting adjust_pseudohaploid integer n check first n SNPs instead first 1000 SNPs. n_cores Parallelize computation across n_cores cores.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_to_aftable.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an allele frequency table (aftable) for admixtools — gt_to_aftable","text":"list 3 elements: afs, counts, snp","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_update_backingfile.html","id":null,"dir":"Reference","previous_headings":"","what":"Update the backing matrix — gt_update_backingfile","title":"Update the backing matrix — gt_update_backingfile","text":"functions forces re-write file backing matrix match gen_tibble. Individuals loci subsetted reordered according current state gen_tibble. Tests function test_gt_order_loci.R","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_update_backingfile.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update the backing matrix — gt_update_backingfile","text":"","code":"gt_update_backingfile(.x, backingfile = NULL, chunk_size = NULL, quiet = FALSE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_update_backingfile.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update the backing matrix — gt_update_backingfile","text":".x gen_tibble object backingfile @param backingfile path, including file name without extension, backing files used store data (given .bk .RDS automatically). left NULL (default), file name based name f current backing file. chunk_size number loci process quiet boolean suppress information files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_update_backingfile.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Update the backing matrix — gt_update_backingfile","text":"gen_tibble backing file (.e. new File Backed Matrix)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_uses_imputed.html","id":null,"dir":"Reference","previous_headings":"","what":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","title":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","text":"function checks dataset uses imputed data. Note possible dataset imputed currently using imputation.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_uses_imputed.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","text":"","code":"gt_uses_imputed(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_uses_imputed.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","text":"x gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_uses_imputed.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checks if a gen_tibble uses imputed data — gt_uses_imputed","text":"boolean TRUE FALSE depending whether dataset using imputed values","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_write_bigsnp_from_dfs.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a bigSNP object from data.frames — gt_write_bigsnp_from_dfs","title":"Create a bigSNP object from data.frames — gt_write_bigsnp_from_dfs","text":"function expects indiv_meta loci correct columns","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_write_bigsnp_from_dfs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a bigSNP object from data.frames — gt_write_bigsnp_from_dfs","text":"","code":"gt_write_bigsnp_from_dfs( genotypes, indiv_meta, loci, backingfile = NULL, ploidy = ploidy )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/gt_write_bigsnp_from_dfs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a bigSNP object from data.frames — gt_write_bigsnp_from_dfs","text":"genotypes genotype matrix indiv_meta individual meta information loci loci table","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/identify_pseudohaploids.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify pseudohaploids — identify_pseudohaploids","title":"Identify pseudohaploids — identify_pseudohaploids","text":"Pseudohaploids coded homozygotes; find checking first 'n_test' loci call pseudohaploid zero heterozygosity (strategy employed admixtools)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/identify_pseudohaploids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify pseudohaploids — identify_pseudohaploids","text":"","code":"identify_pseudohaploids(x, n_test = 1000)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/identify_pseudohaploids.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify pseudohaploids — identify_pseudohaploids","text":"x gen_tibble n_test number loci tested","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/identify_pseudohaploids.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify pseudohaploids — identify_pseudohaploids","text":"numeric vector ploidy","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_het_obs.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate individual observed heterozygosity — indiv_het_obs","title":"Estimate individual observed heterozygosity — indiv_het_obs","text":"Estimate observed heterozygosity (H_obs) individual (.e. frequency loci heterozygous individual).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_het_obs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate individual observed heterozygosity — indiv_het_obs","text":"","code":"indiv_het_obs(.x, ...) # S3 method for class 'tbl_df' indiv_het_obs(.x, ...) # S3 method for class 'vctrs_bigSNP' indiv_het_obs(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_het_obs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate individual observed heterozygosity — indiv_het_obs","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_het_obs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate individual observed heterozygosity — indiv_het_obs","text":"vector heterozygosities, one per individuals gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_inbreeding.html","id":null,"dir":"Reference","previous_headings":"","what":"Individual inbreeding coefficient — indiv_inbreeding","title":"Individual inbreeding coefficient — indiv_inbreeding","text":"function calculates inbreeding coefficient individual based beta estimate Weir Goudet (2017).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_inbreeding.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Individual inbreeding coefficient — indiv_inbreeding","text":"","code":"indiv_inbreeding(.x, method = c(\"WG17\"), allele_sharing_mat = NULL, ...) # S3 method for class 'tbl_df' indiv_inbreeding(.x, method = c(\"WG17\"), allele_sharing_mat = NULL, ...) # S3 method for class 'vctrs_bigSNP' indiv_inbreeding(.x, method = c(\"WG17\"), allele_sharing_mat = NULL, ...) # S3 method for class 'grouped_df' indiv_inbreeding(.x, method = c(\"WG17\"), allele_sharing_mat = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_inbreeding.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Individual inbreeding coefficient — indiv_inbreeding","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. method currently \"WG17\" (Weir Goudet 2017). allele_sharing_mat optional relevant \"WG17\", matrix Allele Sharing returned pairwise_allele_sharing() as_matrix=TRUE. number statistics can derived Allele Sharing matrix, sometimes efficient pre-compute matrix. possible use grouped tibbles. ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_inbreeding.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Individual inbreeding coefficient — indiv_inbreeding","text":"numeric vector inbreeding coefficients.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_missingness.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate individual missingness — indiv_missingness","title":"Estimate individual missingness — indiv_missingness","text":"Estimate missingness individual (.e. frequency missing genotypes individual).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_missingness.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate individual missingness — indiv_missingness","text":"","code":"indiv_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'tbl_df' indiv_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'vctrs_bigSNP' indiv_missingness(.x, as_counts = FALSE, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_missingness.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate individual missingness — indiv_missingness","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. as_counts boolean defining whether count NAs (rather rate) returned. defaults FALSE (.e. rates returned default). ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_missingness.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate individual missingness — indiv_missingness","text":"vector heterozygosities, one per individuals gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_ploidy.html","id":null,"dir":"Reference","previous_headings":"","what":"Return individual ploidy — indiv_ploidy","title":"Return individual ploidy — indiv_ploidy","text":"Returns ploidy individual.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_ploidy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return individual ploidy — indiv_ploidy","text":"","code":"indiv_ploidy(.x, ...) # S3 method for class 'tbl_df' indiv_ploidy(.x, ...) # S3 method for class 'vctrs_bigSNP' indiv_ploidy(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_ploidy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return individual ploidy — indiv_ploidy","text":".x gen_tibble, vector class vctrs_bigSNP (usually genotype column gen_tibble object) ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/indiv_ploidy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return individual ploidy — indiv_ploidy","text":"vector ploidy, one per individuals gen_tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/is_loci_table_ordered.html","id":null,"dir":"Reference","previous_headings":"","what":"Test if the loci table is ordered — is_loci_table_ordered","title":"Test if the loci table is ordered — is_loci_table_ordered","text":"functions checks SNPs chromosome adjacent loci table, positions sorted within chromosomes.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/is_loci_table_ordered.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test if the loci table is ordered — is_loci_table_ordered","text":"","code":"is_loci_table_ordered(.x, error_on_false = FALSE, ...) # S3 method for class 'tbl_df' is_loci_table_ordered(.x, error_on_false = FALSE, ...) # S3 method for class 'vctrs_bigSNP' is_loci_table_ordered(.x, error_on_false = FALSE, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/is_loci_table_ordered.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test if the loci table is ordered — is_loci_table_ordered","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. error_on_false logical, TRUE error thrown loci ordered. ... arguments passed specific methods.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/is_loci_table_ordered.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test if the loci table is ordered — is_loci_table_ordered","text":"logical vector defining loci transversions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_alt_freq.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate allele frequencies at each each locus — loci_alt_freq","title":"Estimate allele frequencies at each each locus — loci_alt_freq","text":"Allele frequencies can estimates minimum allele frequencies (MAF) loci_maf() frequency alternate allele (loci_alt_freq()). latter line genotypes matrix (e.g. extracted show_loci()). users interested MAF, raw frequencies might useful computing aggregated statistics.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_alt_freq.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate allele frequencies at each each locus — loci_alt_freq","text":"","code":"loci_alt_freq(.x, ...) # S3 method for class 'tbl_df' loci_alt_freq(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_alt_freq(.x, ...) # S3 method for class 'grouped_df' loci_alt_freq(.x, n_cores = bigstatsr::nb_cores(), ...) loci_maf(.x, ...) # S3 method for class 'tbl_df' loci_maf(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_maf(.x, ...) # S3 method for class 'grouped_df' loci_maf(.x, n_cores = bigstatsr::nb_cores(), ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_alt_freq.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate allele frequencies at each each locus — loci_alt_freq","text":".x vector class vctrs_bigSNP (usually genotypes column gen_tibble object), gen_tibble. ... arguments passed specific methods, currently unused. n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_alt_freq.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate allele frequencies at each each locus — loci_alt_freq","text":"vector frequencies, one per locus","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_chromosomes.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","title":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","text":"Extract loci chromosomes gen_tibble (directly genotype column).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_chromosomes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","text":"","code":"loci_chromosomes(.x, ...) # S3 method for class 'tbl_df' loci_chromosomes(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_chromosomes(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_chromosomes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","text":".x gen_tibble, vector class vctrs_bigSNP (usually genotype column gen_tibble object). ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_chromosomes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the chromosomes of loci in a gen_tibble — loci_chromosomes","text":"character vector chromosomes","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":null,"dir":"Reference","previous_headings":"","what":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"Return p-value exact test HWE.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"","code":"loci_hwe(.x, ...) # S3 method for class 'tbl_df' loci_hwe(.x, mid_p = TRUE, ...) # S3 method for class 'vctrs_bigSNP' loci_hwe(.x, mid_p = TRUE, ...) # S3 method for class 'grouped_df' loci_hwe(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":".x vector class vctrs_bigSNP (usually genotypes column gen_tibble object), gen_tibble. ... used. mid_p boolean whether mid-p value computed. Default TRUE, PLINK.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"vector probabilities HWE exact test, one per locus","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"function uses original C++ algorithm PLINK 1.90. NOTE tests function yet! Unit tests needed.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Test Hardy-Weinberg equilibrium at each locus — loci_hwe","text":"C++ algorithm written Christopher Chang PLINK 1.90, based original code Jan Wigginton (code released GPL3).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":null,"dir":"Reference","previous_headings":"","what":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":"function uses clumping remove SNPs high LD. used default options, clumping based MAF similar standard pruning (done PLINK \"–indep-pairwise (size+1) 1 thr.r2\", results better spread SNPs chromosome.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":"","code":"loci_ld_clump(.x, ...) # S3 method for class 'tbl_df' loci_ld_clump(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_ld_clump( .x, S = NULL, thr_r2 = 0.2, size = 100/thr_r2, exclude = NULL, use_positions = TRUE, n_cores = 1, return_id = FALSE, ... ) # S3 method for class 'grouped_df' loci_ld_clump(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":".x gen_tibble object ... currently used. S vector loci statistics express importance SNP (important SNP, greater corresponding statistic). example, S follows standard normal distribution, \"important\" means significantly different 0, must use abs(S) instead.specified, MAFs computed used. thr_r2 Threshold squared correlation two SNPs. Default 0.2. size one SNP, window size around SNP compute correlations. Default 100 / thr.r2 clumping (0.2 -> 500; 0.1 -> 1000; 0.5 -> 200). use_positions = FALSE, window number SNPs, otherwise window kb (genetic distance). Ideally, use positions, provide sensible approach. exclude Vector SNP indices exclude anyway. example, can used exclude long-range LD regions (see Price2008). Another use can thresholding respect p-values associated S. use_positions boolean, TRUE (default), size kb, FALSE size number SNPs. n_cores number cores used return_id boolean whether id SNPs keep returned. defaults FALSE, returns vector booleans (TRUE FALSE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":"boolean vector indicating whether SNP kept ('return_id = FALSE', default), else vector SNP indices kept ('return_id = TRUE')","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_ld_clump.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Clump loci based on a Linkage Disequilibrium threshold — loci_ld_clump","text":"missing values genotypes gen_tibble passed loci_ld_clump cause error. deal missingness, see gt_impute_simple().","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_missingness.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate missingness at each locus — loci_missingness","title":"Estimate missingness at each locus — loci_missingness","text":"Estimate rate missingness locus.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_missingness.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate missingness at each locus — loci_missingness","text":"","code":"loci_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'tbl_df' loci_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'vctrs_bigSNP' loci_missingness(.x, as_counts = FALSE, ...) # S3 method for class 'grouped_df' loci_missingness(.x, as_counts = FALSE, n_cores = bigstatsr::nb_cores(), ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_missingness.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate missingness at each locus — loci_missingness","text":".x vector class vctrs_bigSNP (usually genotypes column gen_tibble object), gen_tibble. as_counts boolean defining whether count NAs (rather rate) returned. defaults FALSE (.e. rates returned default). ... arguments passed specific methods. n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_missingness.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate missingness at each locus — loci_missingness","text":"vector frequencies, one per locus","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the names of loci in a gen_tibble — loci_names","title":"Get the names of loci in a gen_tibble — loci_names","text":"Extract loci names gen_tibble (directly genotype column).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the names of loci in a gen_tibble — loci_names","text":"","code":"loci_names(.x, ...) # S3 method for class 'tbl_df' loci_names(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_names(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_names.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the names of loci in a gen_tibble — loci_names","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_names.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the names of loci in a gen_tibble — loci_names","text":"character vector names","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transitions.html","id":null,"dir":"Reference","previous_headings":"","what":"Find transitions — loci_transitions","title":"Find transitions — loci_transitions","text":"Use loci table define loci transitions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transitions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find transitions — loci_transitions","text":"","code":"loci_transitions(.x, ...) # S3 method for class 'tbl_df' loci_transitions(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_transitions(.x, ...) # S3 method for class 'grouped_df' loci_transitions(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transitions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Find transitions — loci_transitions","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... arguments passed specific methods.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transitions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Find transitions — loci_transitions","text":"logical vector defining loci transitions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transversions.html","id":null,"dir":"Reference","previous_headings":"","what":"Find transversions — loci_transversions","title":"Find transversions — loci_transversions","text":"Use loci table define loci transversions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transversions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Find transversions — loci_transversions","text":"","code":"loci_transversions(.x, ...) # S3 method for class 'tbl_df' loci_transversions(.x, ...) # S3 method for class 'vctrs_bigSNP' loci_transversions(.x, ...) # S3 method for class 'grouped_df' loci_transversions(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transversions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Find transversions — loci_transversions","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... arguments passed specific methods.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/loci_transversions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Find transversions — loci_transversions","text":"logical vector defining loci transversions","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/new_vctrs_bigsnp.html","id":null,"dir":"Reference","previous_headings":"","what":"create a vctrs_bigSNP — new_vctrs_bigsnp","title":"create a vctrs_bigSNP — new_vctrs_bigsnp","text":"create vctrs_bigSNP","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/new_vctrs_bigsnp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"create a vctrs_bigSNP — new_vctrs_bigsnp","text":"","code":"new_vctrs_bigsnp(bigsnp_obj, bigsnp_file, indiv_id, ploidy = 2)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/new_vctrs_bigsnp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"create a vctrs_bigSNP — new_vctrs_bigsnp","text":"bigsnp_obj bigsnp object bigsnp_file file bigsnp object saved indiv_id ids individuals ploidy ploidy samples (either single value, vector values mixed ploidy).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/new_vctrs_bigsnp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"create a vctrs_bigSNP — new_vctrs_bigsnp","text":"vctrs_bigSNP object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_allele_sharing.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","title":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","text":"function computes Allele Sharing matrix. Estimates Allele Sharing (hierfstat::matching())) pairs individuals (locus, gives 1 two individuals homozygous allele, 0 homozygous different allele, 1/2 least one individual heterozygous. Matching average 0, 1/2 1s)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_allele_sharing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","text":"","code":"pairwise_allele_sharing( x, as_matrix = FALSE, block_size = bigstatsr::block_size(count_loci(x)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_allele_sharing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","text":"x gen_tibble object. as_matrix boolean, determining whether results square symmetrical matrix (TRUE), tidied tibble (FALSE, default) block_size maximum number loci read . loci improve speed, tax memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_allele_sharing.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Pairwise Allele Sharing Matrix for a gen_tibble object — pairwise_allele_sharing","text":"matrix allele sharing pairs individuals","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"function computes Genomic Relationship Matrix (GRM). estimated computing pairwise kinship coefficients (coancestries) pairs individuals matrix Allele Sharing follwng approach Weir Goudet 2017 based beta estimators).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"","code":"pairwise_grm( x, allele_sharing_mat = NULL, block_size = bigstatsr::block_size(count_loci(x)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"x gen_tibble object. allele_sharing_mat optional, matrix Allele Sharing returned pairwise_allele_sharing() as_matrix=TRUE. number statistics can derived Allele Sharing matrix, sometimes efficient pre-compute matrix. block_size size blocks use computation allele sharing matrix.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"matrix GR pairs individuals","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_grm.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the Genomic Relationship Matrix for a gen_tibble object — pairwise_grm","text":"GRM twice coancestry matrix (e.g. estimated hierfstat::beta.dosage() inb=FALSE).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"function computes IBS matrix.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"","code":"pairwise_ibs( x, as_matrix = FALSE, type = c(\"proportion\", \"adjusted_counts\", \"raw_counts\"), block_size = bigstatsr::block_size(count_loci(x)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"x gen_tibble object. as_matrix boolean, determining whether results square symmetrical matrix (TRUE), tidied tibble (FALSE, default) type one \"proportion\" (equivalent \"ibs\" PLINK), \"adjusted_counts\" (\"distance\" PLINK), \"raw_counts\" (counts identical alleles non-missing alleles, two quantities computed) block_size maximum number loci read . loci improve speed, tax memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"bigstatsr::FBM proportion adjusted counts, list two bigstatsr::FBM matrices, one counts IBS alleles, one number valid alleles (.e. 2n_loci - 2missing_loci)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_ibs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the Identity by State Matrix for a gen_tibble object — pairwise_ibs","text":"Note monomorphic sites currently considered. Remove monomorphic sites running pairwise_king concern.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_king.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","title":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","text":"function computes KING-robust estimator kinship.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_king.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","text":"","code":"pairwise_king( x, as_matrix = FALSE, block_size = bigstatsr::block_size(length(loci_names(x))) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_king.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","text":"x gen_tibble object. as_matrix boolean, determining whether results square symmetrical matrix (TRUE), tidied tibble (FALSE, default) block_size maximum number loci read . loci improve speed, tax memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_king.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the KING-robust Matrix for a a gen_tibble object — pairwise_king","text":"Note monomorphic sites currently considered. Remove monomorphic sites running pairwise_king concern.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute pairwise population Fst — pairwise_pop_fst","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"function computes pairwise Fst. following methods implemented: 'Hudson': Hudson's formulation, derived Bhatia et al (2013) diploids. 'Nei86' : Gst according Nei (1986), derived Bhatia et al (2013) diploids. 'Nei87' : Fst according Nei (1987) - equivalent hierfstat::pairwise.neifst(), includes correction heterozygosity computing Ht 'WC84' : Weir Cockerham (1984), derived Bhatia et al (2013) diploids.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"","code":"pairwise_pop_fst( .x, by_locus = FALSE, method = c(\"Hudson\", \"Nei87\", \"Nei86\", \"WC84\"), n_cores = bigstatsr::nb_cores() )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute pairwise population Fst — pairwise_pop_fst","text":".x grouped gen_tibble (obtained using dplyr::group_by()) by_locus boolean, determining whether Fst returned locus(TRUE), single genome wide value obtained taking ratio mean numerator denominator (FALSE, default). method one 'Hudson', 'Nei86', 'Nei87', 'WC84' n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"tibble genome-wide pairwise Fst values pairwise combination row \"by_locus=FALSE\", else list including tibble genome-wide values well matrix pairwise Fst locus loci rows pairwise combinations columns.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"formulae, genome wide estimate obtained taking ratio mean numerators denominators relevant SNPs.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pairwise_pop_fst.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute pairwise population Fst — pairwise_pop_fst","text":"Bhatia G, Patterson N, Sankararaman S, Price AL. Estimating Interpreting FST: Impact Rare Variants. Genome Research. 2013;23(9):1514–1521. Nei, M. (1987) Molecular Evolutionary Genetics. Columbia University Press","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute population specific FIS — pop_fis","title":"Compute population specific FIS — pop_fis","text":"function computes population specific FIS, using either approach Nei 1987 (computed hierfstat::basic.stats()) Weir Goudet 2017 (computed hierfstat::fis.dosage()).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute population specific FIS — pop_fis","text":"","code":"pop_fis( .x, method = c(\"Nei87\", \"WG17\"), by_locus = FALSE, include_global = FALSE, allele_sharing_mat = NULL )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute population specific FIS — pop_fis","text":".x grouped gen_tibble (obtained using dplyr::group_by()) method one \"Nei87\" (based Nei 1987, eqn 7.41) \"WG17\" (Weir Goudet 2017) compute FIS by_locus boolean, determining whether FIS returned locus(TRUE), single genome wide value (FALSE, default). Note relevant \"Nei87\", \"WG17\" always returns single value. include_global boolean determining whether, besides population specific estiamtes, global estimate appended. Note return vector n populations plus 1 (global value), matrix n+1 columns by_locus=TRUE. allele_sharing_mat optional relevant \"WG17\", matrix Allele Sharing returned pairwise_allele_sharing() as_matrix=TRUE. number statistics can derived Allele Sharing matrix, sometimes efficient pre-compute matrix.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute population specific FIS — pop_fis","text":"vector population specific fis (plus global value include_global=TRUE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fis.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute population specific FIS — pop_fis","text":"Nei M. (1987) Molecular Evolutionary Genetics. Columbia University Press Weir, BS Goudet J (2017) Unified Characterization Population Structure Relatedness. Genetics (2017) 206:2085","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute population specific Fst — pop_fst","title":"Compute population specific Fst — pop_fst","text":"function computes population specific Fst, using approach Weir Goudet 2017 (computed hierfstat::fst.dosage()).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute population specific Fst — pop_fst","text":"","code":"pop_fst(.x, include_global = FALSE, allele_sharing_mat = NULL)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute population specific Fst — pop_fst","text":".x grouped gen_tibble (obtained using dplyr::group_by()) include_global boolean determining whether, besides population specific Fst, global Fst appended. Note return vector n populations plus 1 (global value) allele_sharing_mat optional, matrix Allele Sharing returned pairwise_allele_sharing() as_matrix=TRUE. number statistics can derived Allele Sharing matrix,","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute population specific Fst — pop_fst","text":"vector population specific Fst (plus global value include_global=TRUE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_fst.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute population specific Fst — pop_fst","text":"Weir, BS Goudet J (2017) Unified Characterization Population Structure Relatedness. Genetics (2017) 206:2085","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute basic population global statistics — pop_global_stats","title":"Compute basic population global statistics — pop_global_stats","text":"function computes basic population global statistics, following notation Nei 1987 (turn based Nei Chesser 1983): observed heterozygosity ( \\(\\hat{h}_o\\), column header Ho) expected heterozygosity, also known gene diversity ( \\(\\hat{h}_s\\), Hs) total heterozygosity ( \\(\\hat{h}_t\\), Ht) genetic differentiation subpopulations (\\(D_{st}\\), Dst) corrected total population diversity (\\(h'_t\\), Htp) corrected genetic differentiation subpopulations (\\(D'_{st}\\), Dstp) \\(\\hat{F}_{ST}\\) (column header, Fst) corrected \\(\\hat{F'}_{ST}\\) (column header Fstp) \\(\\hat{F}_{}\\) (column header, Fis) Jost's \\(\\hat{D}\\) (column header, Dest)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute basic population global statistics — pop_global_stats","text":"","code":"pop_global_stats(.x, by_locus = FALSE, n_cores = bigstatsr::nb_cores())"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute basic population global statistics — pop_global_stats","text":".x gen_tibble (usually grouped, obtained using dplyr::group_by(); use single population return number quantities NA/NaN) by_locus boolean, determining whether statistics returned locus(TRUE), single genome wide value (FALSE, default). n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute basic population global statistics — pop_global_stats","text":"tibble population statistics, populations rows statistics columns","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute basic population global statistics — pop_global_stats","text":"use notation Nei 1987. notation loci \\(m\\) alleles, case two alleles, m=2. Within population observed heterozygosity \\(\\hat{h}_o\\) locus \\(m\\) alleles defined : \\(\\hat{h}_o= 1-\\sum_{k=1}^{s} \\sum_{=1}^{m} \\hat{X}_{kii}/s\\) \\(\\hat{X}_{kii}\\) represents proportion homozygote \\(\\) sample \\(k\\)th population \\(s\\) number populations, following equation 7.38 Nei(1987) pp.164. Within population expected heterozygosity (gene diversity) \\(\\hat{h}_s\\) locus \\(m\\) alleles defined : \\(\\hat{h}_s=(\\tilde{n}/(\\tilde{n}-1))[1-\\sum_{=1}^{m}\\bar{\\hat{x}_i^2}-\\hat{h}_o/2\\tilde{n}]\\) \\(\\tilde{n}=s/\\sum_k 1/n_k\\) (.e harmonic mean \\(n_k\\)) \\(\\bar{\\hat{x}_i^2}=\\sum_k \\hat{x}_{ki}^2/s\\) following equation 7.39 Nei(1987) pp.164. Total heterozygosity (total gene diversity) \\(\\hat{h}_t\\) locus \\(m\\) alleles defined : \\(\\hat{h}_t = 1-\\sum_{=1}^{m} \\bar{\\hat{x}_i^2} + \\hat{h}_s/(\\tilde{n}s) - \\hat{h}_o/(2\\tilde{n}s)\\) \\(\\hat{x}_i=\\sum_k \\hat{x}_{ki}/s\\) following equation 7.40 Nei(1987) pp.164. amount gene diversity among samples \\(D_{ST}\\) defined : \\(D_{ST} = \\hat{h}_t - \\hat{h}_s\\) following equation provided text top page 165 Nei(1987). corrected amount gene diversity among samples \\(D'_{ST}\\) defined : \\(D'_{ST} = (s/(s-1))D'_{ST}\\) following equation provided text top page 165 Nei(1987). Total corrected heterozygosity (total gene diversity) \\(\\hat{h}_t\\) defined : \\(\\hat{h'}_t = \\hat{h}_s + D'_{ST}\\) following equation provided text top page 165 Nei(1987). \\(\\hat{F}_{}\\) defined : \\(\\hat{F}_{} = 1 - \\hat{h}_o/\\hat{h}_s\\) following equation 7.41 Nei(1987) pp.164. \\(\\hat{F}_{ST}\\) defined : \\(\\hat{F}_{ST} = 1 - \\hat{h}_s/\\hat{h}_t = D_{ST}/\\hat{h}_t\\) following equation 7.43 Nei(1987) pp.165. \\(\\hat{F'}_{ST}\\) defined : \\(\\hat{F'}_{ST} = D'_{ST}/\\hat{h'}_t\\) following explanation provided text top page 165 Nei(1987). Jost's \\(\\hat{D}\\) defined : \\(\\hat{D} = (s/(s-1))((\\hat{h'}_t-\\hat{h}_s)/(1-\\hat{h}_s))\\) defined Jost(2008) statistics first computed locus, averaged across loci (including monorphic locus) obtain genome-wide values. function uses algorithm hierfstat::basic.stats() optimized speed memory usage.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_global_stats.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute basic population global statistics — pop_global_stats","text":"Nei M, Chesser R (1983) Estimation fixation indexes gene diversities. Annals Human Genetics, 47, 253-259. Nei M. (1987) Molecular Evolutionary Genetics. Columbia University Press, pp. 164-165. Jost L (2008) GST relatives measure differentiation. Molecular Ecology, 17, 4015-4026.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the population expected heterozygosity — pop_het_exp","title":"Compute the population expected heterozygosity — pop_het_exp","text":"function computes expected population heterozygosity (also referred gene diversity, avoid potentially misleading use term \"expected\" context), using formula Nei (1987).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the population expected heterozygosity — pop_het_exp","text":"","code":"pop_het_exp( .x, by_locus = FALSE, include_global = FALSE, n_cores = bigstatsr::nb_cores() ) pop_gene_div( .x, by_locus = FALSE, include_global = FALSE, n_cores = bigstatsr::nb_cores() )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the population expected heterozygosity — pop_het_exp","text":".x gen_tibble (usually grouped, obtained using dplyr::group_by(), otherwise full tibble considered belonging single population). by_locus boolean, determining whether Hs returned locus(TRUE), single genome wide value (FALSE, default). include_global boolean determining whether, besides population specific estiamtes, global estimate appended. Note return vector n populations plus 1 (global value), matrix n+1 columns by_locus=TRUE. n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the population expected heterozygosity — pop_het_exp","text":"vector mean population observed heterozygosities (by_locus=FALSE), matrix estimates locus (rows loci, columns populations, by_locus=TRUE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the population expected heterozygosity — pop_het_exp","text":"Within population expected heterozygosity (gene diversity) \\(\\hat{h}_s\\) locus \\(m\\) alleles defined : \\(\\hat{h}_s=\\tilde{n}/(\\tilde{n}-1)[1-\\sum_{}^{m}\\bar{\\hat{x}_i^2}-\\hat{h}_o/2\\tilde{n}]\\) \\(\\tilde{n}=s/\\sum_k 1/n_k\\) (.e harmonic mean \\(n_k\\)) \\(\\bar{\\hat{x}_i^2}=\\sum_k \\hat{x}_{ki}^2/s\\) following equation 7.39 Nei(1987) pp.164. specific case, two alleles, \\(m=2\\). \\(\\hat{h}_s\\) genome level population simply mean locus estimates population.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_exp.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute the population expected heterozygosity — pop_het_exp","text":"Nei M. (1987) Molecular Evolutionary Genetics. Columbia University Press","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the population observed heterozygosity — pop_het_obs","title":"Compute the population observed heterozygosity — pop_het_obs","text":"function computes population heterozygosity, using formula Nei (1987).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the population observed heterozygosity — pop_het_obs","text":"","code":"pop_het_obs( .x, by_locus = FALSE, include_global = FALSE, n_cores = bigstatsr::nb_cores() )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the population observed heterozygosity — pop_het_obs","text":".x gen_tibble (usually grouped, obtained using dplyr::group_by(), otherwise full tibble considered belonging single population). by_locus boolean, determining whether Ho returned locus(TRUE), single genome wide value (FALSE, default). include_global boolean determining whether, besides population specific estiamtes, global estimate appended. Note return vector n populations plus 1 (global value), matrix n+1 columns by_locus=TRUE. n_cores number cores used, defaults bigstatsr::nb_cores()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the population observed heterozygosity — pop_het_obs","text":"vector mean population observed heterozygosities (by_locus=FALSE), matrix estimates locus (rows loci, columns populations, by_locus=TRUE)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the population observed heterozygosity — pop_het_obs","text":"Within population observed heterozygosity \\(\\hat{h}_o\\) locus \\(m\\) alleles defined : \\(\\hat{h}_o= 1-\\sum_{k=1}^{s} \\sum_{=1}^{m} \\hat{X}_{kii}/s\\) \\(\\hat{X}_{kii}\\) represents proportion homozygote \\(\\) sample \\(k\\)th population \\(s\\) number populations, following equation 7.38 Nei(1987) pp.164. specific case, two alleles, \\(m=2\\). population specific estimates, sum done single value \\(k\\). \\(\\hat{h}_o\\) genome level simply mean locus estimates.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/pop_het_obs.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute the population observed heterozygosity — pop_het_obs","text":"Nei M. (1987) Molecular Evolutionary Genetics. Columbia University Press","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Predict scores of a PCA — predict.gt_pca","title":"Predict scores of a PCA — predict.gt_pca","text":"Predict PCA scores gt_pca, either original data projecting new data.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Predict scores of a PCA — predict.gt_pca","text":"","code":"# S3 method for class 'gt_pca' predict( object, new_data = NULL, project_method = c(\"none\", \"simple\", \"OADP\", \"least_squares\"), lsq_pcs = c(1, 2), block_size = NULL, n_cores = 1, ... )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Predict scores of a PCA — predict.gt_pca","text":"object gt_pca object new_data gen_tibble scores requested new dataset project_method string taking value either \"simple\", \"OADP\" (Online Augmentation, Decomposition, Procrustes (OADP) projection), \"least_squares\" (done SMARTPCA) lsq_pcs vector length two values two principal components use least square fitting. relevant ifproject_method = 'least_squares' block_size number loci read simultaneously (larger values speed computation, require memory) n_cores number cores ... used","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Predict scores of a PCA — predict.gt_pca","text":"matrix predictions, samples rows components columns. number components depends many estimated gt_pca object.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/predict_gt_pca.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Predict scores of a PCA — predict.gt_pca","text":"Zhang et al (2020). Fast robust ancestry prediction using principal component analysis 36(11): 3439–3446.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a standard matrix to a q_matrix object — q_matrix","title":"Convert a standard matrix to a q_matrix object — q_matrix","text":"Takes single Q matrix exists either matrix data frame returns q_matrix object.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a standard matrix to a q_matrix object — q_matrix","text":"","code":"q_matrix(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a standard matrix to a q_matrix object — q_matrix","text":"x matrix data frame","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a standard matrix to a q_matrix object — q_matrix","text":"q_matrix object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_indiv.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Quality Control report for individuals — qc_report_indiv","title":"Create a Quality Control report for individuals — qc_report_indiv","text":"#' Return QC information assess loci (Observed heterozygosity missingness).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_indiv.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Quality Control report for individuals — qc_report_indiv","text":"","code":"qc_report_indiv(.x, ...) # S3 method for class 'tbl_df' qc_report_indiv(.x, kings_threshold = NULL, ...) # S3 method for class 'grouped_df' qc_report_indiv(.x, kings_threshold = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_indiv.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Quality Control report for individuals — qc_report_indiv","text":".x either gen_tibble object grouped gen_tibble (obtained using dplyr::group_by()) ... arguments pass kings_threshold optional numeric, threshold relatedness sample","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_indiv.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Quality Control report for individuals — qc_report_indiv","text":"tibble 2 elements: het_obs missingness","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Quality Control report for loci — qc_report_loci","title":"Create a Quality Control report for loci — qc_report_loci","text":"Return QC information assess loci (MAF, missingness HWE test).","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Quality Control report for loci — qc_report_loci","text":"","code":"qc_report_loci(.x, ...) # S3 method for class 'tbl_df' qc_report_loci(.x, ...) # S3 method for class 'grouped_df' qc_report_loci(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Quality Control report for loci — qc_report_loci","text":".x gen_tibble object. ... currently unused HWE test.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/qc_report_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Quality Control report for loci — qc_report_loci","text":"tibble 3 elements: maf, missingness hwe_p","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":null,"dir":"Reference","previous_headings":"","what":"Combine two gen_tibbles — rbind.gen_tbl","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"function combined two gen_tibbles. defaults, subsets loci swaps ref alt alleles make two datasets compatible (behaviour can switched as_is). first object used \"reference\" , SNPs dataset flipped /alleles swapped needed. SNPs different alleles two datasets (.e. triallelic) also dropped. also options (default) attempt strand flipping match alleles (often needed human datasets different SNP chips), remove ambiguous alleles (C/G /T) correct strand can guessed.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"","code":"# S3 method for class 'gen_tbl' rbind( ..., as_is = FALSE, flip_strand = FALSE, use_position = FALSE, quiet = FALSE, backingfile = NULL )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"... two gen_tibble objects. Note function can take objects, rbind done sequentially large sets objects. as_is boolean determining whether loci left merging. FALSE (defaults), rbind attempt subset swap alleles needed. flip_strand boolean whether strand flipping checked match two datasets. set TRUE, ambiguous SNPs (.e. /T C/G) also removed. defaults FALSE use_position boolean whether combination chromosome position used matching SNPs. default, rbind uses locus name, set FALSE. using 'use_position=TRUE', make sure chromosomes coded way gen_tibbles (mix e.g. 'chr1', '1' 'chromosome1' can reasons unexpectedly large number variants dropped merging). quiet boolean whether omit reporting screen backingfile path prefix files used store merged data (.RDS store bigSNP object .bk file backing file FBM)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"gen_tibble merged data.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Combine two gen_tibbles — rbind.gen_tbl","text":"rbind differs merging data plink, swaps order allele1 allele2 according minor allele frequency merging datasets. rbind flips /swaps alleles according reference dataset, according allele frequency.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind_dry_run.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","title":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","text":"function provides overview fate SNP two gen_tibble objects case merge. SNPs found objects kept. One object used reference, SNPs dataset flipped /alleles swapped needed. SNPs different alleles two datasets also dropped.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind_dry_run.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","text":"","code":"rbind_dry_run( ref, target, use_position = FALSE, flip_strand = FALSE, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind_dry_run.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","text":"ref either gen_tibble object, path PLINK bim file; alleles objects used template flip ones target /swap order necessary. target either gen_tibble object, path PLINK bim file use_position boolean whether combination chromosome position used matching SNPs. default, rbind uses locus name, set FALSE. using 'use_position=TRUE', make sure chromosomes coded way gen_tibbles (mix e.g. 'chr1', '1' 'chromosome1' can reasons unexpectedly large number variants dropped merging). flip_strand boolean whether strand flipping checked match two datasets. Ambiguous SNPs (.e. /T C/G) also removed. defaults FALSE quiet boolean whether omit reporting screen","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/rbind_dry_run.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a report of what would happen to each SNP in a merge — rbind_dry_run","text":"list two data.frames, named target ref. data.frame nrow() equal number loci respective dataset, column id locus name, boolean columns to_keep (valid loci kept merge), alleles_mismatched (loci found datasets mismatched alleles, leading loci dropped), to_flip (loci need flipped align two datasets, found target data.frame) to_swap (loci order alleles needs swapped align two datasets, target data.frame)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/read_q_files.html","id":null,"dir":"Reference","previous_headings":"","what":"Read and structure .Q files or existing matrices as q_matrix or gt_admix objects. — read_q_files","title":"Read and structure .Q files or existing matrices as q_matrix or gt_admix objects. — read_q_files","text":"function reads .Q matrix files generated external clustering algorithms (ADMIXTURE) transforms gt_admix objects.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/read_q_files.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read and structure .Q files or existing matrices as q_matrix or gt_admix objects. — read_q_files","text":"","code":"read_q_files(x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/read_q_files.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read and structure .Q files or existing matrices as q_matrix or gt_admix objects. — read_q_files","text":"x can : path directory containing .Q files","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/read_q_files.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read and structure .Q files or existing matrices as q_matrix or gt_admix objects. — read_q_files","text":"gt_admix object containing list Q matrices list indices Q matrix separated K","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. generics augment, tidy ggplot2 autoplot","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/scale_fill_distruct.html","id":null,"dir":"Reference","previous_headings":"","what":"Scale constructor using the distruct colours — scale_fill_distruct","title":"Scale constructor using the distruct colours — scale_fill_distruct","text":"wrapper around ggplot2::scale_fill_manual(), using distruct colours distruct_colours.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/scale_fill_distruct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scale constructor using the distruct colours — scale_fill_distruct","text":"","code":"scale_fill_distruct(guide = \"none\", ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/scale_fill_distruct.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scale constructor using the distruct colours — scale_fill_distruct","text":"guide guide function passed ggplot2::scale_fill_manual(). Defaults \"none\", set \"legend\" legend required. ... parameters passed ggplot2::scale_fill_manual()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/scale_fill_distruct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Scale constructor using the distruct colours — scale_fill_distruct","text":"scale constructor used ggplot","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"The select verb for loci — select_loci","title":"The select verb for loci — select_loci","text":"equivalent dplyr::select() works genotype column gen_tibble, using mini-grammar available tidyselect. select-like evaluation access names loci (.e. can select based names, summary statistics loci; look select_loci_if() feature.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The select verb for loci — select_loci","text":"","code":"select_loci(.data, .sel_arg)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The select verb for loci — select_loci","text":".data gen_tibble .sel_arg one unquoted expression, using mini-grammar dplyr::select() select loci. Variable names can used positions data frame, expressions like x:y can used select range variables.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"The select verb for loci — select_loci","text":"gen_tibble subset loci.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The select verb for loci — select_loci","text":"Note select_loci verb modify backing FBM files, rather subsets list loci used stored gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci_if.html","id":null,"dir":"Reference","previous_headings":"","what":"The select_if verb for loci — select_loci_if","title":"The select_if verb for loci — select_loci_if","text":"equivalent dplyr::select_if() works genotype column gen_tibble. function access genotypes (thus can work summary statistics select), names loci (look select_loci() feature.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci_if.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The select_if verb for loci — select_loci_if","text":"","code":"select_loci_if(.data, .sel_logical)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci_if.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The select_if verb for loci — select_loci_if","text":".data gen_tibble .sel_logical logical vector length equal number loci, expression tidy evaluate vector. loci .sel_logical TRUE selected; NA treated FALSE.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/select_loci_if.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The select_if verb for loci — select_loci_if","text":"#' Note select_loci_if verb modify backing FBM files, rather subsets list loci used stored gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_genotypes.html","id":null,"dir":"Reference","previous_headings":"","what":"Show the genotypes of a gen_tibble — show_genotypes","title":"Show the genotypes of a gen_tibble — show_genotypes","text":"Extract genotypes (matrix) gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_genotypes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show the genotypes of a gen_tibble — show_genotypes","text":"","code":"show_genotypes(.x, indiv_indices = NULL, loci_indices = NULL, ...) # S3 method for class 'tbl_df' show_genotypes(.x, indiv_indices = NULL, loci_indices = NULL, ...) # S3 method for class 'vctrs_bigSNP' show_genotypes(.x, indiv_indices = NULL, loci_indices = NULL, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_genotypes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show the genotypes of a gen_tibble — show_genotypes","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. indiv_indices indices individuals loci_indices indices loci ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_genotypes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show the genotypes of a gen_tibble — show_genotypes","text":"matrix counts alternative alleles (see show_loci()) extract information alleles loci gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Show the loci information of a gen_tibble — show_loci","title":"Show the loci information of a gen_tibble — show_loci","text":"Extract set information loci gen_tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show the loci information of a gen_tibble — show_loci","text":"","code":"show_loci(.x, ...) # S3 method for class 'tbl_df' show_loci(.x, ...) # S3 method for class 'vctrs_bigSNP' show_loci(.x, ...) show_loci(.x) <- value # S3 method for class 'tbl_df' show_loci(.x) <- value # S3 method for class 'vctrs_bigSNP' show_loci(.x) <- value"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_loci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show the loci information of a gen_tibble — show_loci","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... currently unused. value data.frame tibble loci information replace current one.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_loci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show the loci information of a gen_tibble — show_loci","text":"tibble::tibble information (see gen_tibble details compulsory columns always present)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_ploidy.html","id":null,"dir":"Reference","previous_headings":"","what":"Show the ploidy information of a gen_tibble — show_ploidy","title":"Show the ploidy information of a gen_tibble — show_ploidy","text":"Extract ploidy information gen_tibble. NOTE function return ploidy level individual (obtained indiv_ploidy); instead, returns integer either ploidy level individuals (e.g. 2 indicates individuals diploid), 0 indicate mixed ploidy.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_ploidy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show the ploidy information of a gen_tibble — show_ploidy","text":"","code":"show_ploidy(.x, ...) # S3 method for class 'tbl_df' show_ploidy(.x, ...) # S3 method for class 'vctrs_bigSNP' show_ploidy(.x, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_ploidy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show the ploidy information of a gen_tibble — show_ploidy","text":".x vector class vctrs_bigSNP (usually genotype column gen_tibble object), gen_tibble. ... currently unused.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/show_ploidy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Show the ploidy information of a gen_tibble — show_ploidy","text":"ploidy (0 indicates mixed ploidy)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_allele_sharing.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","title":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","text":"function computes Allele Sharing matrix. Estimates Allele Sharing (matching hierfstat)) pairs individuals (locus, gives 1 two individuals homozygous allele, 0 homozygous different allele, 1/2 least one individual heterozygous. Matching average 0, 1/2 1s)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_allele_sharing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","text":"","code":"snp_allele_sharing( X, ind.row = bigstatsr::rows_along(X), ind.col = bigstatsr::cols_along(X), block.size = bigstatsr::block_size(nrow(X)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_allele_sharing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","text":"X bigstatsr::FBM.code256 matrix (found genotypes slot bigsnpr::bigSNP object). ind.row optional vector row indices used. specified, rows used. use negative indices. ind.col optional vector column indices used. specified, columns used. use negative indices. block.size maximum number columns read . Note , optimise speed matrix operations, store memory 3 times columns.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_allele_sharing.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Pairwise Allele Sharing Matrix for a bigSNP object — snp_allele_sharing","text":"matrix allele sharing pairs individuals","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":"function computes IBS matrix.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":"","code":"snp_ibs( X, ind.row = bigstatsr::rows_along(X), ind.col = bigstatsr::cols_along(X), type = c(\"proportion\", \"adjusted_counts\", \"raw_counts\"), block.size = bigstatsr::block_size(nrow(X)) )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":"X bigstatsr::FBM.code256 matrix (found genotypes slot bigsnpr::bigSNP object). ind.row optional vector row indices used. specified, rows used. use negative indices. ind.col optional vector column indices used. specified, columns used. use negative indices. type one \"proportion\" (equivalent \"ibs\" PLINK), \"adjusted_counts\" (\"distance\" PLINK), \"raw_counts\" (counts identical alleles non-missing alleles, two quantities computed) block.size maximum number columns read . Note , optimise speed matrix operations, store memory 3 times columns.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":".counts = TRUE function returns list two bigstatsr::FBM matrices, one counts IBS alleles (.e. 2*n loci), one valid alleles (.e. 2 * n_loci - 2 * missing_loci). .counts = FALSE returns single matrix IBS proportions.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_ibs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the Identity by State Matrix for a bigSNP object — snp_ibs","text":"Note monomorphic sites currently counted. filter beforehand? plink ?","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_king.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the KING-robust Matrix for a bigSNP object — snp_king","title":"Compute the KING-robust Matrix for a bigSNP object — snp_king","text":"function computes KING-robust estimator kinship.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_king.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the KING-robust Matrix for a bigSNP object — snp_king","text":"","code":"snp_king( X, ind.row = bigstatsr::rows_along(X), ind.col = bigstatsr::cols_along(X), block.size = bigstatsr::block_size(nrow(X)) * 4 )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/snp_king.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the KING-robust Matrix for a bigSNP object — snp_king","text":"X bigstatsr::FBM.code256 matrix (found genotypes slot bigsnpr::bigSNP object). ind.row optional vector row indices used. specified, rows used. use negative indices. ind.col optional vector column indices used. specified, columns used. use negative indices. block.size maximum number columns read .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/stopifnot_gen_tibble.html","id":null,"dir":"Reference","previous_headings":"","what":"Test if a tibble is really gen_tibble — stopifnot_gen_tibble","title":"Test if a tibble is really gen_tibble — stopifnot_gen_tibble","text":"dplyr operations strip subclass tibble. function used check tibble , reality, still class gen_tbl","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/stopifnot_gen_tibble.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test if a tibble is really gen_tibble — stopifnot_gen_tibble","text":"","code":"stopifnot_gen_tibble(.x)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/stopifnot_gen_tibble.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test if a tibble is really gen_tibble — stopifnot_gen_tibble","text":".x tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/subset_bigSNP.html","id":null,"dir":"Reference","previous_headings":"","what":"Subset a bigSNP object — subset_bigSNP","title":"Subset a bigSNP object — subset_bigSNP","text":"function subsets bigsnpr::bigSNP object, creating new backing file information subsetted reorders required.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/subset_bigSNP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Subset a bigSNP object — subset_bigSNP","text":"","code":"subset_bigSNP( X, indiv_indices = NULL, loci_indices = NULL, swap_indices = NULL, backingfile = NULL )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/subset_bigSNP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Subset a bigSNP object — subset_bigSNP","text":"X bigsnpr::bigSNP object subset indiv_indices indices individuals (rows) keep loci_indices indices loci (columns) keep swap_indices indices loci alleles swapped (bim table genotypes) backingfile backing file (null, tempfile used)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/subset_bigSNP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Subset a bigSNP object — subset_bigSNP","text":"bigsnpr::bigSNP object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary.gt_admix.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary method for gt_admix objects — summary.gt_admix","title":"Summary method for gt_admix objects — summary.gt_admix","text":"Summary method gt_admix objects","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary.gt_admix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary method for gt_admix objects — summary.gt_admix","text":"","code":"# S3 method for class 'gt_admix' summary(object, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary.gt_admix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary method for gt_admix objects — summary.gt_admix","text":"object gt_admix object ... unused (necessary compatibility generic function)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary.gt_admix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary method for gt_admix objects — summary.gt_admix","text":"summary gt_admix object","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary_rbind_dry_run.html","id":null,"dir":"Reference","previous_headings":"","what":"Print a summary of a merge report — summary.rbind_report","title":"Print a summary of a merge report — summary.rbind_report","text":"function creates summary merge report generated rbind_dry_run()","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary_rbind_dry_run.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print a summary of a merge report — summary.rbind_report","text":"","code":"# S3 method for class 'rbind_report' summary(object, ..., ref_label = \"reference\", target_label = \"target\")"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary_rbind_dry_run.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print a summary of a merge report — summary.rbind_report","text":"object list generated rbind_dry_run() ... unused (necessary compatibility generic function) ref_label label reference dataset (defaults \"reference\") target_label label target dataset (defaults \"target\")","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/summary_rbind_dry_run.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Print a summary of a merge report — summary.rbind_report","text":"NULL (prints summary console)","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/theme_distruct.html","id":null,"dir":"Reference","previous_headings":"","what":"A theme to match the output of distruct — theme_distruct","title":"A theme to match the output of distruct — theme_distruct","text":"theme remove plot decorations, matching look plots created distruct.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/theme_distruct.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A theme to match the output of distruct — theme_distruct","text":"","code":"theme_distruct()"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/theme_distruct.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A theme to match the output of distruct — theme_distruct","text":"ggplot2::theme","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.gt_dapc.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a gt_dapc object — tidy.gt_dapc","title":"Tidy a gt_dapc object — tidy.gt_dapc","text":"summarizes information components gt_dapc tidypopgen package. parameter matrix determines element returned.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.gt_dapc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a gt_dapc object — tidy.gt_dapc","text":"","code":"# S3 method for class 'gt_dapc' tidy(x, matrix = \"eigenvalues\", ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.gt_dapc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a gt_dapc object — tidy.gt_dapc","text":"x gt_dapc object (returned gt_dapc()). matrix Character specifying component DAPC tidied. \"samples\", \"scores\", \"x\": returns information map original space least discriminant axes. \"v\", \"rotation\", \"loadings\" \"variables\": returns information map discriminant axes space back original space (.e. genotype frequencies). Note different loadings linking PCA scores (available element $loadings dapc object). \"d\", \"eigenvalues\" \"lds\": returns information eigenvalues. ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.gt_dapc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tidy a gt_dapc object — tidy.gt_dapc","text":"tibble::tibble columns depending component DAPC tidied. \"scores\" row tidied output corresponds original data PCA space. columns : row ID original observation (.e. rowname original data). LD Integer indicating principal component. value score observation particular principal component. , location observation PCA space. matrix \"loadings\", row tidied output corresponds information principle components original space. columns : row variable labels (colnames) data set PCA performed. LD integer vector indicating principal component. value value eigenvector (axis score) indicated principal component. \"eigenvalues\", columns : LD integer vector indicating discriminant axis. std.dev Standard deviation (.e. sqrt(eig/(n-1))) explained DA (compatibility prcomp. cumulative Cumulative variation explained principal components component (note phrased percentage total variance, since many methods estimate truncated SVD.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.q_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a Q matrix — tidy.q_matrix","title":"Tidy a Q matrix — tidy.q_matrix","text":"Takes q_matrix object, matrix, returns tidied tibble.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.q_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a Q matrix — tidy.q_matrix","text":"","code":"# S3 method for class 'q_matrix' tidy(x, data, ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.q_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a Q matrix — tidy.q_matrix","text":"x Q matrix object (returned q_matrix). data associated tibble (e.g. gen_tibble), individuals order data used generate Q matrix ... currently used","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy.q_matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tidy a Q matrix — tidy.q_matrix","text":"tidied tibble","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy_gt_pca.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a gt_pca object — tidy.gt_pca","title":"Tidy a gt_pca object — tidy.gt_pca","text":"summarizes information components gt_pca tidypopgen package. parameter matrix determines element returned. Column names tidied output match returned broom::tidy.prcomp, tidier standard PCA objects returned stats::prcomp.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy_gt_pca.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a gt_pca object — tidy.gt_pca","text":"","code":"# S3 method for class 'gt_pca' tidy(x, matrix = \"eigenvalues\", ...)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy_gt_pca.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a gt_pca object — tidy.gt_pca","text":"x gt_pca object returned one gt_pca_* functions. matrix Character specifying component PCA tidied. \"samples\", \"scores\", \"x\": returns information map original space principle components space (equivalent product u d). \"v\", \"rotation\", \"loadings\" \"variables\": returns information map principle components space back original space. \"d\", \"eigenvalues\" \"pcs\": returns information eigenvalues. ... used. Needed match generic signature .","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidy_gt_pca.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tidy a gt_pca object — tidy.gt_pca","text":"tibble::tibble columns depending component PCA tidied. \"scores\" row tidied output corresponds original data PCA space. columns : row ID original observation (.e. rowname original data). PC Integer indicating principal component. value score observation particular principal component. , location observation PCA space. matrix \"loadings\", row tidied output corresponds information principle components original space. columns : row variable labels (colnames) data set PCA performed. PC integer vector indicating principal component. value value eigenvector (axis score) indicated principal component. \"eigenvalues\", columns : PC integer vector indicating principal component. std.dev Standard deviation (.e. sqrt(eig/(n-1))) explained PC (compatibility prcomp. cumulative Cumulative variation explained principal components component (note phrased percentage total variance, since many methods estimate truncated SVD.","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidypopgen-package.html","id":null,"dir":"Reference","previous_headings":"","what":"tidypopgen: Tidy Population Genetics — tidypopgen-package","title":"tidypopgen: Tidy Population Genetics — tidypopgen-package","text":"provide tidy grammar population genetics, facilitating manipulation analysis data biallelic single nucleotide polymorphisms (SNPs).","code":""},{"path":[]},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/tidypopgen-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"tidypopgen: Tidy Population Genetics — tidypopgen-package","text":"Maintainer: Andrea Manica am315@cam.ac.uk (ORCID) Authors: Evie Carter","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_cpp.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert vcf to FBM. — vcf_to_fbm_cpp","title":"Convert vcf to FBM. — vcf_to_fbm_cpp","text":"Convert vcf file Filebacked Big Matrix (FBM) object. work even large vcf files fit memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_cpp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert vcf to FBM. — vcf_to_fbm_cpp","text":"","code":"vcf_to_fbm_cpp( vcf_path, chunk_size = NULL, backingfile = NULL, n_cores = 1, quiet = FALSE )"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_cpp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert vcf to FBM. — vcf_to_fbm_cpp","text":"vcf_path path vcf chunk_size chunk size use vcf loading file. NULL, best guess made. backingfile name file use backing file FBM. NULL, vcf path used. n_cores number cores use reading vcf file. Default 1.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_cpp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert vcf to FBM. — vcf_to_fbm_cpp","text":"path resulting rds file class bigSNP.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_vcfR.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","title":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","text":"Convert vcf file Filebacked Big Matrix (FBM) object. work even large vcf files fit memory.","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_vcfR.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","text":"","code":"vcf_to_fbm_vcfR(vcf_path, chunk_size = NULL, backingfile = NULL, quiet = FALSE)"},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_vcfR.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","text":"vcf_path path vcf chunk_size chunk size use vcf loading file backingfile name file use backing file","code":""},{"path":"https://evolecolgroup.github.io/tidypopgen/reference/vcf_to_fbm_vcfR.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert vcf to FBM using vcfR as a parser. — vcf_to_fbm_vcfR","text":"path resulting rds file class bigSNP.","code":""}] diff --git a/sitemap.xml b/sitemap.xml index 9770f0c4..b68ca5de 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -11,7 +11,6 @@ https://evolecolgroup.github.io/tidypopgen/authors.html https://evolecolgroup.github.io/tidypopgen/index.html https://evolecolgroup.github.io/tidypopgen/reference/annotate_group_info.html -https://evolecolgroup.github.io/tidypopgen/reference/as_q_matrix.html https://evolecolgroup.github.io/tidypopgen/reference/augment.gt_dapc.html https://evolecolgroup.github.io/tidypopgen/reference/augment_gt_pca.html https://evolecolgroup.github.io/tidypopgen/reference/augment_loci.html @@ -20,11 +19,12 @@ https://evolecolgroup.github.io/tidypopgen/reference/autoplot.q_matrix.html https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_indiv.html https://evolecolgroup.github.io/tidypopgen/reference/autoplot.qc_report_loci.html +https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_admix.html https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_cluster_pca.html https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_dapc.html https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pca.html https://evolecolgroup.github.io/tidypopgen/reference/autoplot_gt_pcadapt.html -https://evolecolgroup.github.io/tidypopgen/reference/cast_list_to_q_matrix.html +https://evolecolgroup.github.io/tidypopgen/reference/c.gt_admix.html https://evolecolgroup.github.io/tidypopgen/reference/count_loci.html https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_individuals.html https://evolecolgroup.github.io/tidypopgen/reference/count_vcf_variants.html @@ -34,6 +34,7 @@ https://evolecolgroup.github.io/tidypopgen/reference/gen_tibble.html https://evolecolgroup.github.io/tidypopgen/reference/get_p_matrix.html https://evolecolgroup.github.io/tidypopgen/reference/get_q_matrix.html +https://evolecolgroup.github.io/tidypopgen/reference/gt_admixture.html https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genind.html https://evolecolgroup.github.io/tidypopgen/reference/gt_as_genlight.html https://evolecolgroup.github.io/tidypopgen/reference/gt_as_geno_lea.html @@ -48,6 +49,7 @@ https://evolecolgroup.github.io/tidypopgen/reference/gt_has_imputed.html https://evolecolgroup.github.io/tidypopgen/reference/gt_impute_simple.html https://evolecolgroup.github.io/tidypopgen/reference/gt_load.html +https://evolecolgroup.github.io/tidypopgen/reference/gt_order_loci.html https://evolecolgroup.github.io/tidypopgen/reference/gt_pca.html https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_autoSVD.html https://evolecolgroup.github.io/tidypopgen/reference/gt_pca_partialSVD.html @@ -58,6 +60,7 @@ https://evolecolgroup.github.io/tidypopgen/reference/gt_save_light.html https://evolecolgroup.github.io/tidypopgen/reference/gt_set_imputed.html https://evolecolgroup.github.io/tidypopgen/reference/gt_to_aftable.html +https://evolecolgroup.github.io/tidypopgen/reference/gt_update_backingfile.html https://evolecolgroup.github.io/tidypopgen/reference/gt_uses_imputed.html https://evolecolgroup.github.io/tidypopgen/reference/gt_write_bigsnp_from_dfs.html https://evolecolgroup.github.io/tidypopgen/reference/identify_pseudohaploids.html @@ -66,6 +69,7 @@ https://evolecolgroup.github.io/tidypopgen/reference/indiv_inbreeding.html https://evolecolgroup.github.io/tidypopgen/reference/indiv_missingness.html https://evolecolgroup.github.io/tidypopgen/reference/indiv_ploidy.html +https://evolecolgroup.github.io/tidypopgen/reference/is_loci_table_ordered.html https://evolecolgroup.github.io/tidypopgen/reference/loci_alt_freq.html https://evolecolgroup.github.io/tidypopgen/reference/loci_chromosomes.html https://evolecolgroup.github.io/tidypopgen/reference/loci_hwe.html @@ -92,6 +96,7 @@ https://evolecolgroup.github.io/tidypopgen/reference/qc_report_loci.html https://evolecolgroup.github.io/tidypopgen/reference/rbind.gen_tbl.html https://evolecolgroup.github.io/tidypopgen/reference/rbind_dry_run.html +https://evolecolgroup.github.io/tidypopgen/reference/read_q_files.html https://evolecolgroup.github.io/tidypopgen/reference/reexports.html https://evolecolgroup.github.io/tidypopgen/reference/scale_fill_distruct.html https://evolecolgroup.github.io/tidypopgen/reference/select_loci.html @@ -104,7 +109,7 @@ https://evolecolgroup.github.io/tidypopgen/reference/snp_king.html https://evolecolgroup.github.io/tidypopgen/reference/stopifnot_gen_tibble.html https://evolecolgroup.github.io/tidypopgen/reference/subset_bigSNP.html -https://evolecolgroup.github.io/tidypopgen/reference/summary.q_matrix_list.html +https://evolecolgroup.github.io/tidypopgen/reference/summary.gt_admix.html https://evolecolgroup.github.io/tidypopgen/reference/summary_rbind_dry_run.html https://evolecolgroup.github.io/tidypopgen/reference/theme_distruct.html https://evolecolgroup.github.io/tidypopgen/reference/tidy.gt_dapc.html