-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_samplesheet_se.sh
More file actions
executable file
·45 lines (26 loc) · 907 Bytes
/
get_samplesheet_se.sh
File metadata and controls
executable file
·45 lines (26 loc) · 907 Bytes
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
#!/bin/bash
# create or clear the samplesheet.csv
echo "sample,fastq_1" > samplesheet.csv
# loop through each directory in the current directory
for dir in */; do
# check if it's a directory
if [ -d "$dir" ]; then
# find the *_R1_001.fastq.gz and *_R1_002.fastq.gz files in the directory
for pattern in '*_R1_001.fastq.gz'; do
files=$(find "$dir" -maxdepth 1 -name "$pattern")
for file in $files; do
if [ -f "$file" ]; then
# remove the .fastq.gz extension from the file
filename=$(basename "$file" .fastq.gz)
# get the absolute path of the file
abs_path=$(realpath "$file")
# write the filename to samplesheet.csv
echo "$filename,$abs_path" >> samplesheet.csv
else
echo "No $pattern file found in $dir."
fi
done
done
fi
done
echo "samplesheet.csv created!"