vcfR2migrate | R Documentation |
The function converts a vcfR object to a text format that can be used as an infile for MigrateN.
vcfR2migrate(
vcf,
pop,
in_pop,
out_file = "MigrateN_infile.txt",
method = c("N", "H")
)
vcf |
a vcfR object. |
pop |
factor indicating population membership for each sample. |
in_pop |
vector of population names indicating which population to include in migrate output file. |
out_file |
name of output file. |
method |
should 'N' or 'H' format data be generated? |
This function converts a vcfR object to a text file which can be used as input for MigrateN. The function will remove loci with missing data, indels, and loci that are not bialleleic (loci with more than two alleles). Thus, only SNP data analysed where the length of each locus (inmutational steps) is 1 (as opposed to microsatellites or indels).
The output file should contain Unix line endings ("\n"). Note that opening the output file in a Windows text editor (just to validate number of markers, individuals or populations) might change the end of line character (eol) to a Windows line ending ("\r\n"). This may produce an error running migrate-n. Because these are typically non-printing characters, this may be a difficult problem to troubleshoot. The easiest way to circumvent the problem is to transfer the output file to Unix machine and view it there. If you do introduce Windows line endings you can convert them back to Unix with a program such as 'dos2unix' or 'fromdos' to change the line endings.
a text file that can be used as an input for MigrateN software (SNP format).
Shankar Shakya and Brian J. Knaus
Migrate-N website.
## Not run:
data(vcfR_example)
my_pop <- as.factor(paste("pop_", rep(c("A", "B", "C"), each = 6), sep = ""))
vcfR2migrate(vcf = vcf , pop = my_pop , in_pop = c("pop_A","pop_C"),
out_file = "my2pop.txt", method = 'H')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.