Skip to content

Commit c97c676

Browse files
committed
Merge branch 'main' of https://github.com/NIGMS/NIGMS-Sandbox into Update_AWSBatch
2 parents 3177532 + 9b33b18 commit c97c676

39 files changed

+271
-5228
lines changed

.github/workflows/check-links.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ jobs:
3030
run: |
3131
python3 ${GITHUB_WORKSPACE}/reusable-workflow-repo/.github/workflows/check_links.py
3232
env:
33-
LINK_IGNORE_LIST: https://www.sciencedirect.com,https://portlandpress.com,cloud.google.com,aws.amazon.com
34-
PAT: ${{ secrets.PAT }}
33+
LINK_IGNORE_LIST: "https://www.sciencedirect.com,https://portlandpress.com,cloud.google.com,aws.amazon.com,https://journals.biologists.com/bio/article-pdf/5/8/1134/1114440/bio020065.pdf,https://onlinelibrary.wiley.com/doi/10.1111/1755-0998.13593,https://www.ensembl.org/,https://github.com/NIGMS/NIGMS-Sandbox/blob/main/README.md,https://github.com/rnaseqprok,https://github.com/rnaseqprok/rnaseqprok/blob/master/CITATIONS.md,https://github.com/NIGMS/NIGMS-Sandbox/blob/main/README.md#available-modules,https://github.com/nf-core/rnaseq/blob/4c27ef5610c87db00c3c5a3eed10b1d161abf575/conf/base.config#L18,https://snakemake.readthedocs.io/en/stable/executor_tutorial/google_lifesciences.html,https://nersc.gitlab.io/development/shifter/how-to-use/,http://bioconductor.org/packages/release/BiocViews.html#___OrgDb,https://www.bioconductor.org/packages/release/bioc/vignettes/methylKit/inst/doc/methylKit.html#4_Annotating_differentially_methylated_bases_or_regions,https://docs.qiime2.org/2024.2/install/native/#qiime-2-metagenome-distribution,https://www.researchgate.net/figure/Diagrams-of-the-BRCA1-and-BRCA2-genes-indicating-the-position-of-pathogenic-variants_fig2_321205153,https://www.fda.gov/drugs/biomarker-qualification-program/about-biomarkers-and-qualification,https://github.com/NIGMS/NIGMS-Sandbox/blob/main/README.md#available-modules,https://www.cambridge.org/highereducation/books/introduction-to-applied-linear-algebra/4D69AF22E38303FE20FFEEFDCE0E7F96#overview,https://doi.org/10.1089/wound.2019.1030,https://bio.tools/spades,https://en.wikipedia.org/wiki/Bash_(Unix_shell),https://github.com/NIGMS/NIGMS-Sandbox/blob/main/docs/HowToCreateVertexAINotebooks.md#:~:text=Select%20Advanced%20Options%20at%20the%20bottom%20of%20the%20New%20Instance,https://labormarketinfo.edd.ca.gov/data/unemployment-and-labor-force.html,https://github.com/FelixKrueger/Bismark/blob/master/docs/bismark/alignment.md#bismark-bamsam-output-default"
34+
PAT: ${{ secrets.PAT }}

.github/workflows/check_links.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ def check_link(link):
141141
elif print_valid:
142142
print(
143143
loc + " , " + link + " , Valid")
144-
return True
144+
return False
145145

146146

147147
if __name__ == "__main__":
148148
err = 0
149149
print("Directory is "+path)
150150
# Loop through all files in path
151+
151152
for root, dirs, files in os.walk(path):
152153
for file in files:
153154
# only read file that match template ( txt, md or python notebook)

.github/workflows/lint.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ def clean_notebook(file_path):
99

1010
# Clean cells
1111
for cell in notebook.cells:
12+
# skip cells with a quiz or no clean tag
13+
if 'metadata' in cell and 'tags' in cell['metadata'] and (
14+
'quiz' in cell['metadata']['tags'] or 'noclean' in cell['metadata']['tags']):
15+
continue
1216
if 'outputs' in cell:
1317
cell['outputs'] = []
1418
if 'execution_count' in cell:
@@ -18,7 +22,12 @@ def clean_notebook(file_path):
1822

1923
# Clean notebook metadata
2024
if 'metadata' in notebook:
21-
notebook['metadata'] = {}
25+
new_metadata = {}
26+
if 'language_info' in notebook['metadata']:
27+
new_metadata['language_info'] = notebook['metadata']['language_info']
28+
if 'kernelspec' in notebook['metadata']:
29+
new_metadata['kernelspec'] = notebook['metadata']['kernelspec']
30+
notebook['metadata'] = new_metadata
2231

2332
with open(file_path, 'w', encoding='utf-8') as f:
2433
nbformat.write(notebook, f)
@@ -39,7 +48,7 @@ def delete_checkpoints_dirs(root_dir):
3948

4049
if __name__ == "__main__":
4150
# Change this to the directory containing your notebooks
42-
notebook_dir = '../../'
51+
notebook_dir = '.'
4352

4453
for root, dirs, files in os.walk(notebook_dir):
4554
for file in files:

.github/workflows/notebook-lint.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,16 @@ jobs:
3838
pip3 install nbformat
3939
4040
- name: Notebook Linting
41-
working-directory: reusable-workflow-repo/.github/workflows/
4241
run: |
43-
python3 lint.py
42+
python3 ${GITHUB_WORKSPACE}/reusable-workflow-repo/.github/workflows/lint.py
43+
44+
- name: Remove workflow repo
45+
run: |
46+
rm ${GITHUB_WORKSPACE}/reusable-workflow-repo -r
4447
4548
- name: Commit changes
4649
uses: EndBug/add-and-commit@v9
4750
with:
4851
author_name: github-action
4952
author_email: cbiit-github-action@github.com
50-
message: 'Github Action: Refresh stats'
53+
message: 'Github Action: Lint Notebooks'

CheckLinks.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

docs/HowToCreateAWSSagemakerNotebooks.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,45 @@ AWS offers different types of Notebook instances: SageMaker Studio, SageMaker No
66

77
1. In AWS console, type **Amazon SageMaker** in search bar and click it:
88

9-
![selectsagemaker](/images/images_for_creating_AWS_notebooks/Screenshot1.png)
9+
![selectsagemaker](/images/images_for_creating_AWS_notebooks/Screenshot1.png)
1010

1111
2. On the left side bar click **Notebooks**:
1212

13-
![Notebooks](/images/images_for_creating_AWS_notebooks/Screenshot2.png)
13+
![Notebooks](/images/images_for_creating_AWS_notebooks/Screenshot2.png)
1414

1515
3. Click **Create notebook instance**:
1616

17-
![create_new_notebook](/images/images_for_creating_AWS_notebooks/Screenshot3.png)
17+
![create_new_notebook](/images/images_for_creating_AWS_notebooks/Screenshot3.png)
1818

1919
4. Give a name to your notebook. Choose a notebook instance type based on needs, Amazon Linux 2 as platform identifier, volume. Optional, create idle-shut by selecting create new lifecycle configuration and copy and paste [idle-shutdown.sh](/idle-shutdown.sh) and create configuration. Then click Create notebook instance:
2020

21-
![environment](/images/images_for_creating_AWS_notebooks/Screenshot4.png)
21+
![environment](/images/images_for_creating_AWS_notebooks/Screenshot4.png)
2222

2323
5. It will take about 5 minutes, your notebook instance to get ready:
2424

25-
![pending](/images/images_for_creating_AWS_notebooks/Screenshot5.png)
25+
![pending](/images/images_for_creating_AWS_notebooks/Screenshot5.png)
2626

2727

2828
6. **Open Jupyter Lab**:
2929

30-
![jupyterlab](/images/images_for_creating_AWS_notebooks/Screenshot6.png)
30+
![jupyterlab](/images/images_for_creating_AWS_notebooks/Screenshot6.png)
31+
32+
7. Clone an appropriate repository from GitHub.com:
33+
34+
![upload](/images/images_for_creating_AWS_notebooks/Screenshot7.png)
3135

32-
7. Upload your jupyter notebook
36+
8. Select a notebook and then kernel:
3337

34-
![upload](/images/images_for_creating_AWS_notebooks/Screenshot7.png)
38+
![kernel](/images/images_for_creating_AWS_notebooks/Screenshot8.png)
3539

36-
8. Select the kernel:
40+
9. To clone in your git repositories you can either use the git UI built in or by using the terminal. Using the git UI select **Clone a Repository** then paste the repo url and click **Clone**. To clone via the terminal make sure that you are in the SageMaker directory then use the command git clone [repo url]. Once you have done this you should see the repo
3741

38-
![kernel](/images/images_for_creating_AWS_notebooks/Screenshot8.png)
42+
![Clone_UI](/images/images_for_creating_AWS_notebooks/Clone_UI.png)
43+
![Clone_Terminal](/images/images_for_creating_AWS_notebooks/Clone_Terminal.png)
3944

40-
9. **IMPORTANT**: **Stop** the kernel at end of your work to avoid getting charged.
45+
10. **IMPORTANT**: **Stop** the kernel at end of your work to avoid getting charged.
4146

42-
![resize image](/images/images_for_creating_AWS_notebooks/Screenshot9.png)
47+
![resize image](/images/images_for_creating_AWS_notebooks/Screenshot9.png)
4348

4449

4550

@@ -59,15 +64,15 @@ AWS offers different types of Notebook instances: SageMaker Studio, SageMaker No
5964

6065
4. Select **Set up for single user (Quick setup)** and then click **Set up**:
6166

62-
![Domain Setup](/images/images_for_creating_AWS_notebooks/Screenshot12.png)
67+
![Domain Setup](/images/images_for_creating_AWS_notebooks/Screenshot12.png)
6368

6469
5. It will take a few minutes for the domain to setup:
6570

66-
![pending](/images/images_for_creating_AWS_notebooks/Screenshot13.png)
71+
![pending](/images/images_for_creating_AWS_notebooks/Screenshot13.png)
6772

6873
6. Once the SageMaker Domain is setup, click **Studio** on the left sidebar:
6974

70-
![Studio](/images/images_for_creating_AWS_notebooks/Screenshot14.png)
75+
![Studio](/images/images_for_creating_AWS_notebooks/Screenshot14.png)
7176

7277
7. Make sure that **Select Domain** and **Select user profile** contain domain and user then click **Open Studio**:
7378

@@ -134,11 +139,15 @@ AWS offers different types of Notebook instances: SageMaker Studio, SageMaker No
134139
![JupyterLab Space](/images/images_for_creating_AWS_notebooks/Screenshot29.png)
135140
![JupyterLab Space](/images/images_for_creating_AWS_notebooks/Screenshot30.png)
136141

137-
6. After working go back to Code Editor and stop the now unused instance by clicking ***Stop***:
142+
6. Once in code editor clone in your repository. This can be done by selecting the git icon, select **Clone Repository**, copy the web url into the box and then select **Clone from URL**. Alternatively you can open a terminal then use the command git clone web url. Once you do this cd into the cloned repository. If it doesn't show up in your folders select the file icon open folder and select the repository you cloned in.
143+
144+
![Clone For Code Editor](/images/images_for_creating_AWS_notebooks/Clone_CodeEditor.png)
145+
146+
7. After working go back to Code Editor and stop the now unused instance by clicking ***Stop***:
138147

139148
![JupyterLab Space](/images/images_for_creating_AWS_notebooks/Screenshot31.png)
140149

141-
7. Wait for the Status to show as Stopped:
150+
8. Wait for the Status to show as Stopped:
142151

143152
![JupyterLab Space](/images/images_for_creating_AWS_notebooks/Screenshot32.png)
144153

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Set Up a JupyterLab with a Custom Docker Image
2+
3+
1. In Amazon SageMaker AI, **Create domain**:
4+
5+
![](/images/images_custom_kernel/Capture1.PNG)
6+
7+
2. Leave the **Quick setup** and click **Set up**:
8+
9+
![](/images/images_custom_kernel/Capture2.PNG)
10+
11+
3. After having your domain ready, go to **Environment** tab and click **Attach image**:
12+
13+
![](/images/images_custom_kernel/Capture3.PNG)
14+
15+
4. Under **New image**, enter and ECR image URL, click **Next**:
16+
17+
![](/images/images_custom_kernel/Capture4.PNG)
18+
19+
5. Give a name to your image, select **JupyterLab image**, and **Submit**:
20+
21+
![](/images/images_custom_kernel/Capture5.PNG)
22+
23+
6. In **Studio** tab, **Select Domain** and then **Open Studio**:
24+
25+
![](/images/images_custom_kernel/Capture6.PNG)
26+
27+
7. Select **Jupyterlab**, and then click **Create JupyterLab Space**:
28+
29+
![](/images/images_custom_kernel/Capture7.PNG)
30+
31+
8. Give a name, and then **Create space**:
32+
33+
![](/images/images_custom_kernel/Capture8.PNG)
34+
35+
9. Select the custom image, instance type, and then **Run space**:
36+
37+
![](/images/images_custom_kernel/Capture9.PNG)
38+
39+
10. **Open JupyterLab**:
40+
41+
![](/images/images_custom_kernel/Capture10.PNG)

docs/HowToCreateNewTerminalConsoleJupyterLab.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Jupyter lab allows you to create a new console window within its layout. This is also possible on Jupyter lab on AWS SageMaker. Adding a terminal console window where there is a jupyter notebook tab is helpful when needing to run command line code.
44

5-
## 1) In Jupyter lab within a jupyter notebook, right click on any whitespace in the jupyter notebook.
5+
## 1) In Jupyter lab within a Jupyter notebook, right click on any whitespace in the notebook.
66

77
![Right_click](/images/images_for_creating_new_console/Right_click_notebook.png)
88

docs/HowToCreateVertexAINotebooks.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,37 @@
2929

3030
9. The remaining sections can be left as default for our purposes. Further details can be found in the official documentation: [Vertex AI Documentation](https://cloud.google.com/vertex-ai/docs/workbench/instances/create)
3131

32-
### 2. Spin up a User-Managed Notebook Instance
32+
### 2. Spin up Instance from a Container
33+
1. Start by clicking the `hamburger menu` (the three horizontal lines in the top left of your console). Go to `Artificial Intelligence > Vertex AI > Workbench`.
34+
35+
![screenshot showing how to select Vertex AI workbench](/images/1_select_vertexAI.png)
36+
37+
2. If not already selected, click **Instances**, then **Instances**
38+
3. Click **+ Create New**
39+
40+
![image showing how to select instance](/images/images_for_creating_GCP_instances/2_select_workbench_instance.png)
41+
42+
4. Select **Advanced Options** at the bottom of the **New Instance** pop-up window
43+
5. Provide a name for your new instance using letters, numbers, and hyphens (-). Select a region and zone for the new instance. For best network performance, select the region that is geographically closest to you. Click **Continue**
44+
45+
![image showing to select advanced options](/images/images_for_creating_GCP_instances/3_select_advanced_options.png)
46+
47+
6. On the Environment screen, select "Use custom container" and then enter your container name. \
48+
Click **Continue**.
49+
50+
![image showing to select environment](/images/images_for_creating_GCP_instances/custom_container.png)
51+
52+
7. On the Machine type screen, select the desired number of CPUs/GPUs. This is usually specified by the tutorial you are completing.
53+
54+
![image showing machine type selection](/images/images_for_creating_GCP_instances/5_instance_machine_type.png)
55+
56+
8. On the same screen, verify that **Enable Idle Shutdown** is selected and specify the idle minutes for shutdown. This means it will shutdown automatically after this many minutes. We recommend 30 minutes. Click **Create**. It will take a few minutes for your instance to spin up.
57+
58+
![image showing idle shutdown selection](/images/images_for_creating_GCP_instances/6_instance_idle_shutdown.png)
59+
60+
9. The remaining sections can be left as default for our purposes. Further details can be found in the official documentation: [Vertex AI Documentation](https://cloud.google.com/vertex-ai/docs/workbench/instances/create)
61+
62+
### 3. Spin up a User-Managed Notebook Instance
3363
1. Start by clicking the `hamburger menu` (the three horizontal lines in the top left of your console). Go to `Artificial Intelligence > Vertex AI > Workbench`.
3464

3565
![screenshot showing how to select Vertex AI workbench](/images/1_select_vertexAI.png)

0 commit comments

Comments
 (0)