Skip to content

Commit af7e91d

Browse files
authored
fix: Add index checks for BAM and reference inputs (#4693)
1 parent 744b021 commit af7e91d

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

bio/alignoth/meta.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ description: |
66
url: https://github.com/alignoth/alignoth
77
input:
88
- bam: Path to indexed BAM file
9+
- bam_idx: Path to BAM index file
910
- reference: Path to indexed reference FASTA file
11+
- reference_idx: Path to index of reference FASTA file
1012
- vcf: Path to indexed VCF file (Optional)
11-
- idx: Path to index of VCF file (required when VCF is used)
13+
- vcf_idx: Path to index of VCF file (required when VCF is used)
1214
- bed: Path to BED file (Optional)
1315
output: "HTML, JSON or directory path"
1416
authors:

bio/alignoth/test/Snakefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
rule alignoth_json:
22
input:
33
bam="NA12878.bam",
4+
bam_idx="NA12878.bam.bai",
45
reference="ref.fa",
6+
reference_idx="ref.fa.fai",
57
vcf="1257A.vcf.gz",
6-
idx="1257A.vcf.gz.csi"
8+
vcf_idx="1257A.vcf.gz.csi"
79
output:
810
"out/json_plot.vl.json"
911
params:
@@ -16,9 +18,11 @@ rule alignoth_json:
1618
rule alignoth_html:
1719
input:
1820
bam="NA12878.bam",
21+
bam_idx="NA12878.bam.bai",
1922
reference="ref.fa",
23+
reference_idx="ref.fa.fai",
2024
vcf="1257A.vcf.gz",
21-
idx="1257A.vcf.gz.csi"
25+
vcf_idx="1257A.vcf.gz.csi"
2226
output:
2327
"out/plot.html"
2428
params:
@@ -31,9 +35,11 @@ rule alignoth_html:
3135
rule alignoth_output_dir:
3236
input:
3337
bam="NA12878.bam",
38+
bam_idx="NA12878.bam.bai",
3439
reference="ref.fa",
40+
reference_idx="ref.fa.fai",
3541
vcf="1257A.vcf.gz",
36-
idx="1257A.vcf.gz.csi"
42+
vcf_idx="1257A.vcf.gz.csi"
3743
output:
3844
directory("output-dir/")
3945
params:

bio/alignoth/wrapper.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,25 @@
1313

1414
# BAM input
1515
if snakemake.input.get("bam", ""):
16-
cmd.append(f"-b {snakemake.input.bam}")
16+
if snakemake.input.get("bam_idx", ""):
17+
cmd.append(f"-b {snakemake.input.bam}")
18+
else:
19+
raise ValueError("BAM input given without bai index")
1720
else:
1821
raise ValueError("BAM input required")
1922

2023
# Reference
2124
if snakemake.input.get("reference", ""):
22-
cmd.append(f"-r {snakemake.input.reference}")
25+
if snakemake.input.get("reference_idx", ""):
26+
cmd.append(f"-r {snakemake.input.reference}")
27+
else:
28+
raise ValueError("Reference input given without fai index")
2329
else:
2430
raise ValueError("Reference input required")
2531

2632
# Optional VCF with required csi/tbi index
2733
if snakemake.input.get("vcf", ""):
28-
if snakemake.input.get("idx", ""):
34+
if snakemake.input.get("vcf_idx", ""):
2935
cmd.append(f"-v {snakemake.input.vcf}")
3036
else:
3137
raise ValueError("VCF input given without csi/tbi index")

0 commit comments

Comments
 (0)