{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Read Genome" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import modelseedpy\n", "from modelseedpy.core.msgenome import MSGenome\n", "from modelseedpy.core.rast_client import RastClient" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "genome = MS" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "rast = RastClient()" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "genome = MSGenome.from_fasta('GCF_000005845.2.faa', split=' ')" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of features: 3\n" ] } ], "source": [ "print('Number of features:', len(genome.features))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "for f in genome.features:\n", " print(f.id, len(f.seq), f.description)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'execution_time': 1622756127.36331,\n", " 'tool_name': 'kmer_search',\n", " 'hostname': 'pear',\n", " 'parameters': ['-a',\n", " '-g',\n", " 200,\n", " '-m',\n", " 5,\n", " '-d',\n", " '/opt/patric-common/data/kmer_metadata_v2',\n", " '-u',\n", " 'http://pear.mcs.anl.gov:6100/query'],\n", " 'id': '9CCA6D20-C4B3-11EB-A893-36A8BEF382BD'},\n", " {'parameters': ['annotate_hypothetical_only=1',\n", " 'dataset_name=Release70',\n", " 'kmer_size=8'],\n", " 'hostname': 'pear',\n", " 'tool_name': 'KmerAnnotationByFigfam',\n", " 'id': '9CE3769E-C4B3-11EB-A893-36A8BEF382BD',\n", " 'execution_time': 1622756127.52738},\n", " {'execute_time': 1622756127.88296,\n", " 'hostname': 'pear',\n", " 'parameters': [],\n", " 'tool_name': 'annotate_proteins_similarity',\n", " 'id': '9D19B7EA-C4B3-11EB-9714-71B3BDF382BD'}]" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rast.annotate_genome(genome)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Equivalent call from the client it self" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "#genome, res = rast.annotate_genome_from_fasta('GCF_000005845.2_ASM584v2_protein.faa', split=' ')\n", "#res" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [], "source": [ "feature = genome.features.get_by_id('YP_588478.1')" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'RAST': 'DUF1435 domain-containing protein YjjZ [Escherichia coli str. K-12 substr. MG1655]'}" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "feature.ontology_terms" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "feature.add_ontology_term('')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" } }, "nbformat": 4, "nbformat_minor": 4 }