{"__v":10,"_id":"562e5b1c56486b0d00e3dbf4","category":{"__v":1,"_id":"562e591c4376430d006f17e0","pages":["562e5b1c56486b0d00e3dbf4"],"project":"5476bf0f817e8d080031f988","version":"5476bf10817e8d080031f98b","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-10-26T16:47:24.981Z","from_sync":false,"order":7,"slug":"interactive-analysis-ipython","title":"Interactive Analysis (IPython)"},"parentDoc":null,"project":"5476bf0f817e8d080031f988","user":"5476beec817e8d080031f986","version":{"__v":17,"_id":"5476bf10817e8d080031f98b","project":"5476bf0f817e8d080031f988","createdAt":"2014-11-27T06:05:04.263Z","releaseDate":"2014-11-27T06:05:04.263Z","categories":["5476bf10817e8d080031f98c","5477c46cf3736008009e9eb5","5477c474f3736008009e9eb6","5477c47ef3736008009e9eb7","5477c48ff3736008009e9eb8","5477c4948deb230800808bf0","54e68328154f8e0d0007b55c","54e90194c8e0c00d007ac061","54eed2275bf74a0d00ef4076","54f7a7be0a3cbb0d00d666fb","559b0ebf7ae7f80d0096d871","55d697f9ae529e0d00d34f03","562d4dcc8c6e5a0d00d6ed1d","562e591c4376430d006f17e0","568f0e73bdb9260d00149d8c","5719542aac1e2e0e001834c6","57a14a8ed778850e0047e230"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-26T16:55:56.288Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"To interactively work with protocols and data, we recommend using [Jupyter Notebook, formerly known IPython](http://jupyter.org/).  The [Transcriptic Command Line Interface](https://github.com/transcriptic/transcriptic) comes with a a Python library that makes working with the Transcriptic API very easy from the IPython environment.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"from transcriptic import run\\nfrom transcriptic.config import Connection\\n\\nConnection(\\\"me:::at:::example.com\\\", \\\"my_API_Key\\\", \\\"my-organization-id\\\")\\n\\nrun_data = run(\\\"my-run-id\\\")\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\nIf you've previously logged into the Transcriptic CLI using the `transcriptic login` command, you can create a `Connection` from the cached credentials:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"from transcriptic import run\\nfrom transcriptic.config import Connection\\n\\nConnection.from_file(\\\"~/.transcriptic\\\")\\n\\nrun_data = run(\\\"my-run-id\\\")\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Easy Data Accessor Functions\"\n}\n[/block]\nThere are a variety of helper functions to make getting data easy.  They work by automatically picking up on a previously-created `Connection` object, so you must create a connection before using them. You don't, however, need to pass in the connection as a parameter - they pick up on it automatically.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"run(id: string)\\nproject(id: string)\\ndataset(id: string)\\ncontainer(id: string)\\naliquot(id: string)\\nresource(id: string)\\nanalyze(protocol: dict, test_mode: bool)\\nsubmit(protocol: dict, project: string, title: string, test_mode: bool) \",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\nThe `Connection` object also contains many methods for interacting with your Transcriptic account; it can be thought of as an \"organization\" class.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"org = Connection(\\\"me@example.com\\\", \\\"my_API_key\\\", \\\"my-organization-id\\\")\\n\\nproject = org.create_project(\\\"Example Project\\\")\\nrun_list = project.runs() # will be an empty list, since you just created this project\\n\\npackage_list = org.packages()\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"getting-started-with-ipython","type":"basic","title":"Getting Started With IPython"}

Getting Started With IPython


To interactively work with protocols and data, we recommend using [Jupyter Notebook, formerly known IPython](http://jupyter.org/). The [Transcriptic Command Line Interface](https://github.com/transcriptic/transcriptic) comes with a a Python library that makes working with the Transcriptic API very easy from the IPython environment. [block:code] { "codes": [ { "code": "from transcriptic import run\nfrom transcriptic.config import Connection\n\nConnection(\"me@example.com\", \"my_API_Key\", \"my-organization-id\")\n\nrun_data = run(\"my-run-id\")", "language": "python" } ] } [/block] If you've previously logged into the Transcriptic CLI using the `transcriptic login` command, you can create a `Connection` from the cached credentials: [block:code] { "codes": [ { "code": "from transcriptic import run\nfrom transcriptic.config import Connection\n\nConnection.from_file(\"~/.transcriptic\")\n\nrun_data = run(\"my-run-id\")", "language": "python" } ] } [/block] [block:api-header] { "type": "basic", "title": "Easy Data Accessor Functions" } [/block] There are a variety of helper functions to make getting data easy. They work by automatically picking up on a previously-created `Connection` object, so you must create a connection before using them. You don't, however, need to pass in the connection as a parameter - they pick up on it automatically. [block:code] { "codes": [ { "code": "run(id: string)\nproject(id: string)\ndataset(id: string)\ncontainer(id: string)\naliquot(id: string)\nresource(id: string)\nanalyze(protocol: dict, test_mode: bool)\nsubmit(protocol: dict, project: string, title: string, test_mode: bool) ", "language": "python" } ] } [/block] The `Connection` object also contains many methods for interacting with your Transcriptic account; it can be thought of as an "organization" class. [block:code] { "codes": [ { "code": "org = Connection(\"me@example.com\", \"my_API_key\", \"my-organization-id\")\n\nproject = org.create_project(\"Example Project\")\nrun_list = project.runs() # will be an empty list, since you just created this project\n\npackage_list = org.packages()", "language": "python" } ] } [/block]