def _assemble_genome(meth, contig_file, out_genome): """This assembles a ContigSet into a Genome object in your workspace. This should be run before trying to annotate a Genome. [2] :param contig_file: A FASTA file with contig data [2.1] :type contig_file: kbtypes.Unicode :ui_name contig_file: Contig File ID :param out_genome: Annotated output genome ID. If empty, an ID will be chosen randomly. [2.2] :type out_genome: kbtypes.KBaseGenomes.Genome :ui_name out_genome: Output Genome ID :return: Assembled output genome ID :rtype: kbtypes.KBaseGenomes.Genome """ # Regarding annotation, here's the latest. You want to take the fasta file that the above command # created ("contigs.fasta"), and load it to the workspace as a contig set: # "ga-loadfasta contigs.fasta -u MyContigs" # # -- this is already in the workspace by this point. meth.stages = 4 token = os.environ['KB_AUTH_TOKEN'] workspace = os.environ['KB_WORKSPACE_ID'] # Setup invocation and double-check workspace meth.advance("Initialize Annotation Service") inv = InvocationService(service.URLS.invocation) inv.run_pipeline("", "kbws-workspace " + workspace, [], 100, '/') # Run sequence to genome. meth.advance("Build Contig Set into a Genome") inv.run_pipeline("", "ga-seq-to-genome " + contig_file + " --genomeid " + out_genome, [], 100, '/') # 4. Fetch genome. meth.advance("Fetching Genome for Display") wsClient = workspaceService(service.URLS.workspace) get_genome_params = { 'id': out_genome, 'type': 'Genome', 'workspace': workspace, 'auth': token, } genome_meta = wsClient.get_objectmeta(get_genome_params) # 5. Pass it forward to the client. meth.advance("Rendering Genome Information") return json.dumps(genome_meta)
def _run_invo(cmd): token = os.environ["KB_AUTH_TOKEN"] invo = InvocationService(url=URLS.invocation, token=token) stdout, stderr = invo.run_pipeline("", cmd, [], 0, "/") return "".join(stdout), "".join(stderr)
def _run_invo(cmd): token = os.environ['KB_AUTH_TOKEN'] invo = InvocationService(url=URLS.invocation, token=token) stdout, stderr = invo.run_pipeline("", cmd, [], 0, '/') return "".join(stdout), "".join(stderr)