Skip to content

Commit

Permalink
Added a sequence labels table below the HiC contact map
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp committed Oct 14, 2024
1 parent 789ae12 commit af9a257
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 14 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 - [10-Oct-2024]
## v2.2.0dev - [15-Oct-2024]

### `Added`

Expand All @@ -12,14 +12,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3. Updated `samtools faidx` to 1.21
4. Now using nf-test for pipeline level testing [#153](https://github.com/Plant-Food-Research-Open/assemblyqc/issues/153)
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)

### `Fixed`

1. Fixed a bug where Gene score distribution graph did not appear correctly [#125](https://github.com/Plant-Food-Research-Open/assemblyqc/issues/125)

### `Dependencies`

1. Nextflow!>=23.04.0
1. Nextflow!>=24.04.2
2. [email protected]

### `Deprecated`
Expand Down
18 changes: 18 additions & 0 deletions bin/report_modules/parsers/hic_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
from pathlib import Path
import pandas as pd
from tabulate import tabulate
import re

from report_modules.parsers.parsing_commons import sort_list_of_results
Expand All @@ -24,10 +26,26 @@ def parse_hic_folder(folder_name="hic_outputs"):
hic_file_name,
)[0]

labels_table = pd.read_csv(f"{folder_name}/{file_tokens}.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)

data["HIC"].append(
{
"hap": file_tokens,
"hic_html_file_name": hic_file_name,
"labels_table": labels_table.to_dict("records"),
"labels_table_html": tabulate(
labels_table,
headers=["Sequence", "Length"],
tablefmt="html",
numalign="left",
showindex=False,
),
}
)

Expand Down
23 changes: 12 additions & 11 deletions bin/report_modules/templates/hic/report_contents.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{% set vars = {'is_first': True} %} {% for item in range(all_stats_dicts["HIC"]|length) %} {% set active_text =
'display: block' if vars.is_first else 'display: none' %}
<div id="tabcontent_HIC_{{ all_stats_dicts['HIC'][item]['hap'] }}" class="tabcontent-HIC" style="{{ active_text }}">
<div class="results-section">
<div class="section-heading-wrapper">
<div class="section-heading">{{ all_stats_dicts['HIC'][item]['hap'] }}</div>
</div>
<div class="iframe-wrapper">
<iframe
src="./hic/{{ all_stats_dicts['HIC'][item]['hic_html_file_name'] }}"
width="100%"
height="100%"
></iframe>
</div>
<div class="results-section">
<div class="section-heading-wrapper">
<div class="section-heading">{{ all_stats_dicts['HIC'][item]['hap'] }}</div>
</div>
<div class="iframe-wrapper">
<iframe src="./hic/{{ all_stats_dicts['HIC'][item]['hic_html_file_name'] }}" width="100%" height="100%"></iframe>
</div>
</div>
<div class="results-section">
<div class="table-outer">
<div class="table-wrapper">{{ all_stats_dicts['HIC'][item]['labels_table_html'] }}</div>
</div>
</div>
</div>
{% if vars.update({'is_first': False}) %} {% endif %} {% endfor %}
1 change: 1 addition & 0 deletions subworkflows/local/fq2hic.nf
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,6 @@ workflow FQ2HIC {
emit:
hic = ch_hic
html = HIC2HTML.out.html
assembly = AGP2ASSEMBLY.out.assembly
versions = ch_versions
}
7 changes: 6 additions & 1 deletion workflows/assemblyqc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,11 @@ workflow ASSEMBLYQC {
)

ch_hic_html = FQ2HIC.out.html
ch_hic_assembly = FQ2HIC.out.assembly
ch_hic_report_files = ch_hic_html
| mix(
ch_hic_assembly.map { tag, assembly -> assembly }
)
ch_versions = ch_versions.mix(FQ2HIC.out.versions)

// SUBWORKFLOW: FASTA_SYNTENY
Expand Down Expand Up @@ -822,7 +827,7 @@ workflow ASSEMBLYQC {
ch_tidk_outputs .collect().ifEmpty([]),
ch_lai_outputs .collect().ifEmpty([]),
ch_kraken2_plot .collect().ifEmpty([]),
ch_hic_html .collect().ifEmpty([]),
ch_hic_report_files .collect().ifEmpty([]),
ch_synteny_outputs .collect().ifEmpty([]),
ch_merqury_outputs .collect().ifEmpty([]),
ch_versions_yml,
Expand Down

0 comments on commit af9a257

Please sign in to comment.