Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(5)  |  Derive(0)  |  Import(1)
It checks if a a blast db exists giving its path

        def _blastdb_exists(dbpath, dbtype=None):
    'It checks if a a blast db exists giving its path'
    assert dbtype in (NUCL, PROT, None)
    if dbtype == NUCL:
        exts = ['.nin', '.00.nin']
    elif dbtype == PROT:
        exts = ['.pin', '.00.pin']
    else:
        exts = ['.nin', '.pin', '.00.nin', '.00.pin']
    return any([os.path.exists(dbpath + ext) for ext in exts])
        


src/s/e/seq_crumbs-HEAD/test/test_blast.py   seq_crumbs(Download)
from Bio.Seq import Seq
 
from crumbs.blast import (do_blast, BlasterForFewSubjects,
                          get_or_create_blastdb, _blastdb_exists, Blaster)
from crumbs.utils.file_utils import TemporaryDir
    def test_get_or_create_blastdb():
        blastdb = os.path.join(TEST_DATA_DIR, 'arabidopsis_genes')
 
        directory = TemporaryDir()
        assert not _blastdb_exists(blastdb, NUCL)
        get_or_create_blastdb(blastdb, NUCL, directory.name)
        new_blast_path = os.path.join(directory.name,
                                      os.path.basename(blastdb))
        assert _blastdb_exists(new_blast_path, NUCL)
        assert _blastdb_exists(new_blast_path, NUCL)
        get_or_create_blastdb(blastdb, NUCL, directory.name)
        assert _blastdb_exists(new_blast_path, NUCL)
        directory.close()
 
        # already exists
        blastdb = os.path.join(TEST_DATA_DIR, 'blastdbs', 'arabidopsis_genes')
        assert _blastdb_exists(blastdb, NUCL)