-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
206 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"This notebook computes on the freely available GTEX version 8 files on Amazon AWS using the Seven Bridges Cancer Genomics Cloud WES service. \n", | ||
"\n", | ||
"In this case the DRS ids of the GTEX files are available via a client which acccess a local manifest file. The manifest file is obtained from Anvil as follows.\n", | ||
"https://anvilproject.org/learn/reference/gtex-v8-free-egress-instructions\n", | ||
"\n", | ||
"Rather than use the Gen3 Downloader described in the egress instructions, this example uses the Anvil DRS service to obtain URLs which can be passed to the Seven Bridges CGC WES Service.\n", | ||
"\n", | ||
"The following step demonstrates a query run against that file. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from fasp.runner import FASPRunner\n", | ||
"\n", | ||
"# The implementations we're using\n", | ||
"from fasp.workflow import DNAStackWESClient\n", | ||
"from fasp.loc import anvilDRSClient\n", | ||
"from fasp.search import Gen3ManifestClient\n", | ||
"\n", | ||
"faspRunner = FASPRunner(program='GTEXExample')\n", | ||
"\n", | ||
"# Step 1 - Discovery\n", | ||
"# query for relevant DRS objects\n", | ||
"searchClient = Gen3ManifestClient('../fasp/data/gtex/gtex-cram-manifest.json')\n", | ||
"res = searchClient.runQuery(3)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"{'access_methods': [{'access_id': 'gs',\n", | ||
" 'access_url': {'url': 'gs://fc-secure-ff8156a3-ddf3-42e4-9211-0fd89da62108/GTEx_Analysis_2017-06-05_v8_WGS_CRAM_files/GTEX-1B98T-0004-SM-7J38T.cram'},\n", | ||
" 'region': '',\n", | ||
" 'type': 'gs'},\n", | ||
" {'access_id': 's3',\n", | ||
" 'access_url': {'url': 's3://AnVIL/GTEx_Analysis_2017-06-05_v8_WGS_CRAM_files/GTEX-1B98T-0004-SM-7J38T.cram'},\n", | ||
" 'region': '',\n", | ||
" 'type': 's3'}],\n", | ||
" 'aliases': [],\n", | ||
" 'checksums': [{'checksum': 'cfd2f4cde4aa3e0cf9f726f0c1255fcd',\n", | ||
" 'type': 'md5'}],\n", | ||
" 'contents': [],\n", | ||
" 'created_time': '2020-07-08T18:53:27.860156',\n", | ||
" 'description': None,\n", | ||
" 'form': 'object',\n", | ||
" 'id': 'dg.ANV0/ed9ac9ae-02da-4e97-93da-ad86aa77d227',\n", | ||
" 'mime_type': 'application/json',\n", | ||
" 'name': 'GTEX-1B98T-0004-SM-7J38T.cram',\n", | ||
" 'self_uri': 'drs://gen3.theanvil.io/dg.ANV0/ed9ac9ae-02da-4e97-93da-ad86aa77d227',\n", | ||
" 'size': 38379493977,\n", | ||
" 'updated_time': '2020-07-08T18:53:27.860163',\n", | ||
" 'version': '64acd5a6'}" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"drsClient = anvilDRSClient('~/.keys/anvil_credentials.json', access_id='gs')\n", | ||
"drsClient.getObject(res[2][1])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"url = drsClient.getAccessURL(res[2][1])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Running query\n", | ||
"3\n", | ||
"subject=GTEX-1GTWX-0001-SM-7J3A5.cram, drsID=dg.ANV0/76bb893d-12da-41ca-8828-ff89551d3e15\n", | ||
"workflow submitted, run:2f73492e-d109-4e1a-b2be-9950deae9890\n", | ||
"subject=GTEX-14PQA-0003-SM-7DLH4.cram, drsID=dg.ANV0/66352de8-4b50-4cae-881d-b76d03df5ac8\n", | ||
"workflow submitted, run:6c63ef08-e61b-43a8-ab07-7975a98bdbb8\n", | ||
"subject=GTEX-1B98T-0004-SM-7J38T.cram, drsID=dg.ANV0/ed9ac9ae-02da-4e97-93da-ad86aa77d227\n", | ||
"workflow submitted, run:1d764abd-5c8f-4c89-ad2b-26a43b2025f1\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"settings = faspRunner.settings\n", | ||
"wesClient = DNAStackWESClient('~/.keys/dnastack_wes_credentials.json')\n", | ||
"\n", | ||
"faspRunner.configure(searchClient, drsClient, wesClient)\n", | ||
"\n", | ||
"runList = faspRunner.runQuery(3, 'Anvil GTEX DRS to DNAStack WES')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"2f73492e-d109-4e1a-b2be-9950deae9890 RUNNING\n", | ||
"6c63ef08-e61b-43a8-ab07-7975a98bdbb8 RUNNING\n", | ||
"1d764abd-5c8f-4c89-ad2b-26a43b2025f1 RUNNING\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"for run in runList:\n", | ||
" print(run['run_id'], wesClient.getTaskStatus(run['run_id']))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[{'subject': 'GTEX-1GTWX-0001-SM-7J3A5.cram', 'run_id': '2f73492e-d109-4e1a-b2be-9950deae9890'}, {'subject': 'GTEX-14PQA-0003-SM-7DLH4.cram', 'run_id': '6c63ef08-e61b-43a8-ab07-7975a98bdbb8'}, {'subject': 'GTEX-1B98T-0004-SM-7J38T.cram', 'run_id': '1d764abd-5c8f-4c89-ad2b-26a43b2025f1'}]\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print (runList)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.7.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters