Skip to content

Commit

Permalink
refactor: simplify create_contrast_peakcaller_files
Browse files Browse the repository at this point in the history
Most of the code is unnecessary because cat can handle multiple files
  • Loading branch information
kelly-sovacool committed Apr 18, 2024
1 parent 11c6f6b commit 106a34e
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions workflow/rules/annotations.smk
Original file line number Diff line number Diff line change
Expand Up @@ -273,25 +273,7 @@ if config["run_contrasts"] == "Y":
peak_contrast_files=join(RESULTSDIR,"peaks","{qthresholds}","{peak_caller}","annotation","go_enrichment","{contrast_list}.{dupstatus}.txt")
shell:
"""
set -exo pipefail
if [[ -d "/lscratch/$SLURM_JOB_ID" ]]; then
TMPDIR="/lscratch/$SLURM_JOB_ID"
else
TMPDIR="/dev/shm"
fi
# for each of the file, find matches to the peak_type
if [[ -f $$TMPDIR/merge.txt ]]; then rm $TMPDIR/merge.txt; fi
# pull file list
# /data/sevillas2/carlisle/v2.0/results/peaks/0.05/contrasts/53_H3K4me3_vs_HN6_H3K4me3.dedup/53_H3K4me3_vs_HN6_H3K4me3.dedup.seacr_stringent.txt
for f in {params.search_dir}/{params.contrast_list}.{params.dupstatus}/{params.contrast_list}.{params.dupstatus}.{params.peak_caller}*.txt; do
cat $f >> $TMPDIR/merge.txt
done
# save to output
cat $TMPDIR/merge.txt | sort | uniq > {output.peak_contrast_files}
rm $TMPDIR/merge.txt
cat {input.contrast_files} | sort | uniq > {output.peak_contrast_files}
"""

rule go_enrichment:
Expand Down

0 comments on commit 106a34e

Please sign in to comment.