Skip to content

1.10.0

Choose a tag to compare

@casblaauw casblaauw released this 18 Aug 12:43
· 54 commits to main since this release
934eea1

1.10.0

Features

  • crested.tl.contribution_scores now reuses computations (gradients or predictions) when calculating scores for multiple classes of one region. This should speed up both gradient and mutagenesis-based calculations. (#228)
  • crested.tl.design.in_silico_evolution and crested.tl.design.motif_insertion now take a protected_positions argument: a list of (start, end) ranges of nucleotide positions that will never be mutated or overwritten by a motif insertion, independent of no_mutation_flanks/target_len. (#227)
  • Added crested.tl.data.AnnDataWrapper, a futureproof dataloader for sequence-to-function training. (#208)
    • AnnDataWrapper mostly uses the same arguments as AnnDataModule and should be a drop-in replacement.
    • New: You can set train_splits/val_splits/test_splits to pick the values to assign as train/val/test splits, and split_column to pick the column to find these values in. That allows for easier ensemble training, where it changes which fold is the val/test constantly. By default, train_splits is inferred to be all values not included in val/test (e.g. 'fold0/1/2' when val and test are 'fold3'/'fold4')
    • AnnDataWrapper should be slightly more memory-efficient.
  • Added crested.utils.resize_region. (#234)
  • crested.pp.sort_and_filter_regions_on_specificity now uses "proportion" by default, and takes a min_score threshold parameter. (#235)
    • crested.pl.qc.sort_and_filter_cutoff is updated in conjunction to allow plotting of possible min_score values with argument min_scores. (#235)
  • Add new loss functions (crested.tl.losses.PoissonKLLoss, crested.tl.losses.GiniLoss) and fully rework crested.tl.losses.PoissonMultinomialLoss. (#223)
  • New architecture option for model training: crested.tl.zoo.legnet, inspired by human_legnet (10.1038/s41586-024-08430-9). It uses EfficientNetV2-inspired blocks to train highly performant models on small regions. (#236)

Small changes

  • crested.tl.modisco.create_pattern_tf_dict: add motif_col (default 'Motif_name') so tomtom matches can be looked up against a motif-to-TF table that uses a different motif identifier column name. (#221)
  • crested.tl.modisco.create_tf_ct_matrix: add min_total_seqlets, a whole-pattern gate that drops patterns whose seqlet count summed across all firing cell types is below the floor. (#221)
  • crested.pl.explain.contribution_scores' argument highlight_positions now highlights [start, end) rather than [start, end], in order to align with indexing and crested.tl.design's protected_positions. (#227)
  • Both AnnDataWrapper and AnnDataModule now now handle regions that could cross genome boundaries when stochastically shifted better. (#208)
  • crested.tl.zoo.utils.ConvBlock now can have separate padding for pooling and convolutions, by setting pool_padding. (#236)

Bugfixes

  • crested.pp.normalize_peaks now reads Gini scores from the peaks its top-k selection actually picked. Weights change by ~1% on average (2.8% max) on the 19-cell-type mouse cortex tutorial data, and more on sparser datasets or with a nonzero peak_threshold, so normalized .h5ad files written by earlier versions differ slightly. The returned region DataFrame now lists top peaks rather than arbitrary broad regions. (#240)
  • crested.pp.normalize_peaks now raises when a cell type ends up with no selected peaks instead of giving it an infinite weight (or a nan one, if it happens to every cell type) and writing that into .X. Reachable by raising gini_std_threshold past the point where no top peak still counts as broad, which is dataset dependent. (#240)
  • x_shift now works in conjunction with coordinates in crested.pl.explain.contribution_scores (#232)
  • crested.tl.zoo.basenji can now be built again by fixing a renamed argument in conv_block_bs. (#233)
  • crested.utils.parse_region now also doesn't break with negative coordinates. (#234)
  • Fix compatibility with AnnData>=0.13.0 including X in AnnData.layers for plotting functions. (#226)
  • Now fully drop L2 normalizers in dense_block(), conv_block(), conv_block_bs() if l2 is set to 0, instead of adding normalizer that doesn't do anything. (#236)

Tests

  • Add tests for both AnnDataLoader and AnnDataWrapper, in both TensorFlow and PyTorch. (#208)
  • Added new tests for bigwig and bed reading, predictions from negative strand regions, classes for contribution_scores, and creating and loading models from the zoo. (#233)
  • Added new tests for crested.utils.parse_region and crested.utils.resize_region (#234)
  • Added a closed-form test for crested.pp.normalize_peaks, over a matrix of broad and cell-type-specific regions whose weights are known analytically. (#240)
  • Added coverage for the routes that leave crested.pp.normalize_peaks with no peaks selected for a cell type. (#240)

Dev/poweruser features

  • Added BaseDataWrapper and BaseGenomicDataWrapper, classes that form a base for all kinds of sequence-to-function training. They handle indexes, augmentation, sequence retrieval, iteration, etc. automatically, and leave you to adjust only the parts that matter in a modular fashion. (#208)
  • SequenceLoader now doesn't re-do the deterministic augmentations on base indices again, but instead takes a list of expanded_indices (basically indices with all revcomp and/or deterministic_shift) and extracts values for those. (#208)
  • Both AnnDataModule and AnnDataLoader now have a get_config() method that returns all kind of information about the number of (batched) entries, its settings, and more. This data is automatically logged in Crested.fit(). (#208)
  • AnnDataset and AnnDataLoader are now no longer publicly imported, since they were never relevant for the end user. This keeps the clutter in crested.tl.data down a bit. (#208)