Skip to content

Commit 85f518d

Browse files
authored
forgot to add new script (#45)
patch fix for #44
1 parent 6c39193 commit 85f518d

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from jinja2 import Environment, FileSystemLoader
2+
from pathlib import Path
3+
4+
datasets = snakemake.params.datasets
5+
total_html = snakemake.output.total_html
6+
subj_htmls = snakemake.input.subj_htmls
7+
8+
# load jinja template
9+
file_loader = FileSystemLoader(".")
10+
env = Environment(loader=file_loader)
11+
template = env.get_template(snakemake.input.report_html)
12+
13+
output = template.render()
14+
15+
for i,subj_html in enumerate(subj_htmls):
16+
subject=datasets.loc[i,'subject']
17+
sample=datasets.loc[i,'sample']
18+
acq=datasets.loc[i,'acq']
19+
20+
relative_path = Path(subj_html).relative_to(Path(total_html).parent)
21+
# Create line to add link to subject into final qc report combining all subjects
22+
subj_link = f'\n\t\t<a href="{relative_path}">sub-{subject}_sample-{sample}_acq-{acq}</a><br>\n'
23+
24+
output+=subj_link
25+
26+
with open(total_html, 'w') as f:
27+
f.write(output)

0 commit comments

Comments
 (0)