Skip to content

Commit

Permalink
Also update the dataset id
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPeck committed Oct 21, 2024
1 parent ae75a39 commit b176912
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/assets/codeBlocks.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"bdcPythonExport": "# Requires python 3.7 or later\nimport sys\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n# BDC Powered by Terra users uncomment the following line to specify package install location\n# sys.path.insert(0, r\"/home/jupyter/.local/lib/python3.7/site-packages\")\n!{sys.executable} -m pip install --upgrade --force-reinstall git+https://github.com/hms-dbmi/pic-sure-python-client.git\n!{sys.executable} -m pip install --upgrade --force-reinstall git+https://github.com/hms-dbmi/pic-sure-python-adapter-hpds.git\n!{sys.executable} -m pip install --upgrade --force-reinstall git+https://github.com/hms-dbmi/pic-sure-biodatacatalyst-python-adapter-hpds.git\n\nimport PicSureClient\nimport PicSureBdcAdapter\n\ntoken_file = \"token.txt\"\nwith open(token_file, \"r\") as f:\n my_token = f.read()\n\nbdc = PicSureBdcAdapter.Adapter(\"https://picsure.biodatacatalyst.nhlbi.nih.gov/picsure\", my_token)\n\nresource = bdc.useResource('02e23f52-f354-4e8b-992c-d37c8b9ba140')\n\nqueryID = <<QUERY ID GENERATED SHOULD GO HERE!!>>\n\nresults = resource.retrieveQueryResults(queryID)\n\nfrom io import StringIO\ndf_UI = pd.read_csv(StringIO(results), low_memory=False)\ndf_UI.head() # View top 5 rows of dataframe",
"bdcPythonExport": "# Requires python 3.7 or later\nimport sys\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n# BDC Powered by Terra users uncomment the following line to specify package install location\n# sys.path.insert(0, r\"/home/jupyter/.local/lib/python3.7/site-packages\")\n!{sys.executable} -m pip install --upgrade --force-reinstall git+https://github.com/hms-dbmi/pic-sure-python-client.git\n!{sys.executable} -m pip install --upgrade --force-reinstall git+https://github.com/hms-dbmi/pic-sure-python-adapter-hpds.git\n!{sys.executable} -m pip install --upgrade --force-reinstall git+https://github.com/hms-dbmi/pic-sure-biodatacatalyst-python-adapter-hpds.git\n\nimport PicSureClient\nimport PicSureBdcAdapter\n\ntoken_file = \"token.txt\"\nwith open(token_file, \"r\") as f:\n my_token = f.read()\n\nbdc = PicSureBdcAdapter.Adapter(\"https://picsure.biodatacatalyst.nhlbi.nih.gov/picsure\", my_token)\n\nresource = bdc.useResource('02e23f52-f354-4e8b-992c-d37c8b9ba140')\n\nqueryID = {{queryId}} \n\nresults = resource.retrieveQueryResults(queryID)\n\nfrom io import StringIO\ndf_UI = pd.read_csv(StringIO(results), low_memory=False)\ndf_UI.head() # View top 5 rows of dataframe",
"bdcRExport": "# Requires R 3.4 or later\n### Uncomment this code if you are not using the PIC-SURE environment in *BDC-Seven Bridges*, or if you do not have all the necessary dependencies installed.\n#install.packages(\"devtools\")\n\nSys.setenv(TAR = \"/bin/tar\")\noptions(unzip = \"internal\")\ndevtools::install_github(\"hms-dbmi/pic-sure-r-adapter-hpds\", ref=\"main\", force=T, quiet=FALSE)\nlibrary(dplyr)\n\ntoken_file <- \"token.txt\"\ntoken <- scan(token_file, what = \"character\")\n\nsession <- picsure::bdc.initializeSession(\"https://picsure.biodatacatalyst.nhlbi.nih.gov/picsure\", token)\nsession <- picsure::bdc.setResource(session = session, resourceName = \"AUTH\")\n\nqueryID <- \"526c318d-4a0c-4937-9baa-e21042a0e444\"\nresults <- picsure::getResultByQueryUUID(session, queryID)\nhead(results) # View top 5 rows of dataframe",
"bdcPythonAPI": "# Requires python 3.6 or later\nimport sys\nimport pandas as pd\nimport matplotlib.pyplot as plt\n# BDC Powered by Terra users uncomment the following line to specify package install location\n# sys.path.insert(0, r\"/home/jupyter/.local/lib/python3.7/site-packages\")\n!{sys.executable} -m pip install --upgrade --force-reinstall git+https://github.com/hms-dbmi/pic-sure-python-client.git\n!{sys.executable} -m pip install --upgrade --force-reinstall git+https://github.com/hms-dbmi/pic-sure-python-adapter-hpds.git\n!{sys.executable} -m pip install --upgrade --force-reinstall git+https://github.com/hms-dbmi/pic-sure-biodatacatalyst-python-adapter-hpds.git\nimport PicSureClient\nimport PicSureBdcAdapter\n# Set up connection to PIC-SURE API\nPICSURE_network_URL = \"https://picsure.biodatacatalyst.nhlbi.nih.gov/picsure\"\ntoken_file = \"token.txt\"\n\nwith open(token_file, \"r\") as f:\n my_token = f.read()\n\nbdc = PicSureBdcAdapter.Adapter(PICSURE_network_URL, my_token)",
"bdcRAPI": "# Requires R 3.4 or later\n### Uncomment this code if you are not using the PIC-SURE environment in *BDC-Seven Bridges*, or if you do not have all the necessary dependencies installed.\n#install.packages(\"devtools\")\nSys.setenv(TAR = \"/bin/tar\")\noptions(unzip = \"internal\")\ndevtools::install_github(\"hms-dbmi/pic-sure-r-adapter-hpds\", ref=\"main\", force=T, quiet=FALSE)\nlibrary(dplyr)\nPICSURE_network_URL = \"https://picsure.biodatacatalyst.nhlbi.nih.gov/picsure\"\ntoken_file <- \"token.txt\"\ntoken <- scan(token_file, what = \"character\")\nsession <- picsure::bdc.initializeSession(PICSURE_network_URL, token)\nsession <- picsure::bdc.setResource(session = session, resourceName = \"AUTH\")",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/explorer/export/ExportStepper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
language="python"
lineNumbers={true}
buttonCopied="Copied!"
code={codeBlocks?.bdcPythonExport || 'Code not set'}
code={codeBlocks?.bdcPythonExport?.replace('{{queryId}}', datasetId) || 'Code not set'}
></CodeBlock>
{:else if tabSet === 1}
<CodeBlock
Expand Down

0 comments on commit b176912

Please sign in to comment.