-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScript_0_Coding_basics.sh
More file actions
145 lines (106 loc) · 3.43 KB
/
Copy pathScript_0_Coding_basics.sh
File metadata and controls
145 lines (106 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#####################################
#
# Part 0: Coding basics
# January 2025
#
# Code Contributor: Cassandra E.
# Biodiversity Research Center, UBC
#
#####################################
# Globus login: https://www.globus.org/data-transfer
# Workshop data directory: /scratch/celphin/GBS_workshop/
################################
# Terminal
# Windows users: https://mobaxterm.mobatek.net/download.html
# Mac/Linux
ssh -X username@narval.computecanada.ca
####################################
# Exploring the server
ls # to list files in directory
cd ~/scratch # to change directories
mkdir GBS_tutorial # to make a new directory
#----------------------------
# Tmux or screen sessions
tmux new-session -s GBS
cd ~/scratch/GBS_workshop
cp -vr /home/yueyu/scratch/GBS_workshop/* .
#Ctrl+B d # will exit the tmux session
tmux attach-session -t GBS # reattach
#Ctrl+B d # will exit the tmux session again
#-------------------------------
# Modules
# https://docs.alliancecan.ca/wiki/Available_software
module spider python
module load python
module list
python
#------------------------------------
# Please run this before Day 2 - install R packages using tmux and module
# tmux new-session -s GBS
tmux attach-session -t GBS # reattach
module load StdEnv/2020
module load r/4.2.1
R
install.packages("tidyverse")
install.packages("ggplot2")
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("SNPRelate")
#Ctrl+B d # will exit the tmux session
#-----------------------------------------
# Quota
# https://docs.alliancecan.ca/wiki/Storage_and_file_management
quota
# Description Space # of files
# /home (project celphin) 2461M/50G 54k/500k
# /scratch (project celphin) 16T/20T 86k/1000k
# /project (project def-prof) 441k/1000G 18/500k
#------------------------------------------
# Scripts
mkdir ~/scratch/test; cd ~/scratch/test
nano test_script.sh # makes and opens a script file
# can also make file with
cat << EOF > test_script.sh
#!/bin/bash
echo hello $USER
EOF
# to run
./test_script.sh
# update permissions
chmod +755 test_script.sh
# try running again
./test_script.sh
#-------------------------------------------
# Slurm interactive allocations
# https://docs.alliancecan.ca/wiki/Running_jobs
# tmux new-session -s GBS
tmux attach-session -t GBS # reattach
# Node: celphin@narval1
# request an interactive allocation
salloc -c1 --time 3:00:00 --mem 20000m --account def-prof
# wait for allocation to be granted
Ctrl+B d # will exit the tmux session
sq # to view queue
seff # to see job efficiency
exit # to cancel the allocation once you get it and are in it
scancel -u <username> # to cancel all slurm allocations or requests
#-------------------------------------------
# Slurm script example
# https://docs.alliancecan.ca/wiki/Running_jobs
cat << EOF > slurm_script.sh
#!/bin/bash
#SBATCH --account=def-prof # need to set for your PI's account
#SBATCH --time=0-02:50:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=48
#SBATCH --mem=187G
module load StdEnv/2020
module load fastsimcoal2/2.7.0.9
cd ~/scratch/Cassiope/Fastsimcoal2_Mar2024/runs/5pops_mertensiana_$i
srun fsc27 -t *.tpl -n 100000 -e *.est -0 -m -M -L 48 -B 48 -c 48 --multiSFS -q
EOF
# to submit the job script to the queue
sbatch slurm_script.sh
# to check the queue
sq
#################################