diff --git a/src/PopGenCore.jl b/src/PopGenCore.jl index d05e91e..a81eaf9 100644 --- a/src/PopGenCore.jl +++ b/src/PopGenCore.jl @@ -73,6 +73,9 @@ export bcf, vcf include("io/Baypass.jl") export baypass +include("io/Plink.jl") +export plink + include("io/ReadWrite.jl") ## include("Datasets.jl") diff --git a/src/io/Plink.jl b/src/io/Plink.jl index 9544cb6..4c8a30c 100644 --- a/src/io/Plink.jl +++ b/src/io/Plink.jl @@ -217,7 +217,7 @@ plink(sharks, filename = "biallelic_sharks.ped") ``` """ function plink(data::PopData; filename::String) - data.metadata.biallelic != true && throw(ArgumentError("To write to PLINK format, data must be biallelic.\nThis can be done with dropmultiallelic(::PopData)\n")) + data.metadata.biallelic != true && throw(ArgumentError("To write to PLINK format, data must be biallelic.\nThis can be done with dropmultiallelic())\n")) basename = endswith(filename, r".bed|.ped") ? splitext(filename)[1] : filename # the .fam file tmp = data.metadata[:, r"population|name|sire|dam|sex|phenotype"] diff --git a/src/io/ReadWrite.jl b/src/io/ReadWrite.jl index 8ff9cd4..32fdc5e 100755 --- a/src/io/ReadWrite.jl +++ b/src/io/ReadWrite.jl @@ -64,6 +64,8 @@ to Genepop format, call up the `?genepop` docstring. | genepop | `.gen`, `.genepop` | ?genepop | | delimited | `.csv`, `.txt`, `.tsv` | ?delimited | | structure | `.str`, `.structure` | ?structure | +| plink | `.ped` | ?plink | +| baypass | `.baypass` | ?baypass | ### Example ``` @@ -80,8 +82,10 @@ function Base.write(data::PopData; filename::String, kwargs...) structure(data, filename = filename; kwargs...) elseif ext in ["csv", "txt", "tsv"] delimited(data, filename = filename; kwargs...) + elseif ext == "baypass" + baypass(data, filename = filename) else - @error "File type not recognized by filename extension. Please see the docstring" + throw(ArgumentError("File type not recognized by filename extension. Please see the docstring")) end end @@ -93,7 +97,9 @@ function Base.write(data::PopData, filename::String, kwargs...) structure(data, filename = filename; kwargs...) elseif ext in ["csv", "txt", "tsv"] delimited(data, filename = filename; kwargs...) + elseif ext == "baypass" + baypass(data, filename = filename) else - @error "File type not recognized by filename extension. Please see the docstring" + throw(ArgumentError("File type not recognized by filename extension. Please see the docstring")) end end \ No newline at end of file