vcf2lfmm: Convert from 'vcf' to 'lfmm' format

Description Usage Arguments Value Author(s) See Also Examples

View source: R/vcf2lfmm.R

Description

A function that converts from the vcf format to the lfmm format.

Usage

1
vcf2lfmm(input.file, output.file = NULL, force = TRUE)

Arguments

input.file

A character string containing a path to the input file, a genotypic matrix in the vcf format.

output.file

A character string containing a path to the output file, a genotypic matrix in the lfmm format. By default, the name of the output file is the same name as the input file with a .lfmm extension.

force

A boolean option. If FALSE, the input file is converted only if the output file does not exist. If TRUE, convert the file anyway.

Value

output.file

A character string containing a path to the output file, a genotypic matrix in the lfmm format.

Author(s)

Eric Frichot

See Also

vcf lfmm.data ancestrymap2lfmm ancestrymap2geno ped2lfmm ped2geno vcf2geno

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Creation of a file called "example.vcf"
# with 4 SNPs for 3 individuals.
data("example_vcf")
write.table(example_vcf,"example.vcf",col.names =
    c("#CHROM", "POS", "ID", "REF", "ALT", "QUAL", "FILTER", "INFO",
    "FORMAT", "SAMPLE0", "SAMPLE1", "SAMPLE2"),
    row.names = FALSE, quote = FALSE)

# Conversion    from the vcf format ("example.vcf") 
#               to the lfmm format ("example.lfmm").
# By default,   the name of the output file is the same name
#               as the input file with a .lfmm extension.
# Create files: "example.lfmm",
#               "example.vcfsnp" - SNP informations,
#               "example.removed" - removed lines. 
output = vcf2lfmm("example.vcf")

# Conversion    from the vcf format ("example.vcf")
#               to the lfmm format with the output file called "plop.lfmm".
# Create files: "plop.lfmm",
#               "plop.vcfsnp" - SNP informations,
#               "plop.removed" - removed lines. 
output = vcf2lfmm("example.vcf", "plop.lfmm")

# As force = false and the file "example.lfmm" already exists,
# nothing happens.
output = vcf2lfmm("example.vcf", force = FALSE)

Example output

	- number of detected individuals:	3
	- number of detected loci:		4

For SNP info, please check ./example.vcfsnp.

2 line(s) were removed because these are not SNPs.
Please, check ./example.removed file, for more informations.


	- number of detected individuals:	3
	- number of detected loci:		4


	- number of detected individuals:	3
	- number of detected loci:		4

For SNP info, please check ./example.vcfsnp.

2 line(s) were removed because these are not SNPs.
Please, check ./example.removed file, for more informations.


	- number of detected individuals:	3
	- number of detected loci:		4

LEA documentation built on Nov. 8, 2020, 8:19 p.m.