How to use genomepy - 10 common examples

To help you get started, we’ve selected a few genomepy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vanheeringen-lab / genomepy / tests / test_8_plugins.py View on Github external
def test_hisat2(genome, force):
    """Create hisat2 index."""
    assert os.path.exists(genome.filename)

    force = True if force == "overwrite" else False
    if cmd_ok("hisat2-build"):
        p = Hisat2Plugin()
        p.after_genome_download(genome)
        dirname = os.path.dirname(genome.filename)
        index_dir = os.path.join(dirname, "index", "hisat2")
        fname = os.path.join(index_dir, "{}.1.ht2".format(genome.name))
        assert os.path.exists(index_dir)
        assert os.path.exists(fname)

        force_test(p, fname, genome, force)
github vanheeringen-lab / genomepy / tests / test_8_plugins.py View on Github external
def test_gmap(genome, force):
    """Create gmap index."""
    assert os.path.exists(genome.filename)

    force = True if force == "overwrite" else False
    if cmd_ok("gmap"):
        p = GmapPlugin()
        p.after_genome_download(genome, force=force)
        dirname = os.path.dirname(genome.filename)
        index_dir = os.path.join(dirname, "index", "gmap")
        fname = os.path.join(index_dir, "{}.maps".format(genome.name))
        assert os.path.exists(index_dir)
        assert os.path.exists(fname)

        force_test(p, fname, genome, force)
github vanheeringen-lab / genomepy / tests / test_8_plugins.py View on Github external
def test_bowtie2(genome, force):
    """Create bbowtie2 index."""
    assert os.path.exists(genome.filename)

    force = True if force == "overwrite" else False
    if cmd_ok("bowtie2"):
        p = Bowtie2Plugin()
        p.after_genome_download(genome, force=force)
        dirname = os.path.dirname(genome.filename)
        index_dir = os.path.join(dirname, "index", "bowtie2")
        fname = os.path.join(index_dir, "{}.1.bt2".format(genome.name))
        assert os.path.exists(index_dir)
        assert os.path.exists(fname)

        force_test(p, fname, genome, force)
github vanheeringen-lab / genomepy / tests / test_8_plugins.py View on Github external
def test_bwa(genome, force):
    """Create bwa index."""
    assert os.path.exists(genome.filename)

    force = True if force == "overwrite" else False
    if cmd_ok("bwa"):
        p = BwaPlugin()
        p.after_genome_download(genome, force=force)
        dirname = os.path.dirname(genome.filename)
        index_dir = os.path.join(dirname, "index", "bwa")
        fname = os.path.join(index_dir, "{}.fa.sa".format(genome.name))
        assert os.path.exists(index_dir)
        assert os.path.exists(fname)

        force_test(p, fname, genome, force)
github vanheeringen-lab / genomepy / tests / test_8_plugins.py View on Github external
def test_minimap2(genome, force):
    """Create minimap2 index."""
    assert os.path.exists(genome.filename)

    force = True if force == "overwrite" else False
    if cmd_ok("minimap2"):
        p = Minimap2Plugin()
        p.after_genome_download(genome, force=force)
        dirname = os.path.dirname(genome.filename)
        index_dir = os.path.join(dirname, "index", "minimap2")
        fname = os.path.join(index_dir, "{}.mmi".format(genome.name))
        assert os.path.exists(index_dir)
        assert os.path.exists(fname)

        force_test(p, fname, genome, force)
github vanheeringen-lab / genomepy / tests / test_genomepy.py View on Github external
def test_no_fasta_files():
    with pytest.raises(FileNotFoundError):
        genomepy.Genome("empty", "tests/data/genome")
github vanheeringen-lab / genomepy / tests / test_03_download_genomes.py View on Github external
def test_url_genome():
    """Test URL.

    Download S. cerevisiae genome directly from an url from UCSC and retrieve a
    specific sequence.
    """
    tmp = mkdtemp()
    genomepy.install_genome(
        "http://hgdownload.soe.ucsc.edu/goldenPath/ce11/bigZips/chromFa.tar.gz",
        "url",
        genome_dir=tmp,
        localname="url_test",
    )
    g = genomepy.Genome("url_test", genome_dir=tmp)
    assert str(g["chrI"][:12]).lower() == "gcctaagcctaa"
    shutil.rmtree(tmp)
github vanheeringen-lab / genomepy / tests / test_01_basics.py View on Github external
def test_no_fasta_files():
    with pytest.raises(FileNotFoundError):
        genomepy.Genome("empty", "tests/data/genome")
github vanheeringen-lab / genomepy / tests / test_02_links.py View on Github external
def test_ncbi_genome_download_links(masking):
    """Test NCBI HTTPS links for various genomes

    Also test masking (should be ignored).

    These genomes are hosted on ftp://ftp.ncbi.nlm.nih.gov."""
    p = genomepy.provider.ProviderBase.create("NCBI")

    for genome in ["Charlie1.0", "GRCh38.p13"]:
        p.get_genome_download_link(genome, mask=masking)
github vanheeringen-lab / genomepy / tests / test_02_links.py View on Github external
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)