Skip to content

Commit

Permalink
improve tuto
Browse files Browse the repository at this point in the history
close #86
  • Loading branch information
privefl committed Jan 29, 2024
1 parent 0ba5285 commit a83836c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
30 changes: 14 additions & 16 deletions docs/articles/pcadapt.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/articles/pcadapt_files/figure-html/unnamed-chunk-25-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/articles/pcadapt_files/figure-html/unnamed-chunk-26-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions vignettes/pcadapt.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -293,32 +293,32 @@ For Pool-seq samples, the package also uses the `read.pcadapt` function.
We assume that the user provides a matrix of relative frequencies with `n` rows and `L` columns (where `n` is the number of populations and `L` is the number of genetic markers). Assume your frequency file is called "foo" and is located in the directory "path_to_directory", use the following command lines:

```
pool.data <- read.table("path_to_directory/foo")
filename <- read.pcadapt(pool.data, type = "pool")
pool.data <- read.pcadapt("path_to_directory/foo", type = "pool")
```

You can also directly input an R matrix to `read.pcadapt()` if you want.

A Pool-seq example is provided in the package, and can be loaded as follows:

```{r, eval = TRUE}
pool.data <- system.file("extdata", "pool3pops", package = "pcadapt")
filename <- read.pcadapt(pool.data, type = "pool")
path_to_file <- system.file("extdata", "pool3pops", package = "pcadapt")
pool.data <- read.pcadapt(path_to_file, type = "pool")
```

With Pool-Seq data, the package computes again a Mahalanobis distance based on PCA loadings.

By default, `pcadapt` function assumes that $K=n-1$. Smaller values of `K` can be provided by using argument `K`. Computation of Mahalanobis distances is performed as follows
Computation of Mahalanobis distances is performed as follows

```{r, eval = TRUE}
res <- pcadapt(filename)
#The same as res <- pcadapt(filename,K=2)
res <- pcadapt(pool.data, K = 3)
summary(res)
```
`res' is a list containing the same elements than when using individual genotype data.

A scree plot can be obtained and be possibly used to reduce `K`. If the number of populations `n` is too small, it is impossible to use the scree plot to choose `K` and the default value of $K=n-1$ should be used.

```{r, eval = TRUE}
plot(res,option="screeplot")
plot(res, option = "screeplot")
```

A Manhattan plot can be displayed.
Expand Down

0 comments on commit a83836c

Please sign in to comment.