From de2642ec4e7ce6f3b271982920e3f88046ba8c4a Mon Sep 17 00:00:00 2001 From: James Date: Mon, 28 Oct 2024 15:13:14 -0400 Subject: [PATCH] [ALS-7658] Make dataset id dynamic in R (#279) --- src/lib/assets/codeBlocks.json | 2 +- src/lib/components/explorer/export/ExportStepper.svelte | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/assets/codeBlocks.json b/src/lib/assets/codeBlocks.json index 5fcf1f99..79e22541 100644 --- a/src/lib/assets/codeBlocks.json +++ b/src/lib/assets/codeBlocks.json @@ -1,6 +1,6 @@ { "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", + "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 <- \"{{queryId}}\"\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\")", "basePythonExport": "Code not set", diff --git a/src/lib/components/explorer/export/ExportStepper.svelte b/src/lib/components/explorer/export/ExportStepper.svelte index 4fe8d42e..2af264b8 100644 --- a/src/lib/components/explorer/export/ExportStepper.svelte +++ b/src/lib/components/explorer/export/ExportStepper.svelte @@ -359,7 +359,8 @@ {:else if tabSet === 2}