From 0ee4444dc261f39c3cf6a335710daba209f548f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20A=2E=20Sch=C3=A4fer?= Date: Wed, 19 Jun 2024 22:18:04 -0500 Subject: [PATCH] Rule error hlatyping (#27) * Wrong indentation in HLAtyping caused error when providing no normal sample (NoneType was being iterated * Fixed missing input in get_reads_hlatyping_PE rule (tmp folder) that caused error when using paired-end reads * added else case in get_input_hlatyping_PE rule for input reads when preprocessing is deactivated --- CHANGELOG.md | 8 ++++++++ workflow/rules/common.smk | 24 ++++++++++++++++-------- workflow/rules/hlatyping.smk | 3 ++- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 397d943..3f9196c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Prioritization of neoantigens is now done separately for each variant type (speeds up the process) - NMD information (e.g., escape rule,...) is now also calculated for all variants +## [0.2.5] - 2024-06-19 + +### Fix + +- Wrong indentation in HLAtyping caused error when providing no normal sample (NoneType was being iterated) +- Fixed missing input in get_reads_hlatyping_PE rule (tmp folder) that caused error when using paired-end reads +- Added else case in get_input_hlatyping function (rule get_reads_hlatyping_PE) for input reads when preproc is deactivated + ## [0.2.4] - 2024-05-19 ### Fix diff --git a/workflow/rules/common.smk b/workflow/rules/common.smk index 2cae676..75ec9a5 100644 --- a/workflow/rules/common.smk +++ b/workflow/rules/common.smk @@ -187,6 +187,13 @@ def get_input_hlatyping_PE(wildcards): pair=["R1","R2"]) ) ) + else: + return dict( + zip( + ["fwd", "rev"], + config["data"][f"{wildcards.seqtype}"][wildcards.group] + ) + ) def aggregate_mhcI_SE(wildcards): @@ -214,17 +221,18 @@ def get_predicted_mhcI_alleles(wildcards): if "DNA" in config['hlatyping']['MHC-I_mode']: if config['data']['dnaseq'] is not None: for key in config['data']['dnaseq'].keys(): - + + # exclude normal samples (if specified) if config['data']['normal'] is not None: - if key in config['data']['normal']: + normal = config['data']['normal'].split(' ') + if key in normal: continue - if key not in config['data']['normal']: - values += expand("results/{sample}/hla/mhc-I/genotyping/{group}_{nartype}_{readtype}.tsv", - sample = wildcards.sample, - group = key, - nartype = "DNA", - readtype = config['data']['dnaseq_readtype']) # add either SE or PE + values += expand("results/{sample}/hla/mhc-I/genotyping/{group}_{nartype}_{readtype}.tsv", + sample = wildcards.sample, + group = key, + nartype = "DNA", + readtype = config['data']['dnaseq_readtype']) # add either SE or PE else: # if no dnaseq data is specified, but mode is DNA or BOTH, then ignore print('dnaseq data has not been specified in the config file, but specified mode for hla genotyping in config file is DNA or BOTH -- will be ignored') diff --git a/workflow/rules/hlatyping.smk b/workflow/rules/hlatyping.smk index dab7b9d..1b123f5 100644 --- a/workflow/rules/hlatyping.smk +++ b/workflow/rules/hlatyping.smk @@ -56,7 +56,8 @@ rule get_reads_hlatyping_SE: rule get_reads_hlatyping_PE: input: - unpack(get_input_hlatyping_PE) + unpack(get_input_hlatyping_PE), + tmp="tmp/" output: fwd="results/{sample}/hla/reads/{group}_{nartype}_PE_R1.fq", rev="results/{sample}/hla/reads/{group}_{nartype}_PE_R2.fq"