-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export genome_dir, | ||
download_genome | ||
download_genome, | ||
load_genome | ||
|
||
include("config.jl") | ||
include("downloader.jl") | ||
include("downloader.jl") | ||
include("reader.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function load_genome(assembly) | ||
if !haskey(human_genomes, assembly) | ||
error("$assembly is not supported, please use hg19/hg38") | ||
end | ||
|
||
# check if the assembly already exists | ||
folder = joinpath(genome_dir(), assembly) | ||
if isdir(folder) || !verify_human_genome_folder(folder) | ||
if !download_genome(assembly) | ||
error("Cannot download assembly $assembly") | ||
end | ||
end | ||
|
||
chr_folder = joinpath(folder, "chroms") | ||
chroms = readdir(chr_folder) | ||
genome = Dict{ASCIIString, FastaRead}() | ||
for chr in chroms | ||
chrname = replace(chr, ".fa", "") | ||
genome[chrname] = fasta_read(fasta_open(joinpath(chr_folder, chr))) | ||
end | ||
return genome | ||
end |