Skip to content

Commit

Permalink
fix: treat ref and allele columns as non-VCF compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
boasvdp committed Jan 26, 2024
1 parent cd94fed commit 0e6a956
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/presets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mycobacterium_tuberculosis:
single_copy_bed: files/mtb/coll_positions.bed
reference_genbank: /mnt/db/juno/variant-typing/mtb/NC_000962.3.gbk
resistance_variants_csv: /mnt/db/juno/variant-typing/mtb/reslist.csv
resistance_variants_columns: gene,drug,RIVM,TP,FP,confidence,variant_common_name
resistance_variants_columns: ref_nt,alt_nt,gene,drug,RIVM,TP,FP,confidence,variant_common_name
resistance_variants_ab_column: drug
other:
single_copy_bed: null
Expand Down
7 changes: 2 additions & 5 deletions workflow/rules/mtb_prepare_files.smk
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ rule prepare_ab_table:
),
params:
POS="genomepos",
REF="ref",
ALT="allele",
metadata=lambda wildcards: SAMPLES[wildcards.sample][
"resistance_variants_columns"
],
Expand All @@ -199,10 +197,9 @@ rule prepare_ab_table:
python workflow/scripts/convert_ab_table.py \
--force-chrom NC_000962.3 \
--POS {params.POS} \
--REF {params.REF} \
--ALT {params.ALT} \
--other {params.metadata:q} \
{input} {output.uncompressed} 2>&1>{log}
{input} \
{output.uncompressed} 2>&1>{log}
"""


Expand Down
7 changes: 4 additions & 3 deletions workflow/scripts/convert_ab_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
type=str,
)
parser.add_argument("--POS", help="Column to parse genome positions", type=str)
parser.add_argument("--REF", help="Column to parse reference allele", type=str)
parser.add_argument("--ALT", help="Column to parse alternative allele", type=str)
# parser.add_argument("--REF", help="Column to parse reference allele", type=str)
# parser.add_argument("--ALT", help="Column to parse alternative allele", type=str)
parser.add_argument(
"--other",
help="""
Expand All @@ -37,7 +37,8 @@

metadata_cols = args.other.split(",")

ordered_columns = [args.POS] + [args.REF] + [args.ALT] + metadata_cols
# ordered_columns = [args.POS] + [args.REF] + [args.ALT] + metadata_cols
ordered_columns = [args.POS] + metadata_cols

for col in ordered_columns:
assert col in df_in.columns, f"Column {col} cannot be found in {args.input}"
Expand Down

0 comments on commit 0e6a956

Please sign in to comment.