diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b2dbd2f..23cc46f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 @@ -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 diff --git a/magma_smaht/commands/create_meta_workflow_run.py b/magma_smaht/commands/create_meta_workflow_run.py index a6fc59b..c96d6d9 100644 --- a/magma_smaht/commands/create_meta_workflow_run.py +++ b/magma_smaht/commands/create_meta_workflow_run.py @@ -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 @@ -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( diff --git a/magma_smaht/create_metawfr.py b/magma_smaht/create_metawfr.py index f6f806f..d1523f9 100644 --- a/magma_smaht/create_metawfr.py +++ b/magma_smaht/create_metawfr.py @@ -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" @@ -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 ################################################ diff --git a/pyproject.toml b/pyproject.toml index ca2c56e..b6fd848 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 ", "Doug Rioux", "Soo Lee", "CGAP team"] license = "MIT"