def metadata(path, email, update): """Download assembly_summary.txt and BioSample metadata.""" logbook.set_datetime_format("local") handler = logbook.TimedRotatingFileHandler(os.path.join( path, ".logs", "metadata.log"), backup_count=10) handler.push_application() genbank = Genbank(path) metadata = genbank.metadata(email=email, update=update) genbank.species_metadata(metadata)
def cli(ctx, path): """Assess the integrity of your genomes through automated analysis of species-based statistics and metadata. """ if ctx.invoked_subcommand is None: logbook.set_datetime_format("local") handler = logbook.TimedRotatingFileHandler(os.path.join( path, ".logs", "qc.log"), backup_count=10) handler.push_application() genbank = Genbank(path) genbank.qc()
def genbank(): resources = Path("test/resources").absolute() tmp = Path(tempfile.mkdtemp()) for resource in resources.iterdir(): target = tmp / resource.name shutil.copytree(resource, target) yield Genbank(tmp) shutil.rmtree(tmp)
def cli(ctx, path): # TODO: Option for basic info about PATH """ Assess the integrity of your genomes through automated analysis of species-based statistics and metadata. """ genbank = Genbank(path) _ctx = namedtuple('ctx', ['genbank', 'assembly_summary']) ctx.obj = _ctx(genbank=genbank, assembly_summary=genbank.assembly_summary) logbook.set_datetime_format("local") log_dir = os.path.join(path, ".logs") log_file = os.path.join(log_dir, "qc.log") if not os.path.isdir(log_dir): os.mkdir(log_dir) handler = logbook.TimedRotatingFileHandler(log_file, backup_count=10) handler.push_application() if ctx.invoked_subcommand is None: genbank.qc()
def genbank(): resources = 'test/resources' genbank = tempfile.mkdtemp() for resource in os.listdir(resources): source = os.path.join(resources, resource) target = os.path.join(genbank, resource) shutil.copytree(source, target) yield Genbank(genbank) shutil.rmtree(genbank)
def info(path): """Print basic info about existing GenBank database. """ genbank = Genbank(path) info = genbank.info() click.echo(info)
def genbank_bare(): temp_dir = tempfile.mkdtemp() yield Genbank(temp_dir) shutil.rmtree(temp_dir)