Skip to content

Commit

Permalink
remove extension deps for openvcf()
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimens committed Feb 9, 2021
1 parent 1c127fe commit 15d5113
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions src/io/VariantCallGzLazy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ using .GZip

# if GZip is loaded in, overwrite openvcf to this method
function openvcf(infile::String)
if endswith(infile, ".vcf") || endswith(infile, ".bcf")
return open(infile, "r")
elseif endswith(infile, ".vcf.gz") || endswith(infile, ".bcf.gz")
if endswith(infile, ".gz")
return GZip.open(infile, "r")
else
throw(ArgumentError("The filename must end with .vcf/.bcf or .vcf.gz/.bcf.gz"))
return open(infile, "r")
end
end
end
8 changes: 3 additions & 5 deletions src/io/VariantCallLazy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ export bcf, vcf

"""
openvcf(::String)
Open VCF file (`.vcf/.gz`, or `.bcf/.gz`) and return an `IO` stream in reading mode `"r"`.
Open VCF file (`.vcf(.gz)`, or `.bcf(.gz)`) and return an `IO` stream in reading mode `"r"`.
"""
function openvcf(infile::String)
if endswith(infile, ".vcf") || endswith(infile, ".bcf")
return open(infile, "r")
elseif endswith(infile, ".gz")
if endswith(infile, ".gz")
throw(ArgumentError("Please load in GZip.jl with \`using GZip\`"))
else
throw(ArgumentError("The filename must end with .vcf or .bcf"))
return open(infile, "r")
end
end

Expand Down

0 comments on commit 15d5113

Please sign in to comment.