Skip to content

Commit 451af59

Browse files
authored
fixed filtering SE reads (#52)
* fixed filtering SE reads
1 parent 7994711 commit 451af59

File tree

4 files changed

+41
-102
lines changed

4 files changed

+41
-102
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [0.5.x] -2023-xx-xx (unreleased)
1010

11+
1112
### Features
1213

1314
- NMD information (e.g., escape rule,...) is now also calculated for all variants
1415

16+
## [0.3.4] - 2025-04-04
17+
18+
### Fix
19+
20+
- Moved script for preparing hla input to workflow/scripts/genotyping
21+
- Added missing pipe to log file in rule hlatyping_mhcII
22+
- Added wrong input file to filtering of mhcII reads on SE
23+
1524
## [0.3.3] - 2025-04-02
1625

1726
### Fix

workflow/rules/common.smk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,17 @@ def get_all_mhcI_alleles(wildcards):
255255

256256

257257
##### MHC CLASS II #####
258+
def get_input_filter_reads_mhcII_SE(wildcards):
259+
if config["preproc"]["activate"]:
260+
return expand("results/{sample}/{seqtype}/reads/{group}_preproc.fq.gz",
261+
sample=wildcards.sample,
262+
seqtype = "dnaseq" if wildcards.nartype == "DNA" else "rnaseq",
263+
group=wildcards.group)
264+
else:
265+
seqtype = "dnaseq" if wildcards.nartype == "DNA" else "rnaseq"
266+
return config["data"][f"{seqtype}"][wildcards.group]
267+
268+
258269
def get_input_filter_reads_mhcII_PE(wildcards):
259270
seqtype = "dnaseq" if wildcards.nartype == "DNA" else "rnaseq"
260271
""" if the reads are in BAM format, we consider them as processed and forward
@@ -269,6 +280,7 @@ def get_input_filter_reads_mhcII_PE(wildcards):
269280
if config["preproc"]["activate"]:
270281
return expand("results/{sample}/{seqtype}/reads/{group}_{readpair}_preproc.fq.gz",
271282
sample=wildcards.sample,
283+
seqtype= "dnaseq" if wildcards.nartype == "DNA" else "rnaseq",
272284
group = wildcards.group,
273285
readpair=["R1", "R2"]
274286
)

workflow/rules/hlatyping_mhcII.smk

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
######### MHC-II HLA GENOTYPING ###########
22
rule filter_reads_mhcII_SE:
33
input:
4-
sample=["results/{sample}/hla/reads/{group}_{nartype}_SE.fq"],
4+
sample=get_input_filter_reads_mhcII_SE,
55
idx=multiext(
66
"resources/hla/bowtie2_index",
77
".1.bt2",
@@ -72,12 +72,29 @@ rule finalize_reads_mhcII:
7272
threads: 1
7373
shell:
7474
"""
75-
python workflow/scripts/finalize_mhcII_input.py \
75+
python workflow/scripts/genotyping/finalize_mhcII_input.py \
7676
{input} \
7777
{output.fwd} \
7878
{output.rev}
7979
"""
8080

81+
rule readcounts_mhcII:
82+
input:
83+
fwd = "results/{sample}/hla/mhc-II/reads/{group}_{nartype}_final_R1.fq",
84+
rev = "results/{sample}/hla/mhc-II/reads/{group}_{nartype}_final_R2.fq"
85+
output:
86+
"results/{sample}/hla/mhc-II/reads/{group}_{nartype}_final_counts.txt"
87+
log:
88+
"logs/{sample}/genotyping/final_readcounts_mhcII_{group}_{nartype}.log"
89+
conda:
90+
"../envs/basic.yml"
91+
threads: 1
92+
shell:
93+
"""
94+
python workflow/scripts/countreads.py \
95+
{input.fwd} {output} > {log} 2>&1 | exit 0
96+
"""
97+
8198

8299
rule hlatyping_mhcII:
83100
input:
@@ -104,7 +121,7 @@ rule hlatyping_mhcII:
104121
{input.fwd} {input.rev} \
105122
{params.split} {params.dic} \
106123
{wildcards.group}_{wildcards.nartype} \
107-
results/{wildcards.sample}/hla/mhc-II/genotyping/
124+
results/{wildcards.sample}/hla/mhc-II/genotyping/ > {log} 2>&1
108125
"""
109126

110127
rule merge_predicted_mhcII_allels:

workflow/scripts/finalize_mhcII_input.py

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)