Skip to content

Commit

Permalink
add figs to report
Browse files Browse the repository at this point in the history
  • Loading branch information
ziadbkh committed May 12, 2024
1 parent a7a870f commit 2d349a9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
16 changes: 8 additions & 8 deletions assets/alphafold_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ <h3> Download </h3>
</div>
<table width="100%">
<tr>
<td width="33%" style="align-content: center;"><img width="400px" id="seq_cov_img" src="*sample_name_here*_seq_coverage.png"></img></td>
<td width="33%" style="align-content: center;"><img id="lddt_img" width="400px" src="*sample_name_here*_coverage_LDDT_0.png"></img></td>
<td width="33%" style="align-content: center;"><img id="pae_img" width="400px" src="*model_pae*"></img></td>
<td width="33%" style="align-content: center;"><img width="400px" id="seq_cov_img" src="seq_coverage.png"></img></td>
<td width="33%" style="align-content: center;"><img id="lddt_img" width="400px" src="coverage_LDDT_0.png"></img></td>
<!--<td width="33%" style="align-content: center;"><img id="pae_img" width="400px" src=""></img></td>-->
</tr>
</table>
</div>
Expand Down Expand Up @@ -475,11 +475,11 @@ <h3> Download </h3>
]

const LDDT_IMGS = [
"*sample_name_here*_coverage_LDDT_0.png",
"*sample_name_here*_coverage_LDDT_1.png",
"*sample_name_here*_coverage_LDDT_2.png",
"*sample_name_here*_coverage_LDDT_3.png",
"*sample_name_here*_coverage_LDDT_4.png"
"coverage_LDDT_0.png",
"coverage_LDDT_1.png",
"coverage_LDDT_2.png",
"coverage_LDDT_3.png",
"coverage_LDDT_4.png"
]

const REPRESENTATIONS = [
Expand Down
11 changes: 11 additions & 0 deletions assets/generat_plots_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from matplotlib import pyplot as plt
import argparse
from collections import OrderedDict
import base64

def generate_output_images(msa_path, plddt_paths, name, out_dir):
msa = []
Expand Down Expand Up @@ -123,10 +124,20 @@ def generate_output_images(msa_path, plddt_paths, name, out_dir):

alphfold_template = open(args.html_template, "r").read()
alphfold_template = alphfold_template.replace(f"*sample_name_here*", args.name)

i = 0
for structure in structures:
alphfold_template = alphfold_template.replace(f"*_data_ranked_{i}.pdb*", open(structure, "r").read().replace("\n", "\\n"))
i += 1

with open(f"{args.output_dir}/{args.name + ('_' if args.name else '')}seq_coverage.png", "rb") as in_file:
alphfold_template = alphfold_template.replace(f"seq_coverage.png", f"data:image/png;base64,{base64.b64encode(in_file.read()).decode('utf-8')}")

for i in range(0, 5):
with open(f"{args.output_dir}/{args.name + ('_' if args.name else '')}coverage_LDDT_{i}.png", "rb") as in_file:
alphfold_template = alphfold_template.replace(f"coverage_LDDT_{i}.png", f"data:image/png;base64,{base64.b64encode(in_file.read()).decode('utf-8')}")



with open(f"{args.output_dir}/{args.name}_alphafold.html", "w") as out_file:
out_file.write(alphfold_template)
2 changes: 0 additions & 2 deletions tower.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ reports:
display: "Auto-created samplesheet with collated metadata and FASTQ paths"
"*_alphafold.html":
display: "Predected structures"
"*.png":
display: "Plots"

0 comments on commit 2d349a9

Please sign in to comment.