Skip to content

Commit 269271e

Browse files
committed
make symlinks to stats relative
1 parent 0b643c0 commit 269271e

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

workflow/rules/report.smk

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11

22
rule symlink_stats:
33
input:
4-
os.path.join(result_path, 'results', "{sample}", '{sample}.stats.tsv'),
5-
os.path.join(result_path, 'results', "{sample}", '{sample}.tss_histogram.csv'),
6-
os.path.join(result_path, 'results', "{sample}", 'mapped', '{sample}.txt'),
7-
os.path.join(result_path, 'results', "{sample}", 'mapped', '{sample}.fastp.json'),
8-
os.path.join(result_path, 'results', "{sample}", 'mapped', '{sample}.samblaster.log'),
9-
os.path.join(result_path, 'results', "{sample}", 'mapped', '{sample}.samtools_flagstat.log'),
10-
os.path.join(result_path, 'results', "{sample}", 'peaks', '{sample}.macs2.log'),
11-
os.path.join(result_path, 'results', "{sample}", 'peaks', '{sample}_peaks.xls'),
4+
stats_tsv = os.path.join(result_path, 'results', "{sample}", '{sample}.stats.tsv'),
5+
tss_csv = os.path.join(result_path, 'results', "{sample}", '{sample}.tss_histogram.csv'),
6+
mapped_txt = os.path.join(result_path, 'results', "{sample}", 'mapped', '{sample}.txt'),
7+
fastp_json = os.path.join(result_path, 'results', "{sample}", 'mapped', '{sample}.fastp.json'),
8+
samblaster_log = os.path.join(result_path, 'results', "{sample}", 'mapped', '{sample}.samblaster.log'),
9+
flagstat_log = os.path.join(result_path, 'results', "{sample}", 'mapped', '{sample}.samtools_flagstat.log'),
10+
macs2_log = os.path.join(result_path, 'results', "{sample}", 'peaks', '{sample}.macs2.log'),
11+
peaks_xls = os.path.join(result_path, 'results', "{sample}", 'peaks', '{sample}_peaks.xls'),
1212
output:
13-
os.path.join(result_path, 'report', '{sample}.stats.tsv'),
14-
os.path.join(result_path, 'report', '{sample}_TSS.csv'),
15-
os.path.join(result_path, 'report', '{sample}.txt'),
16-
os.path.join(result_path, 'report', '{sample}.fastp.json'),
17-
os.path.join(result_path, 'report', '{sample}.samblaster.log'),
18-
os.path.join(result_path, 'report', '{sample}.samtools_flagstat.log'),
19-
os.path.join(result_path, 'report', '{sample}.macs2.log'),
20-
os.path.join(result_path, 'report', '{sample}_peaks.xls'),
13+
stats_tsv = os.path.join(result_path, 'report', '{sample}.stats.tsv'),
14+
tss_csv = os.path.join(result_path, 'report', '{sample}_TSS.csv'),
15+
mapped_txt = os.path.join(result_path, 'report', '{sample}.txt'),
16+
fastp_json = os.path.join(result_path, 'report', '{sample}.fastp.json'),
17+
samblaster_log = os.path.join(result_path, 'report', '{sample}.samblaster.log'),
18+
flagstat_log = os.path.join(result_path, 'report', '{sample}.samtools_flagstat.log'),
19+
macs2_log = os.path.join(result_path, 'report', '{sample}.macs2.log'),
20+
peaks_xls = os.path.join(result_path, 'report', '{sample}_peaks.xls'),
2121
params:
2222
# cluster parameters
2323
partition=config.get("partition"),
2424
resources:
2525
mem_mb=config.get("mem", "1000"),
2626
threads: config.get("threads", 1)
2727
log:
28-
"logs/rules/symlink_stats_{sample}.log"
28+
os.path.join("logs", "rules", "symlink_stats_{sample}.log")
2929
shell:
3030
"""
31-
ln -sf "../../../../{input[0]}" {output[0]}
32-
ln -sf "../../../../{input[1]}" {output[1]}
33-
ln -sf "../../../../{input[2]}" {output[2]}
34-
ln -sf "../../../../{input[3]}" {output[3]}
35-
ln -sf "../../../../{input[4]}" {output[4]}
36-
ln -sf "../../../../{input[5]}" {output[5]}
37-
ln -sf "../../../../{input[6]}" {output[6]}
38-
ln -sf "../../../../{input[7]}" {output[7]}
31+
ln -sfn $(realpath --relative-to=$(dirname {output.stats_tsv}) {input.stats_tsv}) {output.stats_tsv}
32+
ln -sfn $(realpath --relative-to=$(dirname {output.tss_csv}) {input.tss_csv}) {output.tss_csv}
33+
ln -sfn $(realpath --relative-to=$(dirname {output.mapped_txt}) {input.mapped_txt}) {output.mapped_txt}
34+
ln -sfn $(realpath --relative-to=$(dirname {output.fastp_json}) {input.fastp_json}) {output.fastp_json}
35+
ln -sfn $(realpath --relative-to=$(dirname {output.samblaster_log}) {input.samblaster_log}) {output.samblaster_log}
36+
ln -sfn $(realpath --relative-to=$(dirname {output.flagstat_log}) {input.flagstat_log}) {output.flagstat_log}
37+
ln -sfn $(realpath --relative-to=$(dirname {output.macs2_log}) {input.macs2_log}) {output.macs2_log}
38+
ln -sfn $(realpath --relative-to=$(dirname {output.peaks_xls}) {input.peaks_xls}) {output.peaks_xls}
3939
"""
4040

4141
rule ucsc_hub:

0 commit comments

Comments
 (0)