Skip to content

Commit

Permalink
Ultra-long BAM QC (ONT) and long-read BAM QC (Pacbio) MetaWorkflowRuns (
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-veit authored Jul 23, 2024
1 parent a97465e commit 2cc9fdd
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Change Log
==========

3.5.0
=====
* Add commands to create ultra-long BAM QC (ONT) and long-read BAM QC (Pacbio) MetaWorkflowRuns


3.4.1
=====
* Update dependencies
Expand All @@ -12,6 +17,7 @@ Change Log
=====
* Add set_property function to wrangler utils for SMaHT


3.3.0
=====
* Restructure CLI to create MetaWorkflowRuns and execute wrangler functions
Expand Down
34 changes: 34 additions & 0 deletions magma_smaht/commands/create_meta_workflow_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
mwfr_cram_to_fastq_paired_end,
mwfr_bamqc_short_read,
mwfr_ubam_qc_long_read,
mwfr_ultra_long_bamqc,
mwfr_long_read_bamqc
)
from magma_smaht.utils import get_auth_key

Expand Down Expand Up @@ -151,6 +153,38 @@ def qc_short_read_bam(file_accession, auth_env):
mwfr_bamqc_short_read(file_accession, smaht_key)


@cli.command()
@click.help_option("--help", "-h")
@click.option("-f", "--file-accession", required=True, type=str, help="File accession")
@click.option(
"-e",
"--auth-env",
required=True,
type=str,
help="Name of environment in smaht-keys file",
)
def qc_ultra_long_bam(file_accession, auth_env):
"""QC MWFR for aligned, ultra-long BAMs (ONT)"""
smaht_key = get_auth_key(auth_env)
mwfr_ultra_long_bamqc(file_accession, smaht_key)


@cli.command()
@click.help_option("--help", "-h")
@click.option("-f", "--file-accession", required=True, type=str, help="File accession")
@click.option(
"-e",
"--auth-env",
required=True,
type=str,
help="Name of environment in smaht-keys file",
)
def qc_long_read_bam(file_accession, auth_env):
"""QC MWFR for aligned, long-read BAMs (PacBio)"""
smaht_key = get_auth_key(auth_env)
mwfr_long_read_bamqc(file_accession, smaht_key)


@cli.command()
@click.help_option("--help", "-h")
@click.option(
Expand Down
28 changes: 28 additions & 0 deletions magma_smaht/create_metawfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
MWF_NAME_FASTQ_LONG_READ = "long_reads_FASTQ_quality_metrics"
MWF_NAME_CRAM_TO_FASTQ_PAIRED_END = "cram_to_fastq_paired-end"
MWF_NAME_BAMQC_SHORT_READ = "paired-end_short_reads_BAM_quality_metrics_GRCh38"
MWF_NAME_ULTRA_LONG_BAMQC = "ultra-long_reads_BAM_quality_metrics_GRCh38"
MWF_NAME_LONG_READ_BAMQC = "long_reads_BAM_quality_metrics_GRCh38"

# Input argument names
INPUT_FILES_R1_FASTQ_GZ = "input_files_r1_fastq_gz"
Expand Down Expand Up @@ -269,6 +271,32 @@ def mwfr_bamqc_short_read(file_accession, smaht_key):
create_and_post_mwfr(mwf["uuid"], None, INPUT_FILES_BAM, mwfr_input, smaht_key)


def mwfr_ultra_long_bamqc(file_accession, smaht_key):
mwf = get_latest_mwf(MWF_NAME_ULTRA_LONG_BAMQC, smaht_key)
print(f"Using MetaWorkflow {mwf[ACCESSION]} ({mwf[ALIASES][0]})")
bam_meta = get_metadata(file_accession, smaht_key)
bam = [{"file": bam_meta[UUID], "dimension": "0"}]

mwfr_input = [
get_mwfr_file_input_arg(INPUT_FILES_BAM, bam),
]

create_and_post_mwfr(mwf["uuid"], None, INPUT_FILES_BAM, mwfr_input, smaht_key)


def mwfr_long_read_bamqc(file_accession, smaht_key):
mwf = get_latest_mwf(MWF_NAME_LONG_READ_BAMQC, smaht_key)
print(f"Using MetaWorkflow {mwf[ACCESSION]} ({mwf[ALIASES][0]})")
bam_meta = get_metadata(file_accession, smaht_key)
bam = [{"file": bam_meta[UUID], "dimension": "0"}]

mwfr_input = [
get_mwfr_file_input_arg(INPUT_FILES_BAM, bam),
]

create_and_post_mwfr(mwf["uuid"], None, INPUT_FILES_BAM, mwfr_input, smaht_key)


################################################
# Helper functions
################################################
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "magma-suite"
version = "3.4.1"
version = "3.5.0"
description = "Collection of tools to manage meta-workflows automation."
authors = ["Michele Berselli <[email protected]>", "Doug Rioux", "Soo Lee", "CGAP team"]
license = "MIT"
Expand Down

0 comments on commit 2cc9fdd

Please sign in to comment.