diff --git a/CHANGELOG.md b/CHANGELOG.md index 78f86c63..0be19d33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## v2.2.0dev - [25-Oct-2024] +## v2.2.0dev - [31-Oct-2024] ### `Added` @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 5. Added `text/html` as content mime type for the report file [#146](https://github.com/Plant-Food-Research-Open/assemblyqc/issues/146) 6. Added a sequence labels table below the HiC contact map [#147](https://github.com/Plant-Food-Research-Open/assemblyqc/issues/147) 7. Added parameter `hic_samtools_ext_args` and set its default value to `-F 3852` [#159](https://github.com/Plant-Food-Research-Open/assemblyqc/issues/159) +8. Added the HiC QC report to the final report so that users don't have to navigate to the results folder [#162](https://github.com/Plant-Food-Research-Open/assemblyqc/issues/162) ### `Fixed` diff --git a/bin/report_modules/parsers/hic_parser.py b/bin/report_modules/parsers/hic_parser.py index 01992ecd..17231e17 100644 --- a/bin/report_modules/parsers/hic_parser.py +++ b/bin/report_modules/parsers/hic_parser.py @@ -15,28 +15,38 @@ def parse_hic_folder(folder_name="hic_outputs"): return {} list_of_hic_files = hic_folder_path.glob("*.html") + list_of_hic_files = [ + x for x in list_of_hic_files if re.match(r"^\w+\.html$", x.name) + ] data = {"HIC": []} for hic_path in list_of_hic_files: hic_file_name = os.path.basename(str(hic_path)) - file_tokens = re.findall( + tag = re.findall( r"([\w]+).html", hic_file_name, )[0] - labels_table = pd.read_csv(f"{folder_name}/{file_tokens}.agp.assembly", sep=" ") - + # Get the labels table + labels_table = pd.read_csv(f"{folder_name}/{tag}.agp.assembly", sep=" ") labels_table = labels_table[labels_table.iloc[:, 0].str.startswith(">")].iloc[ :, [0, 2] ] labels_table.columns = ["Sequence", "Length"] labels_table.Length = labels_table.Length.astype(int) + # Get the HiC QC report + hicqc_report = [ + x + for x in hic_folder_path.glob("*.pdf") + if re.match(rf"[\S]+\.on\.{tag}_qc_report\.pdf", x.name) + ][0] + data["HIC"].append( { - "hap": file_tokens, + "hap": tag, "hic_html_file_name": hic_file_name, "labels_table": labels_table.to_dict("records"), "labels_table_html": tabulate( @@ -46,6 +56,7 @@ def parse_hic_folder(folder_name="hic_outputs"): numalign="left", showindex=False, ), + "hicqc_report_pdf": os.path.basename(str(hicqc_report)), } ) diff --git a/bin/report_modules/templates/header.html b/bin/report_modules/templates/header.html index 989b37f0..795ecd3d 100644 --- a/bin/report_modules/templates/header.html +++ b/bin/report_modules/templates/header.html @@ -213,6 +213,18 @@ .iframe-wrapper { text-align: center; + width: 90%; + margin-left: auto; + margin-right: auto; + margin-bottom: 32px; + } + + .iframe-wrapper-hic { + width: 700px; + height: 850px; + margin-left: auto; + margin-right: auto; + margin-bottom: 32px; } .tab { diff --git a/bin/report_modules/templates/hic/report_contents.html b/bin/report_modules/templates/hic/report_contents.html index 4a7f3089..b35fa5dd 100644 --- a/bin/report_modules/templates/hic/report_contents.html +++ b/bin/report_modules/templates/hic/report_contents.html @@ -5,14 +5,23 @@
Sequence labels and lengths
+HiC QC report
+