Changes in 1.10.1 (2021-11-08)
+ Fix missing colnames in subcluster information when using the Leiden method (used downstream by add_to_seurat).
+ Fix "plot_per_group" to handle infercnv objects with NULL clustering information (mainly to be able to plot using existing results but changing the annotations).

Changes in 1.8.1 (2021-08-16)
+ Fix name generation error for step 15.
+ Handle annotation names as strings even if they look like numbers.

Changes in version 1.7.2 (2021-05-05)
+ New dependencies : RANN, leiden, phyclust
+ Added new partition method for subclustering that uses the Leiden algorithm based on a K-nn adjacency matrix.
+ Changed the default subclustering method to leiden which is much faster than the random trees method.
+ Split Bayesian filtering step in two steps, one that runs the model, and one that applies the filter threshold. This allows updating the threshold without having to rerun the whole model.
+ Fix what groupings of references the subclustering is done on.
+ Updated expectations of the internally stored clustering information when plotting references to allow for results obtained with version between ~1.3 and this one to be plotted.
+ Fix add_to_seurat method to work when no seurat object is provided after the reordering fix.
+ Fix the random trees subclustering applying a different method of centering to the data between the hclust stored in infercnv_obj@tumors_subclusters$hc and the splits in infercnv_obj@tumors_subclusters$subclusters.
+ Make denoising step figure only be generated if plot_steps is true. (it is identical to final figure that is plotted based on a different option, making it redundant)

Changes in version 1.5.3 (2020-10-23)
+ Add check that detectCores() doesn't return NA before comparing. In case it does, just use the value provided as an option directly.
Changes in version 1.5.2 (2020-10-23)
+ Added reordering of cells in metadata exported to a seurat object so that it always matches, in case the cells are not sorted in the same order in the data provided to infercnv and in seurat.
Changes in version 1.5.1 (2020-10-06)
+ Fix to reload in cases where comparing NULL/NA.
+ Fixed issue in denoising when trying to reload results from step 18 or 19.
+ Fixed MCMC Diagnostic plots by adding diagnostic generation.
+ Update included data objects to contain additional option slot, and prevent common name collisions.
+ Fully rename data objects and name of the vars they provide.
+ Fix reference plotting not having access to the actual subclustering information but that of the previous provided data object (that was renamed to avoid name collision by mistake like this one).
+ Added checks in add_to_seurat methods that there are gains/losses found when taking the top hits.
+ Added check that output to write in add_to_seurat top regions is not null and output an empty file without erroring if it is.
+ Change to remove genes in "chr_exclude" from counts before doing the read level filtering of cells.
+ Added minimum read count requirement per cell of 1 after removal of "chr_exclude" genes so that there are no divisions by 0 when normalizing.
+ Changed default min_max_counts_per_cell to select cells with at least 100 counts by default.
+ Fix to plotting for HMM coloring of heatmap when the full range of values are not present.
+ Fix to plotting when no reference groups are used to not produce warnings.

Changes in version 1.3.6 (2020-03-20)
+ Fix a read.table() call who's behavior was changed by the latest R base devel changes.
Changes in version 1.3.5 (2020-03-02)
+ Fix saving file name for preliminary object.
+ Added an option to plot_cnv(), plot_chr_scale, that allows to plot chromosomes proportionally to their full size. Either a list of chromosomes sizes is provided, or the last gene stop position + 10k bp is assumed. Gene width is proportional to the area in the chromosomes they "cover" (midpoints between genes). This option is slower than the default as rasterization can not be applied when drawing the heatmap.
Changes in verion 1.3.4 (2020-02-18)
+ Added options to save rds results after each step (save_rds) or final results (save_final_rds), with default TRUE.
+ Fix size of pdf output settings to use the given width and height values instead of the "USr" format.
+ Fixes in plot_cnv() when using observation groups with 1 or 2 cells.
+ Fix checks in plot_cnv() of references for when subclusters are not defined in the object.
+ Fix (sub)cluster definition when an annotation only has 1 cell (although this should probably be avoided).
Changes in version 1.3.3 (2020-02-07)
+ Large speed improvements in plot_cnv() that are more significant the bigger the matrix size.
+ plot_cnv() now uses clustering information stored in the infercnv object for the references instead of rerunning the clustering every time.
+ Fix assumption that length(class(obj)) == 1, in this case for matrix objects for R 2020-01-28 update.
+ Made color.palette an exported function so that it can be used for the "custom_color_pal" option.
+ Updated some logging to be more accurate.
Changes in version 1.3.2 (2019-12-06)
+ Added an new option "custom_color_pal" to plot_cnv() so a user can provide their choice of colors for the heatmap.
Changes in version 1.2.2 (2019-12-06)
+ Fixed check of how HMM results are reported by so that add_to_seurat works when HMM_report_by is "cell" but HMM analysis_mode was "subclusters".
+ Fix check of HMM_report_by setting in add_to_seurat when the option was not specified.
Changes in version 1.2.1 (2019-11-14)
+ Fix _R_CHECK_LENGTH_1_LOGIC2_ related error because an argument was checked before matching to it's list of potential arguments.
+ Fix text outputs for CNV reports when running with report_by="cell".
+ Fix add_to_seurat method to handle CNVs reported by cells in HMM predictions.
+ Fix how options used for a run are stored in the object and compared when trying to reload previous results so that it handles arguments given as variables in the call to run(). This also fixes the command-line script to run infercnv.

Changes in version 1.1.4 (2019-10-29)
+ Fix reading of input annotations when some are only digits to be properly read as characters.
+ Added checks that HMM_report_by option is compatible with analysis_mode option. If not, change it automatically.
+ Fix reading of bayesian filtered HMM results in add_to_seurat after previous version changes to keep CNV ids and states scale.
Changes in version 1.1.3 (2019-09-16)
+ Fix to reload checks on HMM steps.
+ Added new smoothing method, 'coordinates", that smooths the per cell data using a window based on a base pairs distance (around 10.000.000 seems to be a good start for the window size) to the current gene. As the hspike does not model gene distances/positions on a chromosome at this time, the HMM i6 mode is not compatible with this smoothing method and an error will be returned if both try to be used together.
+ Added a bp distance tolerance to "merge" top CNVs that are actually the same CNV in different subclusters in add_to_seurat method.
+ Removed the top any type of CNV field, as it is redundant to top loss and top dupli.
+ Added text output of identified top CNVs as they the base pair tolerance aggregates some compared to the original HMM output.
+ Added an argument "up_to_step" to stop infercnv::run() after a given step.
+ Fix contents of @options field in infercnv_obj to store non default run time arguments in the same form as object creation arguments.
+ Update so that HMM predictions outputs have the analysis_mode in their name and do not get overwritten when using different modes. Can also know which pairs of file to reload together now.
+ Update add_to_seurat so that it checks what analysis_mode was used in the run based on the @options field to reload the matching HMM predictions or Bayesian Network filtered predictions.
+ Updated "subclustering" method for sample mode so that @tumor_subclusters$subclusters indices have the cell names attached to be able to map back in add_to_seurat.
+ Allow HMM steps to be resumed if needed even if steps 20/21 are done.
Changes in version 1.1.2 (2019-07-08)
+ Added method to write table of wide array of predicted features from HMM results to file or add them as meta.data to a Seurat object if one is provided.
+ Overhaul of save/reload system to store non default arguments and keep track of relevant options at each step when trying to reload backups. Also check for input counts matrix identity with reloaded one (hash at object creation time).
+ Added linking of image() option useRaster to run() and plot_cnv() to be able to enable by default, speeding up plotting significantly.
Changes in version 1.1.1 (2019-05-20)
+ Added method to sample an infercnv object to a given number of cells, or at a given frequency, per annotation group. This is to make it easy to plot figures where all annotations groups have the same overall height, as well as downsample very large datasets that would otherwise take too long to plot (while still running the analysis on the full data)
+ Added method to plot each annotation group to a different figure and combine with sampling. Mostly intended to split data for larger datasets.
+ Added support for output_format option within run() to link to plot_cnv() to support only writting text outputs during the analysis.
Changes in version 1.0.4 (2019-09-16)
+ Fix check that contig to cluster by was found when specified.
+ Added support to plot_cnv for cell groups with exactly 2 cells.
+ Fix which input file type is checked.
+ Made it so that plot_cnv recalculates clustering automatically if non null ref_contig argument is provided.
+ Fix for plot_cnv() when providing multiple ref_contigs and cluster_by_group is False.
+ Fix only 1/n genes being taken into account when using n ref_contig in plot_cnv.
+ Fix error in file creation when using multiple ref_contig and cluster_by_groups=FALSE in plot_cnv.
+ Bayesian filtering now preserves CNV ids in outputs
Changes in version 1.0.3 (2019-07-05)
+ Fix missing dendrograms in text output when drawing figures.
+ Fix path to save object to when splitting references.
+ Fix file name creation when using num_ref_groups option.
+ Fix reference cells indices returned from method that splits references in num_ref_groups when references are not sorted and at the beginning of the matrix.
+ Fix to support of data.frame as input type for counts matrix.
Changes in version 1.0.2 (2019-05-21)
+ Reduce peak memory usage.
+ Fix to subclusters definition when using a sparse matrix and a non random trees method with no references.
Changes in version 1.0.1 (2019-05-20)
+ Improved when the clustering is defined for groups when running in sample mode.
+ Fixed support for NA to be understood as an output_format value to plot_cnv() in case a user only wants to generate the text outputs and not the plot.
+ Fix ordering of cells and color bars on the heatmap and text outputs when cells are not sorted in the same order in the input matrix and the annotation file.
+ Fix to (sub)cluster definition when a group only has 1 cell.
+ Fix plot_cnv() to handle observations groups with only 1 cell (that can't be hierarchically clustered), a single reference group when no references are not clusterd, and a single reference group with a single cell.
Changes in version 1.0.0 (2019-05-02)
+ Released as a BioConductor packages
Changes in version 0.99.8 (2019-04-20)
+ Fix missing labels on heatmap due to change in how axis() handles overlaps.
+ Improve auto thresholding of heatmap colors to still work when using stronger denoise settings.
+ Updated some examples to use tempfile() for output.
+ Fix duplicate piece of code that produced an error when using plot_steps.
Changes in version 0.99.0 (2019-03-15)
+ Submitted to Bioconductor
