forked from MultiQC/MultiQC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into adding-mgikit-plugin
- Loading branch information
Showing
46 changed files
with
1,936 additions
and
859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,4 @@ demo | |
# Other things | ||
.idea | ||
.vscode | ||
docs | ||
test-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import re | ||
from pathlib import Path | ||
import subprocess | ||
from typing import TypedDict | ||
|
||
|
||
def extract_first_second_level_section(markdown) -> str: | ||
# Match the first second-level section and capture its content | ||
pattern = r"(##\s+.*?)(?=(\n##\s+|$))" | ||
match = re.search(pattern, markdown, re.DOTALL) | ||
|
||
if not match: | ||
raise ValueError("Could not find first second-level section in changelog") | ||
|
||
# Return the matched section | ||
return match.group(1).strip() | ||
|
||
|
||
class ChangelogData(TypedDict): | ||
version: str | ||
url: str | ||
date: str | ||
summary: str | ||
the_rest: str | ||
|
||
|
||
def extract_latest_version(changelog_content) -> ChangelogData: | ||
"""Extract the latest version section from the changelog.""" | ||
# Skip the first header line | ||
last_version_changelog = extract_first_second_level_section(changelog_content) | ||
|
||
# Find the first version section and extract the version, url and date | ||
matches = re.search(r"^## \[MultiQC v([\d.]+)\]\((.*?)\) - ([\d-]+)", last_version_changelog) | ||
if not matches: | ||
raise ValueError("Could not find version information in changelog") | ||
version, url, date = matches.groups() | ||
|
||
# Remove the first line | ||
last_version_changelog = "\n".join(last_version_changelog.splitlines()[1:]).strip() | ||
# Get data until the third-level header | ||
next_header_index = last_version_changelog.find("###") | ||
if next_header_index == -1: | ||
raise ValueError("Could not find next header in changelog") | ||
summary = last_version_changelog[:next_header_index].strip() | ||
the_rest = last_version_changelog[next_header_index:].strip() | ||
|
||
return {"version": version, "date": date, "url": url, "summary": summary, "the_rest": the_rest} | ||
|
||
|
||
# Read CHANGELOG.md | ||
changelog_path = Path("CHANGELOG.md") | ||
if not changelog_path.exists(): | ||
raise FileNotFoundError("CHANGELOG.md not found") | ||
|
||
# Create seqeralabs-docs directory if it doesn't exist | ||
docs_dir = Path("seqeralabs-docs") | ||
# Clone seqeralabs-docs repo if it doesn't exist | ||
if not docs_dir.exists(): | ||
print("Cloning seqeralabs-docs repository...") | ||
repo_url = "https://github.com/seqeralabs/docs.git" | ||
try: | ||
subprocess.run(["git", "clone", repo_url, str(docs_dir)], check=True) | ||
except subprocess.CalledProcessError as e: | ||
raise RuntimeError(f"Failed to clone repository: {e}") | ||
|
||
# Extract latest version | ||
with open(changelog_path) as f: | ||
changelog_data: ChangelogData = extract_latest_version(f.read()) | ||
|
||
# Create output directory | ||
output_dir = docs_dir / "changelog" / "multiqc" | ||
output_dir.mkdir(parents=True, exist_ok=True) | ||
|
||
# Create output file | ||
mdx_content: str = f"""--- | ||
title: MultiQC v{changelog_data['version']} | ||
date: {changelog_data['date']} | ||
tags: [multiqc] | ||
--- | ||
{changelog_data['summary']} | ||
{{/* truncate */}} | ||
{changelog_data['the_rest']} | ||
""" | ||
with open(output_path := output_dir / f"v{changelog_data['version']}.mdx", "w") as f: | ||
f.write(mdx_content) | ||
|
||
# Print version for GitHub Actions | ||
print(f"::set-output name=version::{changelog_data['version']}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Push changelog to Seqera Docs | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Clone seqeralabs/docs | ||
run: | | ||
git clone https://github.com/seqeralabs/docs.git seqeralabs-docs | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Convert changelog | ||
id: convert | ||
run: python ${GITHUB_WORKSPACE}/.github/workflows/seqera_docs_changelog.py | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.SEQERALABS_DOCS }} | ||
path: seqeralabs-docs | ||
commit-message: "Changelog: MultiQC ${{ steps.convert.outputs.version }}" | ||
title: "Changelog: MultiQC ${{ steps.convert.outputs.version }}" | ||
body: | | ||
This PR adds the changelog for MultiQC ${{ steps.convert.outputs.version }} to the Seqera documentation. | ||
This is an automated PR created from the MultiQC repository. | ||
branch: changelog-multiqc-${{ steps.convert.outputs.version }} | ||
base: master | ||
delete-branch: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
title: Haplocheck | ||
displayed_sidebar: multiqcSidebar | ||
description: > | ||
Haplocheck detects in-sample contamination in mtDNA or WGS sequencing studies by analyzing the mitchondrial content | ||
--- | ||
|
||
<!-- | ||
~~~~~ DO NOT EDIT ~~~~~ | ||
This file is autogenerated from the MultiQC module python docstring. | ||
Do not edit the markdown, it will be overwritten. | ||
File path for the source of this content: multiqc/modules/haplocheck/haplocheck.py | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
--> | ||
|
||
:::note | ||
Haplocheck detects in-sample contamination in mtDNA or WGS sequencing studies by analyzing the mitchondrial content | ||
|
||
[https://github.com/genepi/haplocheck/](https://github.com/genepi/haplocheck/) | ||
::: | ||
|
||
### File search patterns | ||
|
||
```yaml | ||
haplocheck: | ||
contents: "\"Sample\"\t\"Contamination Status\"\t\"Contamination Level\"\t\"Distance\"\ | ||
\t\"Sample Coverage\"" | ||
num_lines: 10 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.