{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "from bcbio import isatab\n", "import synapseclient\n", "import tempfile" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "#login to synapse\n", "syn=synapseclient.Synapse()\n", "syn.login()\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Welcome, Abhishek Pratap!\n" ] } ], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "#create a project\n", "#project = synapseclient.Project('test_isa_to_synpase')\n", "project = synapseclient.Project('test_NSD_isa_to_synpase')\n", "project = syn.store(project)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "#parse a ISA tab file \n", "#rec = isatab.parse('/Users/abhishek/projects/isa_tab/data/BII-S-3')\n", "rec= isatab.parse('/Users/abhishek/projects/isa_tab/data/ISA-tab_Munoz-Heck_July26')\n", "study = rec.studies[0]" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "#start building the study level markdown\n", "study_markdown_text = '###Title: %s \\n' % study.metadata['Study Title']\n", "study_markdown_text += '---\\n'\n", "\n", "#study organism\n", "study_markdown_text += '#####Organism(s): \\n %s \\n\\n' % 'TBD'\n", "\n", "#study description\n", "study_markdown_text += '>**Description:** %s \\n\\n' % study.metadata['Study Description']\n", "\n", "\n", "#Study Design Type \n", "study_markdown_text += '#####Design(s): \\n %s\\n\\n' % ' '.join([ descp['Study Design Type'] for descp in study.design_descriptors ])\n", "\n", "#Publications\n", "publications_line = ''\n", "for publication in study.publications:\n", " publications_line += publication['Study Publication Author List'] + '\\n'\n", " publications_line += publication['Study Publication Title']\n", " publications_line += '[Pubmed](http://www.ncbi.nlm.nih.gov/pubmed/%s) \\n\\n' % publication.get('Study PubMed ID','NA')\n", "study_markdown_text += '#####Publication(s):\\n %s \\n ' % publications_line\n", "\n", "\n", "#get the contact names\n", "all_full_names = []\n", "for contact in study.contacts:\n", " full_name = '%s %s %s' % ( contact.get('Study Person First Name','NA'),\n", " contact.get('Study Person Mid Initials','NA'),\n", " contact.get('Study Person Last Name'))\n", " all_full_names.append(full_name)\n", "\n", "study_markdown_text += '**Contact(s):** \\n %s \\n\\n' % ', '.join(all_full_names)\n" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 19 }, { "cell_type": "code", "collapsed": false, "input": [ "#create a project wiki and add the markdown text\n", "project_wiki = synapseclient.Wiki(owner = project,\n", " markdown = study_markdown_text )\n", "project_wiki = syn.store(project_wiki)\n", "\n", "#workaround\n", "#next two lines mainly to make sure if new markdown content is there, the wiki content can be updated\n", "project_wiki = syn.getWiki(project)\n", "project_wiki.markdown = study_markdown_text\n", "project_wiki = syn.store(project_wiki)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 21 }, { "cell_type": "code", "collapsed": false, "input": [ "#adding the annotations\n", "project['Data_Submission_Date'] = study.metadata['Study Submission Date']\n", "project['Data_Release_Date'] = study.metadata['Study Public Release Date']\n", "project = syn.store(project)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 22 }, { "cell_type": "code", "collapsed": false, "input": [ "#store protocols unders a separate folder\n", "protocols_folder = synapseclient.Folder('Protocols',parent=project)\n", "protocols_folder = syn.store(protocols_folder)\n", "\n", "#store protocols name and corresponding synapse File entities object \n", "#this wud be needed for creating provenance records\n", "protocols_synapse_files = {}\n", "\n", "for count,protocol in enumerate(study.protocols):\n", " temp_file_name = protocol.get('Study Protocol Name','NA').replace(' ','_') + '.txt'\n", " temp_file = open(temp_file_name,'w')\n", " protocols_markdown_text = '%s \\n' % (unicode(protocol.get('Study Protocol Name','NA')) )\n", " protocols_markdown_text += '%r \\n\\n' % (protocol.get('Study Protocol Description', 'NA'))\n", " temp_file.write(protocols_markdown_text)\n", " temp_file.close()\n", " syn_file = synapseclient.File(path=temp_file_name,parent=protocols_folder)\n", " syn_file = syn.store(syn_file)\n", " protocols_synapse_files[protocol.get('Study Protocol Name','NA')] = syn_file" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 3 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 2 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 2 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 2 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 2 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 2 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 3 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 3 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 3 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 3 seconds.\n", "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "." ] }, { "output_type": "stream", "stream": "stdout", "text": [ "," ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "!\n" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "Upload completed in 3 seconds.\n" ] } ], "prompt_number": 23 }, { "cell_type": "code", "collapsed": false, "input": [ "#store assays under separate folder\n", "assays_folder = synapseclient.Folder('Assays',parent=project)\n", "assays_folder = syn.store(assays_folder)\n", " \n", "for assay in study.assays:\n", " assay_name = assay.metadata.get('Study Assay Measurement Type') + ' using ' + assay.metadata.get('Study Assay Technology Type')\n", " print 'Assay Name', assay_name\n", " \n", " #create a new folder for each assay type\n", " individual_assay_folder = synapseclient.Folder(assay_name, parent=assays_folder)\n", " \n", " #inserting assay level metadata\n", " for key,val in assay.metadata.iteritems():\n", " if val == '':\n", " val = 'NA'\n", " #replacing the spaces as currently synapse doesnt allow spaces in annotation keys\n", " key = key.replace(' ','_')\n", " individual_assay_folder[key] = val\n", " individual_assay_folder = syn.store(individual_assay_folder)\n", " \n", " \n", " #uploading files under each assay as links to synapse\n", " for node in assay.nodes:\n", " print 'Node name', node\n", " assay_file = synapseclient.File(node.replace('*',''), parent = individual_assay_folder,synapseStore = False)\n", " assay_file['Sample_Name'] = assay.nodes[node].metadata['Sample Name']\n", " #assay_file['Derived_Data_File'] = assay.nodes[node].metadata['Derived Data File']\n", " assay_file['Raw_Data_File'] = assay.nodes[node].metadata['Raw Data File']\n", " \n", " \n", " \n", " if assay.nodes[node].metadata.get('Material Type') is not None:\n", " assay_file['Material_Type'] = '%s : %s : %s' % ( assay.nodes[node].metadata['Material Type'][0].Material_Type,\n", " assay.nodes[node].metadata['Material Type'][0].Term_Source_REF,\n", " assay.nodes[node].metadata['Material Type'][0].Term_Accession_Number)\n", " else:\n", " assay_file['Material_Type'] = 'NA : NA : NA'\n", " \n", " \n", " \n", " #create the provenance for how these files were generated\n", " used_protocols_synapse_files = []\n", " for used_protocol in assay.nodes[node].metadata['Protocol REF']:\n", " if protocols_synapse_files.get(used_protocol.Protocol_REF,None) is None:\n", " print 'Error: protocol %s not found in the study protocols listed' % used_protocol\n", " else:\n", " used_protocols_synapse_files.append(protocols_synapse_files.get(used_protocol.Protocol_REF,None))\n", " \n", " \n", " #generate the provenance\n", " assay_file_provenance_activity = synapseclient.Activity(used = used_protocols_synapse_files)\n", " assay_file = syn.store(assay_file, activity = assay_file_provenance_activity )" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Assay Name protein expression profiling using mass spectrometry\n", "Node name" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " ftp://ftp.pride.ebi.ac.uk/2013/02/PXD000134/OR1_091015_Javier_iPS_Singapore_Mix1_BigSCX*.raw\n", "Error: protocol not found in the study protocols listed\n", "Node name" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " ftp://ftp.pride.ebi.ac.uk/2013/02/PXD000134/4Skin_Mix2_SCX*.raw\n", "Error: protocol not found in the study protocols listed\n", "Node name" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " ftp://ftp.pride.ebi.ac.uk/2013/02/PXD000134/4Skin_Mix1_SCX*.raw\n", "Error: protocol not found in the study protocols listed\n", "Node name" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " ftp://ftp.pride.ebi.ac.uk/2013/02/PXD000134/OR1_091015_Javier_iPS_Singapore_Mix2_BigSCX*.raw\n", "Error: protocol not found in the study protocols listed\n", "Assay Name" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " transcription profiling using DNA microarray\n", "Node name" ] }, { "ename": "SynapseHTTPError", "evalue": "400 Client Error: Bad Request\nInvalid Entity name: '?acc=GSM649323&format=file&file=GSM649323%2ECEL%2Egz'. Entity names may only contain: letters, numbers, spaces, underscores, hypens, periods, plus signs, and parentheses", "output_type": "pyerr", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mSynapseHTTPError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;31m#generate the provenance\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0massay_file_provenance_activity\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msynapseclient\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mActivity\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mused\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mused_protocols_synapse_files\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0massay_file\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msyn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstore\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0massay_file\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mactivity\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0massay_file_provenance_activity\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m/Users/abhishek/anaconda/lib/python2.7/site-packages/synapseclient/client.pyc\u001b[0m in \u001b[0;36mstore\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 671\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 672\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 673\u001b[0;31m \u001b[0mproperties\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_createEntity\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mproperties\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 674\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mSynapseHTTPError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mex\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 675\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcreateOrUpdate\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mex\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatus_code\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m409\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Users/abhishek/anaconda/lib/python2.7/site-packages/synapseclient/client.pyc\u001b[0m in \u001b[0;36m_createEntity\u001b[0;34m(self, entity)\u001b[0m\n\u001b[1;32m 1975\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1976\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0;34m\"\\n\\n~~~ creating ~~~\\n\"\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdumps\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mget_properties\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mentity\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindent\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1977\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrestPOST\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0muri\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'/entity'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbody\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdumps\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mget_properties\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mentity\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1978\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1979\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Users/abhishek/anaconda/lib/python2.7/site-packages/synapseclient/retry.pyc\u001b[0m in \u001b[0;36mwith_retry\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 53\u001b[0m \u001b[0;31m# Try making the call\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 55\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 56\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mException\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mex\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 57\u001b[0m \u001b[0mexc_info\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexc_info\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Users/abhishek/anaconda/lib/python2.7/site-packages/synapseclient/client.pyc\u001b[0m in \u001b[0;36mrestPOST\u001b[0;34m(self, uri, body, endpoint, headers, **kwargs)\u001b[0m\n\u001b[1;32m 2099\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2100\u001b[0m \u001b[0mutils\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug_response\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2101\u001b[0;31m \u001b[0mexceptions\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_raise_for_status\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2102\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2103\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mresponse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mheaders\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'content-type'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'application/json'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/Users/abhishek/anaconda/lib/python2.7/site-packages/synapseclient/exceptions.pyc\u001b[0m in \u001b[0;36m_raise_for_status\u001b[0;34m(response)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0;31m## TODO: Might as well append more information to the exception message\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mSynapseHTTPError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresponse\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mSynapseHTTPError\u001b[0m: 400 Client Error: Bad Request\nInvalid Entity name: '?acc=GSM649323&format=file&file=GSM649323%2ECEL%2Egz'. Entity names may only contain: letters, numbers, spaces, underscores, hypens, periods, plus signs, and parentheses" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " http://www.ncbi.nlm.nih.gov/geo/download/?acc=GSM649323&format=file&file=GSM649323%2ECEL%2Egz\n", "Error: protocol not found in the study protocols listed\n" ] } ], "prompt_number": 26 }, { "cell_type": "code", "collapsed": false, "input": [ "assay.nodes[node].metadata" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 27, "text": [ "{'Data Record Accession': [Attrs(Data_Record_Accession='GSE26451'),\n", " Attrs(Data_Record_Accession='')],\n", " 'Data Repository': [Attrs(Data_Repository=''),\n", " Attrs(Data_Repository='Gene Expression Omnibus')],\n", " 'Derived Data File': [''],\n", " 'Label': [Attrs(Label='')],\n", " 'Labeled Extract Name': [Attrs(Labeled_Extract_Name='')],\n", " 'Protocol REF': [Attrs(Protocol_REF='Microarray data analysis'),\n", " Attrs(Protocol_REF=''),\n", " Attrs(Protocol_REF='Transcriptome analysis'),\n", " Attrs(Protocol_REF='RNA isolation')],\n", " 'Raw Data File': ['http://www.ncbi.nlm.nih.gov/geo/download/?acc=GSM649323&format=file&file=GSM649323%2ECEL%2Egz'],\n", " 'Sample Name': ['4Skin_Fibro_1']}" ] } ], "prompt_number": 27 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "print node" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "EVUSNDQ02.sff\n" ] } ], "prompt_number": 27 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }