forked from EngreitzLab/scE2G
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_multiple_projects.sh
More file actions
48 lines (40 loc) · 1.77 KB
/
Copy pathrun_multiple_projects.sh
File metadata and controls
48 lines (40 loc) · 1.77 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
#!/bin/bash
# Usage: ./script.sh project1 project2 ...
# Check that at least one project name was provided.
if [ "$#" -lt 1 ]; then
echo "Usage: $0 project1 project2 ..."
exit 1
fi
# Read project names from command-line arguments.
RUN_TYPE_PROJECTS=("$@")
# Concatenate project names with underscores to form a unique identifier.
RESULT_NAME=results/$(date +%Y-%m-%d-%H%M)_$(IFS=_; echo "${RUN_TYPE_PROJECTS[*]}")
# Define the output concatenated cell_clusters file.
OUTPUT_CELL_CLUSTERS=${RESULT_NAME}.tsv
# Concatenate TSV files:
# Assumes each TSV file has the same header; we keep the header from the first file only.
FIRST=1
for proj in "${RUN_TYPE_PROJECTS[@]}"; do
INPUT_FILE="/maps/projects/cbmr_shared/people/tqb695/GDPR/_targets/files/scE2G_cfg_clusters_w_peaks_file.all.real.${proj}.tsv"
if [ $FIRST -eq 1 ]; then
# Write the header from the first file.
head -n 1 "$INPUT_FILE" > "$OUTPUT_CELL_CLUSTERS"
# Process data lines: prepend project name to the first column.
tail -n +2 "$INPUT_FILE" | awk -v proj="${proj}" 'BEGIN { FS=OFS="\t" } { $1 = proj "_" $1; print }' >> "$OUTPUT_CELL_CLUSTERS"
FIRST=0
else
# For subsequent files, skip the header and process data lines.
tail -n +2 "$INPUT_FILE" | awk -v proj="${proj}" 'BEGIN { FS=OFS="\t" } { $1 = proj "_" $1; print }' >> "$OUTPUT_CELL_CLUSTERS"
fi
done
# exit 0
# Run snakemake once using the concatenated cell_clusters file and combined results directory.
snakemake \
--profile snakemake_slurm_profile \
--use-conda \
--config \
cell_clusters="$OUTPUT_CELL_CLUSTERS" \
results_dir=${RESULT_NAME} \
IGV_dir=${RESULT_NAME} \
gene_annotations="/maps/projects/cbmr_shared/people/wkq953/non-GDPR/segment/pipeline/resources/gencode.v32.annotation.gtf.gz" \
make_IGV_tracks=True