Skip to content

Commit 2be2654

Browse files
committed
Fix 3 GUI bugs in ParameterForm
B1: Output prefix placeholder regex — \.(vcf|vcf\.gz)$ never matched .vcf.gz because vcf matched first. Reordered to \.(vcf\.gz|vcf)$ B2: applyPreset reset vcfGz and excludeIntergenic to defaults — user settings were lost when switching presets. Now preserved. B3: No guard against disabling both TSV and VCF output — analysis would produce no output files. Now prevents toggling off the last active output format. Also resets vcfGz atomically when VCF is disabled (single state update, no double-render).
1 parent 631c521 commit 2be2654

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

frontend/src/components/ParameterForm.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function Tip({ text }: { text: string }) {
2121
const handleEnter = useCallback(() => {
2222
if (iconRef.current) {
2323
const rect = iconRef.current.getBoundingClientRect();
24+
// getBoundingClientRect is viewport-relative, which is correct for position:fixed tooltips
2425
setPos({ x: rect.left + rect.width / 2, y: rect.top });
2526
}
2627
setShow(true);
@@ -221,6 +222,7 @@ export default function ParameterForm({ config, onChange, isGff, availableFeatur
221222
onChange({
222223
...DEFAULT_CONFIG,
223224
...preset.config,
225+
// Preserve user-selected files and environment settings
224226
vcfFile: config.vcfFile,
225227
fastaFile: config.fastaFile,
226228
genesFile: config.genesFile,
@@ -231,6 +233,8 @@ export default function ParameterForm({ config, onChange, isGff, availableFeatur
231233
threads: config.threads,
232234
keepOriginalInfo: config.keepOriginalInfo,
233235
translationTable: config.translationTable,
236+
excludeIntergenic: config.excludeIntergenic,
237+
vcfGz: config.vcfGz,
234238
outputDir: config.outputDir,
235239
outputPrefix: config.outputPrefix,
236240
});
@@ -517,13 +521,26 @@ export default function ParameterForm({ config, onChange, isGff, availableFeatur
517521
label="TSV output"
518522
tip="Generate a tab-separated file with annotated variants, amino acid changes, and MNV classifications."
519523
checked={config.outputTsv}
520-
onChange={(v) => update("outputTsv", v)}
524+
onChange={(v) => {
525+
// Prevent disabling both outputs — at least one must be active
526+
if (!v && !config.outputVcf) return;
527+
update("outputTsv", v);
528+
}}
521529
/>
522530
<ToggleField
523531
label="VCF output"
524532
tip="Generate a VCF file with MNV annotations in INFO fields. Compatible with downstream VCF tools."
525533
checked={config.outputVcf}
526-
onChange={(v) => update("outputVcf", v)}
534+
onChange={(v) => {
535+
// Prevent disabling both outputs — at least one must be active
536+
if (!v && !config.outputTsv) return;
537+
if (!v && config.vcfGz) {
538+
// Disable both VCF and VCF-GZ in one update
539+
onChange({ ...config, outputVcf: false, vcfGz: false });
540+
} else {
541+
update("outputVcf", v);
542+
}
543+
}}
527544
/>
528545
{config.outputVcf && (
529546
<ToggleField
@@ -588,7 +605,7 @@ export default function ParameterForm({ config, onChange, isGff, availableFeatur
588605
}
589606
placeholder={
590607
config.vcfFile
591-
? config.vcfFile.split(/[\\/]/).pop()?.replace(/\.(vcf|vcf\.gz)$/i, "") ?? "auto"
608+
? config.vcfFile.split(/[\\/]/).pop()?.replace(/\.(vcf\.gz|vcf)$/i, "") ?? "auto"
592609
: "Derived from VCF"
593610
}
594611
/>

0 commit comments

Comments
 (0)