-
Notifications
You must be signed in to change notification settings - Fork 1
/
GSEA_check.sh
executable file
·44 lines (35 loc) · 1.18 KB
/
GSEA_check.sh
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
# Author: Daniel Guevara
# June 23rd, 2024
# Use this script to check that merged files have the same sets.
# ------------- #
# Define routes #
# ------------- #
main_dir=/path_to_home_directory
output_dir=$main_dir/C2_CGP
# Temporary file to store the first set of names
temp_file=$(mktemp)
# Flag to track if this is the first file
first_file=true
# Iterate over each merged file in the output directory
for file in "$output_dir"/*.tsv; do
# Extract the NAME column (assuming it's the first column) and sort the names
cut -f1 "$file" | sort > "$temp_file"_new
if [ "$first_file" = true ]; then
# Copy the names from the first file to the temp_file
mv "$temp_file"_new "$temp_file"
first_file=false
else
# Compare the current file's names with the stored names
if ! cmp -s "$temp_file" "$temp_file"_new; then
echo "The file $file does not share the same sets (values in the column NAME) as the others."
rm "$temp_file" "$temp_file"_new
exit 1
fi
# Clean up the temporary comparison file
rm "$temp_file"_new
fi
done
echo "All files share the same sets (values in the column NAME)."
rm "$temp_file"