7 Week 3 Exercises
7.1 In-class
- Try it out:
./scripts/week3/batch_on_rhino.sh- Try it out:
#| eval: false
sbatch sbatch_test.shand examine the following output files:
- Try it out:
7.2 Homework exercises
Exercises 1, 2, 3 are required for the badge.
- In the
data/folder, there is a list of.csvfiles. Modify the code below to process each file.
#!/bin/bash
for file in ------
do
head ------
done- Modify the code in 1) to write a
forloop in a script to count the number of lines for each.csvfile. The output should be:
echo "${file}\t(wc -l $file)\n"
Run the script and redirect your output to files_out.txt. Put your bash command you used below:
- Modify the below script to process the
.samfiles in./data/. Save it assbatch_sam.shand run it. How many files were generated?
#!/bin/bash
#SBATCH --array=1-________
module load SAMtools
file_array=(./data/*.sam)
ind=$((SLURM_ARRAY_TASK_ID-1))
current_file=${file_array[$ind]}
samtools view -c $current_file > ${current_file}.counts.out