Converter Module¶
TSV to Excel conversion and formatting
File conversion module.
This module provides functionality to convert TSV files to XLSX format and append additional sheets. It now also supports producing JSON files for the HTML report.
- variantcentrifuge.converter.convert_to_excel(tsv_file, cfg)[source]¶
Convert a TSV file to XLSX format with a single “Results” sheet.
- variantcentrifuge.converter.append_tsv_as_sheet(xlsx_file, tsv_file, sheet_name='Metadata')[source]¶
Append a TSV file as a new sheet to an existing XLSX file.
This function reads the TSV file and appends it as a new sheet in the existing XLSX file. Assumes the TSV file has a header row.
- variantcentrifuge.converter.finalize_excel_file(xlsx_file, cfg)[source]¶
Apply final formatting to all sheets in xlsx_file.
Freeze the top row
Enable auto-filter
Only for the ‘Results’ sheet, generate hyperlinks from CHROM, POS, REF, ALT using cfg[“links”] (the link template dictionary).
Add “IGV Report Links” column with hyperlinks to IGV reports if available
- variantcentrifuge.converter.produce_report_json(variant_tsv, output_dir)[source]¶
Produce JSON files (variants.json and summary.json) from a TSV of variants.
The TSV file is expected to have columns including GENE, CHROM, POS, REF, ALT, IMPACT. Two JSON files are produced:
variants.json: A list of all variants with their annotations.
summary.json: Aggregated counts (num_variants, num_genes, impact_distribution).
These files are used by the HTML report generator.