Commit 7b21ecbe authored by Blaise Li's avatar Blaise Li
Browse files

Added --delete option to rsync on success.

This is to limit clutter from old analyses.
parent 6fcd8adc
......@@ -720,7 +720,7 @@ rule make_normalized_bigwig:
onsuccess:
print("iCLIP data analysis finished.")
cleanup_and_backup(output_dir, config)
cleanup_and_backup(output_dir, config, delete=True)
onerror:
shell(f"rm -rf {output_dir}_err")
......
......@@ -59,7 +59,7 @@ CONTRAST2PAIR = dict(zip(DD_CONTRASTS, DD_COND_PAIRS))
# TODO: have a distinct subset of biotypes for join_all_counts, that are guaranteed overlap-free.
BIOTYPES = config["biotypes"]
ORIENTATIONS = ["all"]
ORIENTATIONS = ["all", "fwd", "rev"]
aligner = config["aligner"]
alignment_settings = {
......@@ -516,7 +516,7 @@ rule compute_efficiency_difference:
onsuccess:
print("Degradome-seq analysis finished.")
cleanup_and_backup(output_dir, config)
cleanup_and_backup(output_dir, config, delete=True)
onerror:
shell(f"rm -rf {output_dir}_err")
......
......@@ -1687,7 +1687,7 @@ rm -rf ${{tmpdir}}
onsuccess:
print("PRO-seq analysis finished.")
cleanup_and_backup(output_dir, config)
cleanup_and_backup(output_dir, config, delete=True)
onerror:
shell(f"rm -rf {output_dir}_err")
......
......@@ -2020,7 +2020,7 @@ rule make_contrast_lfc_boxplots:
onsuccess:
print("RNA-seq analysis finished.")
cleanup_and_backup(output_dir, config)
cleanup_and_backup(output_dir, config, delete=True)
onerror:
shell(f"rm -rf {output_dir}_err")
......
......@@ -3467,7 +3467,7 @@ def try_to_cluster_genes(counts_data):
onsuccess:
print("small RNA-seq analysis finished.")
cleanup_and_backup(output_dir, config)
cleanup_and_backup(output_dir, config, delete=True)
onerror:
......
......@@ -128,7 +128,7 @@ def wc_applied(source_function):
return wc_applied_source_func
def cleanup_and_backup(output_dir, config):
def cleanup_and_backup(output_dir, config, delete=False):
"""Performs cleanup and backup according to the information present in the
*config* dictionary."""
print("removing metadata")
......@@ -142,6 +142,10 @@ def cleanup_and_backup(output_dir, config):
# If no dest_dir, we assume the directory structure
# is the same on the destination host
dest_dir = config["backup"].get("dest_dir", os.getcwd())
if delete:
rsync_options = "-vaP --delete"
else:
rsync_options = "-vaP"
try:
print(f"backuping results to {user}@{host}:{dest_dir}")
shell(f"rsync -vaP {output_dir} {user}@{host}:{dest_dir}")
......
......@@ -4346,7 +4346,7 @@ def try_to_cluster_genes(counts_data):
onsuccess:
print("small RNA-seq analysis finished.")
cleanup_and_backup(output_dir, config)
cleanup_and_backup(output_dir, config, delete=True)
onerror:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment