Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_ensembl_genome_download_links():
"""Test Ensembl links for various genomes
These genomes are hosted on ftp.ensembl.org
Vertebrates are downloaded from HTTPS.
"""
p = genomepy.provider.ProviderBase.create("Ensembl")
# Only test on vertebrates as these are downloaded over HTTPS.
# All others are downloaded over FTP, which is unreliable on Travis.
for genome in ["Anan_2.0", "ASM303372v1"]:
p.get_genome_download_link(genome)
def test_ensembl_annotation(localname=None):
"""Test Ensembl annotation
This annotation is hosted on https://ftp.ensembl.org.
"""
tmp = mkdtemp()
p = genomepy.provider.ProviderBase.create("Ensembl")
# Only test on vertebrates as these are downloaded over HTTPS.
# All others are downloaded over FTP, which is unreliable on Travis.
for name, version in [("KH", 98)]:
p.download_annotation(name, tmp, localname=localname, version=version)
localname = genomepy.utils.get_localname(name, localname)
gtf = os.path.join(tmp, localname, localname + ".annotation.gtf.gz")
validate_gzipped_gtf(gtf)
bed = os.path.join(tmp, localname, localname + ".annotation.bed.gz")
validate_gzipped_bed(bed)
shutil.rmtree(tmp)
def test_ensemblgenomes_genome_download_links():
"""Test Ensembl FTP links for various genomes
These genomes are hosted on ftp.ensemblgenomes.org.
"""
p = genomepy.provider.ProviderBase.create("Ensembl")
for genome in ["AgamP4", "WBcel235", "R64-1-1"]:
p.get_genome_download_link(genome)
def test_ensembl_download_options(assembly, masking, release_version):
"""Test masking, as well as Ensembl specific options for assembly level and release versions"""
p = genomepy.provider.ProviderBase.create("Ensembl")
mask = masking
toplevel = False if assembly == "primary_assembly" else True
version = release_version
p.get_genome_download_link(
"GRCh38.p13", mask=mask, toplevel=toplevel, version=version
)
def test_UCSC_annotation(localname=None):
"""Test UCSC annotation"""
tmp = mkdtemp()
p = genomepy.provider.ProviderBase.create("UCSC")
name = "sacCer3"
p.download_annotation(name, tmp, localname=localname)
localname = genomepy.utils.get_localname(name, localname)
gtf = os.path.join(tmp, localname, localname + ".annotation.gtf.gz")
validate_gzipped_gtf(gtf)
bed = os.path.join(tmp, localname, localname + ".annotation.bed.gz")
validate_gzipped_bed(bed)
shutil.rmtree(tmp)