-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path03_assignment.qmd
More file actions
106 lines (76 loc) · 2.31 KB
/
03_assignment.qmd
File metadata and controls
106 lines (76 loc) · 2.31 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
---
title: "Week 3: Assignment"
format: html
---
## In-class
1. Pull the `samtools` Docker container:
```bash
module load Apptainer/1.1.6
apptainer pull docker://biocontainers/samtools:v1.9-4-deb_cv1
```
2. Open a shell in the Docker container:
```bash
apptainer shell docker://biocontainers/samtools:v1.9-4-deb_cv1
```
Try accessing files in your `/home/username/` directory:
```bash
ls -l /home/laderast/bash_for_bio/
```
That didn't work - exit the shell:
```
exit
```
3. Bind your directory so that the Docker container can see it:
```bash
apptainer shell --bind /user/tladera2/bash_for_bio:/bash_for_bio docker://biocontainers/samtools:v1.9-4-deb_cv1
```
Try accessing files in `bash_for_bio/`
```bash
samtools view -c bash_for_bio/data/MOLM13_combined_final.sam > bash_for_bio/MOLM13_counts.txt
```
```bash
exit
```
4. Try running the command using `apptainer exec`:
```bash
apptainer exec \
--bind /users/tladera2/bash_for_bio:/bash_for_bio \
docker://biocontainers/samtools:v1.9-4-deb_cv1 \
samtools view -c bash_for_bio/data/MOLM13_combined_final.sam > \
/bash_for_bio/MOLM13_combined_final.counts.txt
```
## Homework
1. Adapt the for loop in this script to use `apptainer exec`. You can use an ubuntu container for this.
```bash
#!/bin/bash
for file in ./data/*.fastq
do
wc $file
done
```
2. Modify `run_bwa.sh` in `week3/` to use apptainer for bwa. Hints: you will need to load Apptainer, and use `apptainer exec`. To make things easier, pull the bwa container first.
```bash
#!/bin/bash
module load BWA/0.7.17-GCCcore-11.2.0
input_fastq=${1}
# strip path and suffix
base_file_name="${input_fastq%.fastq}"
base_file_name=${base_file_name##*/}
echo "running $input_fastq"
sample_name="SM:${base_file_name}"
read_group_id="ID:${base_file_name}"
platform_info="PL:Illumina"
ref_fasta_local="/shared/biodata/reference/iGenomes/Homo_sapiens/UCSC/hg19/Sequence/BWAIndex/genome.fa"
bwa mem \
-p -v 3 -M \
-R "@RG\t${read_group_id}\t${sample_name}\t${platform_info}" \
"${ref_fasta_local}" "${input_fastq}" > \
"${base_file_name}.sam"
module purge
```
Run the `run_bwa.sh` script on one of the files to ensure that it works.
```bash
```
Try using `week3/run_sbatch.sh` on the files in the `data/` directory. Were there any modifications you needed to make to `run_sbatch.sh`?
```bash
```