# Changelog


## 1.0.3 (2025-02-17)

* Fix issue: for KeyError DP when parsing VCF files with no DP INFO field (viral recon moves DP to FORMAT field)
* Fix issue: ValueError: cannot convert float NaN to integer when writing Excel report with Pandas 3.0
* Fix issue: handles object or string dtypes across all Python versions and pandas versions in simplify_snpsift function
* Fix issue: Force bold header for ALL sheets with Pandas 3.0

## 1.0.2 (2023-12-06)

* All VCF source tool names are converted to lowercase

## 1.0.1 (2023-11-28)

* Fix issue with PyPI installation

## 1.0.0 (2023-05-19)

* Added support for [Bcftools][] and [Clair3][] VCFs
* Added support for getting depth info from BAM files with [pysam][]
* Ct column no longer added to Stats/QC sheet if no Ct info provided
* Added [ruff][] for linting, replacing [flake8][]
* Fixed issue with not all [Nextclade][] columns being included in Excel report
* Migrated to `pyproject.toml` from `setup.py`; removed files associated with legacy `setup.py` approach
* Migrated to Markdown from RST for README and CHANGELOG
* Removed `docs/` directory
* Added issue template forms
* Updated GitHub Actions CI workflow

## 0.6.2 (2022-03-18)

Fixes sample name extraction from [nf-core/viralrecon][] [Medaka][] VCF
filename with ".merged" to get sample name that matches [SnpSift][] filename
extracted sample name.

## 0.6.1 (2022-02-01)

* Added more checks for Medaka VCFs from low coverage samples which may produce ValueError and ZeroDivisionError errors

## 0.6.0 (2022-01-05)

* Add support for reading annotated Medaka VCF files (`medaka_variant` VCF annotated with `medaka tools annotate`)
* Changed mutation string format to `{gene}:{AA change} ({NT change}{extra})` if there is an AA change
* Added low coverage filtering of variants for Medaka VCF
* "Variants Summary" table now sorted by nucleotide position

## 0.5.3 (2021-11-09)

* Fixed shorter consensus sequences not being written to report
* Improve nf-virontus VCF compatibility

## 0.5.2 (2021-11-08)

Fixes and changes from PR [#15](https://github.com/peterk87/xlavir/issues/15)

### Fixes

* low coverage coordinate output off by one (`xlavir.tools.mosdepth.get_interval_coords_bed`)
* error on no Pangolin reports found (e.g. non-SARS-CoV-2 report) (`xlavir.tools.pangolin.get_info`)
* user QC thresholds not being used (`xlavir.xlavir.run`)
* not showing all QC fail comments (`xlavir.qc.create_qc_stats_dataframe`)
* consensus sequences being too long for Excel cell character limit (32,767 characters); longer sequences are chunked
  into 80 character segments with one segment per line in consensus sheet  (`xlavir.tools.consensus.read_fasta`)

### Changes

* Ignore and skip unsupported VCFs instead of throwing NotImplementedError (`xlavir.tools.variants.get_info`)
* In consensus sheet, only add QC comments on FASTA header rows if necessary (`xlavir.io.xl.add_comments`)

## 0.5.1 (2021-08-04)

* Fixed issue ([#12](https://github.com/peterk87/xlavir/issues/12)) where iVar ref allele depth corresponds to depth of
  base before deletion. For indels, ref allele depth is taken from the total depth minus the alt allele depth.
* Fixed issue ([#14](https://github.com/peterk87/xlavir/issues/14)) where the total number of reads
  from `samtools flagstat` may not be the true number of reads. The unmapped reads may be excluded from the BAM file so
  the `samtools flagstat` total number of reads may be equal to the number of mapped reads. There is now a search for
  fastp JSON files to get the true total number of reads.

## 0.5.0 (2021-07-30)

* Added support for Nanopolish VCF parsing as generated by the ARTIC pipeline
* Added deduplication of VCF and SnpSift entries since the ARTIC pipeline may produce VCF files with duplicate variant
  calls due to overlap between amplicons.
* Added VCF and SnpSift test data for CLI test to generate Excel report.

## 0.4.3 (2021-07-29)

* Fix an issue where single base positions are being reported as 0-based when all other ranges are 1-based for reporting
  of low/no coverage regions from Mosdepth per-base BED files ([#10](https://github.com/peterk87/xlavir/pull/10)).

## 0.4.2 (2021-05-21)

* Add support for nf-core/viralrecon version 2.0 (requires Mosdepth `bed.gz` files be output; needs
  custom `modules.config` like [this one](https://gist.github.com/peterk87/495621349c1161d12047c1c8f97935af))
* [Nextclade CLI](https://github.com/nextstrain/nextclade/blob/master/packages/cli/README.md) per sample results parsed
  into sheet showing useful info like Nextstrain clade, # of mutations, # of PCR primer changes
* Added check that input directory exists and is a directory
* Added sheet with xlavir info
* Added Gene, Variant Effect, Variant Impact, Amino Acid Change to Variant Summary table

## 0.4.1 (2021-05-14)

* Add reference sequence length to QC stats table. Get ref seq length from max mosdepth per base BED coverage value.
* Add more conditional formatting
* Fix `execution_report.html` finding
* Fix version printing; add to help
* Add epilog with usage info

## 0.4.0 (2021-04-23)

* Adds "Variants Summary" sheet summarizing variant information across all samples
* Adds comments to AF values in "Variant Matrix" sheet
* Fixes width/height of cell comments to be based on length of comment text

## 0.3.0 (2021-04-23)

* Adds support for adding Ct values from a Ct values table (tab-delimited, CSV, ODS, XLSX format) into an xlavir report.

## 0.2.4 (2021-04-19)

* Fixes issue with SnpSift table file parsing and variable naming in variants.py (#4, #5)

## 0.2.3 (2021-04-19)

* Fixes issue with SnpSift table file parsing. Adds check to see if SnpSift column is dtype object/str before using .str  Series methods (#4)

## 0.2.2 (2021-03-30)

* Fixes issue with SnpEff/SnpSift AA change parsing.

## 0.2.1 (2021-03-29)

* Fix division by zero error due to variants with DP values of 0

## 0.2.0 (2021-03-04)

* Added header comments with descriptions of field content
* Added comment to Variant Matrix sheet A1 cell describing what is shown in the matrix
* Added highlighting of samples failing QC in other sheets
* Fixed image scaling by determining image size with imageio
* Added [Medaka]/[Longshot] VCF parsing

## 0.1.1 (2021-02-16)

* Collect sample results from a [nf-core/viralrecon] or [peterk87/nf-virontus] into an Excel report
  * [Samtools] read mapping stats (`flagstat`)
  * [Mosdepth] read mapping coverage information
  * Variant calling information ([SnpEff] and [SnpSift] results, VCF file information)
  * Consensus sequences
* [iVar] VCF parsing
* QA/QC of sample analysis results (basic PASS/FAIL based on minimum genome coverage and depth)
* Nextflow workflow execution information
* Prepend worksheets from other Excel documents into the report (e.g. cover page/sheet, sample sheet, lab results)
* Add custom images into worksheets with custom names and descriptions (e.g. phylogenetic tree figure PNG)

[nf-core/viralrecon]: https://github.com/nf-core/viralrecon
[peterk87/nf-virontus]: https://github.com/peterk87/nf-virontus/
[Bcftools]: https://www.htslib.org/doc/bcftools.html
[Samtools]: https://samtools.github.io/
[SnpEff]: https://pcingola.github.io/SnpEff/se_introduction/
[SnpSift]: https://pcingola.github.io/SnpEff/ss_introduction/
[Mosdepth]: https://github.com/brentp/mosdepth
[Medaka]: https://github.com/nanoporetech/medaka
[Longshot]: https://github.com/pjedge/longshot
[iVar]: https://andersen-lab.github.io/ivar/html/manualpage.html
[Clair3]: https://github.com/HKU-BAL/Clair3
[pysam]: https://pysam.readthedocs.io/en/latest/
[ruff]: https://github.com/charliermarsh/ruff
[flake8]: https://flake8.pycqa.org/en/latest/
[Nextclade]: https://clades.nextstrain.org/
