Skip to content

Commit 1ae06f8

Browse files
committed
Support CRAM in the hifitrimmer module
1 parent 0e225fb commit 1ae06f8

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

modules/nf-core/hifitrimmer/filterbam/main.nf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ process HIFITRIMMER_FILTERBAM {
2424
def args = task.ext.args ?: ''
2525
def args2 = task.ext.args2 ?: ''
2626
def suffix = args.contains('-f') ? "fastq.gz" : "fasta.gz"
27-
def input_convert = !input.name.endsWith('bam') ? "<(samtools import ${input} ${args2} -@ ${task.cpus})" : input
27+
def input_convert = input.name.endsWith('cram') ? "<(samtools view ${input} -u ${args2} -@ ${task.cpus})" :
28+
!input.name.endsWith('bam') ? "<(samtools import ${input} ${args2} -@ ${task.cpus})" : input
2829
"""
2930
hifi_trimmer filter_bam \\
3031
-t ${task.cpus} \\

modules/nf-core/hifitrimmer/filterbam/tests/main.nf.test

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,33 @@ nextflow_process {
9393
}
9494
}
9595

96+
test("hifi_trimmer filter_bam test - input cram") {
97+
98+
when {
99+
params {
100+
filter_bam_args = ""
101+
}
102+
process {
103+
"""
104+
input[0] = Channel.of(
105+
[
106+
[ id:'test_cram' ], // meta map
107+
file(params.modules_testdata_base_path + '/genomics/eukaryotes/Pipistrellus_nathusii/genome/test.cram', checkIfExists: true),
108+
file(params.modules_testdata_base_path + '/delete_me/hifitrimmer/test.bed.gz', checkIfExists: true)
109+
]
110+
)
111+
"""
112+
}
113+
}
114+
115+
then {
116+
assertAll(
117+
{ assert process.success },
118+
{ assert snapshot(process.out).match() }
119+
)
120+
}
121+
}
122+
96123
test("hifi_trimmer test - stub") {
97124

98125
options "-stub"

modules/nf-core/hifitrimmer/filterbam/tests/main.nf.test.snap

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,61 @@
109109
},
110110
"timestamp": "2026-02-24T13:46:51.777255966"
111111
},
112+
"hifi_trimmer filter_bam test - input cram": {
113+
"content": [
114+
{
115+
"0": [
116+
[
117+
{
118+
"id": "test_cram"
119+
},
120+
"test_cram.fasta.gz:md5,80f9c060bfc39f9d12a8e70c112d05cc"
121+
]
122+
],
123+
"1": [
124+
[
125+
"HIFITRIMMER_FILTERBAM",
126+
"hifi_trimmer",
127+
"2.2.0"
128+
]
129+
],
130+
"2": [
131+
[
132+
"HIFITRIMMER_FILTERBAM",
133+
"samtools",
134+
"1.23"
135+
]
136+
],
137+
"filtered": [
138+
[
139+
{
140+
"id": "test_cram"
141+
},
142+
"test_cram.fasta.gz:md5,80f9c060bfc39f9d12a8e70c112d05cc"
143+
]
144+
],
145+
"versions_hifitrimmer": [
146+
[
147+
"HIFITRIMMER_FILTERBAM",
148+
"hifi_trimmer",
149+
"2.2.0"
150+
]
151+
],
152+
"versions_samtools": [
153+
[
154+
"HIFITRIMMER_FILTERBAM",
155+
"samtools",
156+
"1.23"
157+
]
158+
]
159+
}
160+
],
161+
"meta": {
162+
"nf-test": "0.9.3",
163+
"nextflow": "25.10.2"
164+
},
165+
"timestamp": "2026-03-25T10:14:23.060029898"
166+
},
112167
"hifi_trimmer test - stub": {
113168
"content": [
114169
{

0 commit comments

Comments
 (0)