Converts a genlight object to nexus format PAUP SVDquartets
Source:R/gl2svdquartets.r
gl2svdquartets.Rd
The output nexus file contains the SNP data in one of two forms, depending upon what you regard as most appropriate. One form, that used by Chifman and Kubatko, has two lines per individual, one providing the reference SNP the second providing the alternate SNP (method=1).
Usage
gl2svdquartets(
x,
outfile = "svd.nex",
outpath = tempdir(),
method = 2,
verbose = NULL
)
Arguments
- x
Name of the genlight object containing the SNP data or tag P/A data [required].
- outfile
File name of the output file (including extension) [default 'svd.nex'].
- outpath
Path where to save the output file [default tempdir(), mandated by CRAN]. Use outpath=getwd() when calling this function or set.tempdir <- getwd() elsewhere in your script to direct output files to your working directory.
- method
Method = 1, nexus file with two lines per individual; method = 2, nexus file with one line per individual, ambiguity codes for SNP genotypes, 0 or 1 for presence/absence data [default 2].
- verbose
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity]
Details
A second form, recommended by Dave Swofford, has a single line per individual, resolving heterozygous SNPs by replacing them with standard ambiguity codes (method=2).
If the data are tag presence/absence, then method=2 is assumed.
Note that the genlight object must contain at least two populations for this function to work.
References
Chifman, J. and L. Kubatko. 2014. Quartet inference from SNP data under the coalescent. Bioinformatics 30: 3317-3324
Author
Custodian: Arthur Georges (Post to https://groups.google.com/d/forum/dartr)
Examples
gg <- testset.gl[1:20,1:100]
gg@other$loc.metrics <- gg@other$loc.metrics[1:100,]
gl2svdquartets(gg)
#> Starting gl2svdquartets
#> Processing genlight object with SNP data
#> Warning: data include loci that are scored NA across all individuals.
#> Consider filtering using gl <- gl.filter.allna(gl)
#> Warning: genlight object may contain monomorphic loci
#> Extacting SNP bases and creating records for each individual
#> Sorting ....
#> Creating lookup table for ambiguity codes
#> Applying ambiguity codes (if method=2) and reconstructing sequences
#> Creating partition table
#> Writing results to svd nexus file /tmp/RtmpWgoHDI/svd.nex
#> Completed: gl2svdquartets
#>
#> NULL