diffbio 0.1.4__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {diffbio-0.1.4 → diffbio-0.1.5}/PKG-INFO +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/pyproject.toml +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/base_operators.py +12 -6
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/data_types.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/uncertainty.py +4 -4
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/evaluation/adapters.py +7 -7
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/_masked_gene_transformer.py +16 -20
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/alignment/profile_hmm.py +2 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/alignment/smith_waterman.py +2 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/alignment/soft_msa.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/assembly/gnn_assembly.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/assembly/metagenomic_binning.py +5 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/crispr/guide_scoring.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/_graph_utils.py +1 -7
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/admet_predictor.py +4 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/attentive_fp.py +3 -6
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/dti.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/fingerprint.py +5 -6
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/maccs_keys.py +4 -5
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/property_predictor.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/similarity.py +3 -6
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/epigenomics/chromatin_state.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/epigenomics/contextual.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/epigenomics/fno_peak_calling.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/epigenomics/peak_calling.py +6 -6
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/foundation_models/embedding_probe.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/foundation_models/foundation_model.py +6 -6
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/foundation_models/transformer_encoder.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/mapping/neural_mapper.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/metabolomics/isotope_envelope.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/metabolomics/soft_centroiding.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/metabolomics/spectral_similarity.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/molecular_dynamics/force_field.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/molecular_dynamics/integrator.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/multiomics/hic_contact.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/multiomics/multiomics_vae.py +4 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/multiomics/spatial_deconvolution.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/multiomics/spatial_gene_detection.py +1 -1
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/arcsinh_cofactor.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/differentiable_pca.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/embedding.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/learnable_normalization.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/learnable_orthogonal_projection.py +4 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/learnable_projection.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/matrix_free_pca.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/phate.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/scaling.py +4 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/soft_pca.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/umap.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/vae_normalizer.py +4 -5
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/population/ancestry_estimation.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/preprocessing/__init__.py +10 -5
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/preprocessing/adapter_removal.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/preprocessing/duplicate_filter.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/preprocessing/error_correction.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/protein/secondary_structure.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/quality_filter.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/rna_structure/rna_folding.py +3 -4
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/rnaseq/motif_discovery.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/rnaseq/splicing_psi.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/ambient_removal.py +4 -4
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/archetypes.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/batch_correction.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/cell_annotation.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/communication.py +4 -4
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/differential_distribution.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/doublet_detection.py +14 -53
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/downsampling.py +6 -11
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/enhanced_batch_correction.py +4 -4
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/grn_inference.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/imputation.py +8 -8
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/ot_trajectory.py +3 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/simulation.py +14 -34
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/sindy_grn.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/soft_clustering.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/soft_hvg.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/spatial_domains.py +4 -4
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/stochastic_gate_selector.py +6 -9
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/switch_de.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/trajectory.py +5 -4
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/velocity.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/statistical/em_quantification.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/statistical/hmm.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/statistical/nb_glm.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/variant/classifier.py +4 -4
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/variant/cnn_classifier.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/variant/cnv_segmentation.py +4 -4
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/variant/deepvariant_pileup.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/variant/pileup.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/variant/quality_recalibration.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/adapters.py +4 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/differential_expression.py +3 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/enhanced_variant_calling.py +13 -7
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/joint_preprocessing.py +4 -3
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/preprocessing.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/single_cell.py +19 -11
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/variant_calling.py +2 -2
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/anndata_source.py +1 -1
- {diffbio-0.1.4 → diffbio-0.1.5}/.gitignore +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/LICENSE +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/README.md +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/benchmarks/README.md +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/benchmarks/crossmodality/README.md +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/examples/README.md +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/configs.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/constants.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/gnn_components.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/graph_utils.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/neural_components.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/optimal_transport.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/_projections_permutahedron.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/_projections_simplex.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/_projections_transport.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/_sorting_network.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/_types.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/_utils.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/autograd_safe.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/comparison.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/elementwise.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/logical.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/normalization.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/quantile.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/selection.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/sorting.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/core/soft_ops/straight_through.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/evaluation/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/evaluation/graders.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/evaluation/problem.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/evaluation/runner.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/losses/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/losses/alignment_losses.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/losses/biological_regularization.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/losses/metric_losses.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/losses/self_supervised_losses.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/losses/singlecell_losses.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/losses/statistical_losses.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/_count_vae.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/_loss_balancing.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/_transformer_validation.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/alignment/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/alignment/scoring.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/assembly/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/crispr/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/message_passing.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/drug_discovery/primitives.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/epigenomics/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/foundation_models/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/foundation_models/adapters.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/foundation_models/contracts.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/foundation_models/experimental.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/foundation_models/frozen.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/foundation_models/precomputed.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/mapping/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/metabolomics/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/molecular_dynamics/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/molecular_dynamics/primitives.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/multiomics/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/normalization/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/population/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/protein/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/rna_structure/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/rnaseq/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/singlecell/knockdown_filter.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/statistical/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/variant/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/operators/variant/learnable_pileup.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/joint_training.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/minibatch_training.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/pipelines/perturbation.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/reductions/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/reductions/base.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/reductions/pca_reduction.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/reductions/tfidf_reduction.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/samplers/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/samplers/perturbation_sampler.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sequences/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sequences/dna.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sequences/kmer.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/_anndata_shared.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/_batch_iteration.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/_benchmark_source.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/_indexed_batch_source.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/_utils.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/anndata_interop.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/archive_ii.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/balifam.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/bam.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/bengrn_ground_truth.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/contextual_epigenomics.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/dti.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/embeddings.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/encode_peaks.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/fasta.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/immune_human.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/indexed_embeddings.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/indexed_view.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/molnet.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/multiomics.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/pancreas.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/perturbation/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/perturbation/_types.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/perturbation/_utils.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/perturbation/concat_source.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/perturbation/control_mapping.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/perturbation/experiment_config.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/perturbation/h5_metadata_cache.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/perturbation/output_space.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/perturbation/perturbation_source.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/seqfish.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/sequence_foundation.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/sources/singlecell_foundation.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/splitters/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/splitters/base.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/splitters/molecular.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/splitters/perturbation.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/splitters/random.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/splitters/sequence.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/utils/__init__.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/utils/dependency_runtime.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/utils/nn_utils.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/utils/quality.py +0 -0
- {diffbio-0.1.4 → diffbio-0.1.5}/src/diffbio/utils/training.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: diffbio
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: End-to-end differentiable bioinformatics for JAX/Flax NNX: alignment, mapping, assembly, variant calling, RNA-seq, single-cell, epigenomics, CRISPR, metabolomics, multi-omics, protein and RNA structure, molecular dynamics and drug-discovery operators composed into trainable pipelines on datarax, artifex, opifex and calibrax
|
|
5
5
|
Project-URL: Bug Tracker, https://github.com/avitai/DiffBio/issues
|
|
6
6
|
Project-URL: Documentation, https://diffbio.readthedocs.io
|
|
@@ -50,7 +50,7 @@ Requires-Dist: beartype>=0.14.1
|
|
|
50
50
|
Requires-Dist: biopython>=1.81
|
|
51
51
|
Requires-Dist: calibrax>=0.1.5
|
|
52
52
|
Requires-Dist: chex>=0.1.7
|
|
53
|
-
Requires-Dist: datarax>=0.1.
|
|
53
|
+
Requires-Dist: datarax>=0.1.10
|
|
54
54
|
Requires-Dist: flax>=0.12.9
|
|
55
55
|
Requires-Dist: h5py>=3.7
|
|
56
56
|
Requires-Dist: jax-md>=0.2.27
|
|
@@ -37,7 +37,7 @@ classifiers = [
|
|
|
37
37
|
]
|
|
38
38
|
dependencies = [
|
|
39
39
|
# Datarax - operator, source, and pipeline contracts
|
|
40
|
-
"datarax>=0.1.
|
|
40
|
+
"datarax>=0.1.10",
|
|
41
41
|
# Artifex - modeling, modality, and transformer substrate
|
|
42
42
|
"avitai-artifex>=0.1.5",
|
|
43
43
|
# Opifex - scientific ML, operator learning, and advanced optimization
|
|
@@ -70,7 +70,7 @@ license = {file = "LICENSE"}
|
|
|
70
70
|
name = "diffbio"
|
|
71
71
|
readme = "README.md"
|
|
72
72
|
requires-python = ">=3.12,<3.14"
|
|
73
|
-
version = "0.1.
|
|
73
|
+
version = "0.1.5"
|
|
74
74
|
|
|
75
75
|
[project.optional-dependencies]
|
|
76
76
|
all = ["diffbio[benchmark,chem,cuda12,dev,docs,genomics,metal,soft-ops-advanced,soft-ops-ot,test,torch-io]"]
|
|
@@ -139,7 +139,7 @@ class TemperatureOperator(OperatorModule):
|
|
|
139
139
|
data: PyTree,
|
|
140
140
|
state: PyTree,
|
|
141
141
|
metadata: dict[str, Any] | None,
|
|
142
|
-
|
|
142
|
+
key: jax.Array | None = None,
|
|
143
143
|
stats: dict[str, Any] | None = None,
|
|
144
144
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
145
145
|
"""Base apply method - should be overridden by subclasses."""
|
|
@@ -233,7 +233,7 @@ class SequenceOperator(OperatorModule):
|
|
|
233
233
|
data: PyTree,
|
|
234
234
|
state: PyTree,
|
|
235
235
|
metadata: dict[str, Any] | None,
|
|
236
|
-
|
|
236
|
+
key: jax.Array | None = None,
|
|
237
237
|
stats: dict[str, Any] | None = None,
|
|
238
238
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
239
239
|
"""Base apply method - should be overridden by subclasses."""
|
|
@@ -278,6 +278,7 @@ class EncoderDecoderOperator(OperatorModule):
|
|
|
278
278
|
self,
|
|
279
279
|
mean: Float[Array, "... latent_dim"],
|
|
280
280
|
log_var: Float[Array, "... latent_dim"],
|
|
281
|
+
key: jax.Array | None = None,
|
|
281
282
|
) -> Float[Array, "... latent_dim"]:
|
|
282
283
|
"""Sample from latent distribution using reparameterization trick.
|
|
283
284
|
|
|
@@ -288,11 +289,16 @@ class EncoderDecoderOperator(OperatorModule):
|
|
|
288
289
|
Args:
|
|
289
290
|
mean: Mean of the latent distribution.
|
|
290
291
|
log_var: Log variance of the latent distribution.
|
|
292
|
+
key: The key to draw epsilon from. ``apply`` passes the record's key, so a
|
|
293
|
+
record's sample follows the record; a training loss such as
|
|
294
|
+
``compute_elbo_loss`` passes none and draws from the operator's ``sample``
|
|
295
|
+
stream, which advances on every call.
|
|
291
296
|
|
|
292
297
|
Returns:
|
|
293
298
|
Sampled latent representation.
|
|
294
299
|
"""
|
|
295
|
-
key
|
|
300
|
+
if key is None:
|
|
301
|
+
key = get_rng_key(self.rngs, "sample", fallback_seed=0)
|
|
296
302
|
std = jnp.exp(0.5 * log_var)
|
|
297
303
|
epsilon = jax.random.normal(key, mean.shape)
|
|
298
304
|
return mean + std * epsilon
|
|
@@ -345,7 +351,7 @@ class EncoderDecoderOperator(OperatorModule):
|
|
|
345
351
|
data: PyTree,
|
|
346
352
|
state: PyTree,
|
|
347
353
|
metadata: dict[str, Any] | None,
|
|
348
|
-
|
|
354
|
+
key: jax.Array | None = None,
|
|
349
355
|
stats: dict[str, Any] | None = None,
|
|
350
356
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
351
357
|
"""Base apply method - should be overridden by subclasses."""
|
|
@@ -442,7 +448,7 @@ class GraphOperator(OperatorModule):
|
|
|
442
448
|
data: PyTree,
|
|
443
449
|
state: PyTree,
|
|
444
450
|
metadata: dict[str, Any] | None,
|
|
445
|
-
|
|
451
|
+
key: jax.Array | None = None,
|
|
446
452
|
stats: dict[str, Any] | None = None,
|
|
447
453
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
448
454
|
"""Base apply method - should be overridden by subclasses."""
|
|
@@ -593,7 +599,7 @@ class HMMOperator(OperatorModule):
|
|
|
593
599
|
data: PyTree,
|
|
594
600
|
state: PyTree,
|
|
595
601
|
metadata: dict[str, Any] | None,
|
|
596
|
-
|
|
602
|
+
key: jax.Array | None = None,
|
|
597
603
|
stats: dict[str, Any] | None = None,
|
|
598
604
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
599
605
|
"""Base apply method - should be overridden by subclasses."""
|
|
@@ -6,6 +6,7 @@ the expected interfaces and data structures across the DiffBio codebase.
|
|
|
6
6
|
|
|
7
7
|
from typing import Any, Protocol, TypedDict, runtime_checkable
|
|
8
8
|
|
|
9
|
+
import jax
|
|
9
10
|
from jaxtyping import Array, Float
|
|
10
11
|
|
|
11
12
|
# =============================================================================
|
|
@@ -166,7 +167,7 @@ class DifferentiableOperator(Protocol):
|
|
|
166
167
|
data: dict[str, Any],
|
|
167
168
|
state: StateDict,
|
|
168
169
|
metadata: MetadataDict,
|
|
169
|
-
|
|
170
|
+
key: jax.Array | None = None,
|
|
170
171
|
stats: dict[str, Any] | None = None,
|
|
171
172
|
) -> OperatorOutput:
|
|
172
173
|
"""Apply the operator to input data.
|
|
@@ -175,7 +176,7 @@ class DifferentiableOperator(Protocol):
|
|
|
175
176
|
data: Input data dictionary.
|
|
176
177
|
state: Element state.
|
|
177
178
|
metadata: Element metadata.
|
|
178
|
-
|
|
179
|
+
key: The record's PRNG key; a stochastic operator draws from it.
|
|
179
180
|
stats: Statistics dictionary.
|
|
180
181
|
|
|
181
182
|
Returns:
|
|
@@ -161,7 +161,7 @@ class EnsembleUQOperator(OperatorModule):
|
|
|
161
161
|
data: PyTree,
|
|
162
162
|
state: PyTree,
|
|
163
163
|
metadata: dict[str, Any] | None,
|
|
164
|
-
|
|
164
|
+
key: jax.Array | None = None, # noqa: ARG002
|
|
165
165
|
stats: dict[str, Any] | None = None, # noqa: ARG002
|
|
166
166
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
167
167
|
"""Run ensemble forward passes and aggregate with uncertainty.
|
|
@@ -170,7 +170,7 @@ class EnsembleUQOperator(OperatorModule):
|
|
|
170
170
|
data: Input data dict for the base operator.
|
|
171
171
|
state: Element state (passed through).
|
|
172
172
|
metadata: Element metadata (passed through).
|
|
173
|
-
|
|
173
|
+
key: Unused.
|
|
174
174
|
stats: Unused.
|
|
175
175
|
|
|
176
176
|
Returns:
|
|
@@ -241,7 +241,7 @@ class MCSamplingUQOperator(OperatorModule):
|
|
|
241
241
|
data: PyTree,
|
|
242
242
|
state: PyTree,
|
|
243
243
|
metadata: dict[str, Any] | None,
|
|
244
|
-
|
|
244
|
+
key: jax.Array | None = None, # noqa: ARG002
|
|
245
245
|
stats: dict[str, Any] | None = None, # noqa: ARG002
|
|
246
246
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
247
247
|
"""Run Monte Carlo sampling to estimate empirical intervals.
|
|
@@ -250,7 +250,7 @@ class MCSamplingUQOperator(OperatorModule):
|
|
|
250
250
|
data: Input data dict for the base operator.
|
|
251
251
|
state: Element state (passed through).
|
|
252
252
|
metadata: Element metadata (passed through).
|
|
253
|
-
|
|
253
|
+
key: Unused.
|
|
254
254
|
stats: Unused.
|
|
255
255
|
|
|
256
256
|
Returns:
|
|
@@ -135,7 +135,7 @@ class TaskAdapter:
|
|
|
135
135
|
else:
|
|
136
136
|
adapted = data_dict
|
|
137
137
|
|
|
138
|
-
result, _, _ = operator.apply(adapted, {}, None)
|
|
138
|
+
result, _, _ = operator.apply(adapted, {}, None, jax.random.key(self._seed))
|
|
139
139
|
# Propagate retention info
|
|
140
140
|
if "retention_weights" not in result and "quality_scores" in adapted:
|
|
141
141
|
quality = adapted["quality_scores"]
|
|
@@ -160,7 +160,7 @@ class TaskAdapter:
|
|
|
160
160
|
temperature=temperature,
|
|
161
161
|
)
|
|
162
162
|
operator = SoftKMeansClustering(op_config, rngs=nnx.Rngs(self._seed))
|
|
163
|
-
result, _, _ = operator.apply(data_dict, {}, None)
|
|
163
|
+
result, _, _ = operator.apply(data_dict, {}, None, jax.random.key(self._seed))
|
|
164
164
|
return result
|
|
165
165
|
|
|
166
166
|
def _run_de(self, data_dict: dict[str, Any], config: dict[str, Any]) -> dict[str, Any]:
|
|
@@ -178,7 +178,7 @@ class TaskAdapter:
|
|
|
178
178
|
n_conditions=n_conditions,
|
|
179
179
|
)
|
|
180
180
|
pipeline = DifferentialExpressionPipeline(op_config, rngs=nnx.Rngs(self._seed))
|
|
181
|
-
result, _, _ = pipeline.apply(data_dict, {}, None)
|
|
181
|
+
result, _, _ = pipeline.apply(data_dict, {}, None, jax.random.key(self._seed))
|
|
182
182
|
|
|
183
183
|
# Add gene names for grader extraction
|
|
184
184
|
if "gene_names" not in result:
|
|
@@ -202,7 +202,7 @@ class TaskAdapter:
|
|
|
202
202
|
n_clusters=n_clusters,
|
|
203
203
|
)
|
|
204
204
|
operator = DifferentiableHarmony(op_config, rngs=nnx.Rngs(self._seed))
|
|
205
|
-
result, _, _ = operator.apply(data_dict, {}, None)
|
|
205
|
+
result, _, _ = operator.apply(data_dict, {}, None, jax.random.key(self._seed))
|
|
206
206
|
return result
|
|
207
207
|
|
|
208
208
|
def _run_normalization(
|
|
@@ -222,7 +222,7 @@ class TaskAdapter:
|
|
|
222
222
|
latent_dim=latent_dim,
|
|
223
223
|
)
|
|
224
224
|
operator = VAENormalizer(op_config, rngs=nnx.Rngs(self._seed))
|
|
225
|
-
result, _, _ = operator.apply(data_dict, {}, None)
|
|
225
|
+
result, _, _ = operator.apply(data_dict, {}, None, jax.random.key(self._seed))
|
|
226
226
|
return result
|
|
227
227
|
|
|
228
228
|
def _run_trajectory(self, data_dict: dict[str, Any], config: dict[str, Any]) -> dict[str, Any]:
|
|
@@ -240,7 +240,7 @@ class TaskAdapter:
|
|
|
240
240
|
n_diffusion_components=n_diffusion_components,
|
|
241
241
|
)
|
|
242
242
|
operator = DifferentiablePseudotime(op_config, rngs=nnx.Rngs(self._seed))
|
|
243
|
-
result, _, _ = operator.apply(data_dict, {}, None)
|
|
243
|
+
result, _, _ = operator.apply(data_dict, {}, None, jax.random.key(self._seed))
|
|
244
244
|
return result
|
|
245
245
|
|
|
246
246
|
def _run_spatial_analysis(
|
|
@@ -260,7 +260,7 @@ class TaskAdapter:
|
|
|
260
260
|
n_domains=n_domains,
|
|
261
261
|
)
|
|
262
262
|
operator = DifferentiableSpatialDomain(op_config, rngs=nnx.Rngs(self._seed))
|
|
263
|
-
result, _, _ = operator.apply(data_dict, {}, None)
|
|
263
|
+
result, _, _ = operator.apply(data_dict, {}, None, jax.random.key(self._seed))
|
|
264
264
|
return result
|
|
265
265
|
|
|
266
266
|
def _run_cell_annotation(
|
|
@@ -8,7 +8,6 @@ construction and one mask/input preparation flow.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
from dataclasses import dataclass
|
|
11
|
-
from typing import Any
|
|
12
11
|
|
|
13
12
|
import jax
|
|
14
13
|
import jax.numpy as jnp
|
|
@@ -63,28 +62,34 @@ def build_masked_gene_transformer_encoder(
|
|
|
63
62
|
|
|
64
63
|
def build_masked_gene_mask(
|
|
65
64
|
*,
|
|
66
|
-
|
|
65
|
+
key: jax.Array | None,
|
|
67
66
|
mask_ratio: float,
|
|
68
67
|
n_genes: int,
|
|
69
68
|
) -> Array:
|
|
70
|
-
"""Build a per-gene binary mask for masked-gene transformer operators.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
"""Build a per-gene binary mask for masked-gene transformer operators.
|
|
70
|
+
|
|
71
|
+
With ``mask_ratio == 0`` nothing is masked and no key is needed; otherwise the mask is
|
|
72
|
+
drawn from ``key``, which must be given.
|
|
73
|
+
"""
|
|
74
|
+
if mask_ratio <= 0:
|
|
75
|
+
return jnp.zeros(n_genes, dtype=jnp.float32)
|
|
76
|
+
if key is None:
|
|
77
|
+
raise ValueError("masking genes needs the record's PRNG key")
|
|
78
|
+
noise = jax.random.uniform(key, (n_genes,))
|
|
79
|
+
return (noise < mask_ratio).astype(jnp.float32)
|
|
75
80
|
|
|
76
81
|
|
|
77
82
|
def prepare_masked_gene_batch(
|
|
78
83
|
data: PyTree,
|
|
79
84
|
*,
|
|
80
|
-
|
|
85
|
+
key: jax.Array | None,
|
|
81
86
|
mask_ratio: float,
|
|
82
87
|
) -> tuple[Array, Array, Array]:
|
|
83
88
|
"""Extract counts, int32 gene IDs, and the shared masking vector."""
|
|
84
89
|
counts = data["counts"]
|
|
85
90
|
gene_ids = jnp.asarray(data["gene_ids"], dtype=jnp.int32)
|
|
86
91
|
mask = build_masked_gene_mask(
|
|
87
|
-
|
|
92
|
+
key=key,
|
|
88
93
|
mask_ratio=mask_ratio,
|
|
89
94
|
n_genes=int(counts.shape[1]),
|
|
90
95
|
)
|
|
@@ -96,23 +101,14 @@ class MaskedGeneTransformerOperatorMixin:
|
|
|
96
101
|
|
|
97
102
|
config: MaskedGeneTransformerConfigBase
|
|
98
103
|
|
|
99
|
-
def generate_random_params(
|
|
100
|
-
self,
|
|
101
|
-
rng: jax.Array,
|
|
102
|
-
data_shapes: PyTree,
|
|
103
|
-
) -> jax.Array:
|
|
104
|
-
"""Return the RNG key used for reproducible masking inside apply."""
|
|
105
|
-
del data_shapes
|
|
106
|
-
return rng
|
|
107
|
-
|
|
108
104
|
def prepare_masked_gene_batch(
|
|
109
105
|
self,
|
|
110
106
|
data: PyTree,
|
|
111
|
-
|
|
107
|
+
key: jax.Array | None,
|
|
112
108
|
) -> tuple[Array, Array, Array]:
|
|
113
109
|
"""Prepare shared masked-gene inputs for per-cell `vmap` execution."""
|
|
114
110
|
return prepare_masked_gene_batch(
|
|
115
111
|
data,
|
|
116
|
-
|
|
112
|
+
key=key,
|
|
117
113
|
mask_ratio=self.config.mask_ratio,
|
|
118
114
|
)
|
|
@@ -41,7 +41,6 @@ class ProfileHMMConfig(OperatorConfig):
|
|
|
41
41
|
learnable_profile: Whether profile parameters are learnable.
|
|
42
42
|
"""
|
|
43
43
|
|
|
44
|
-
cacheable: bool = True
|
|
45
44
|
profile_length: int = 100
|
|
46
45
|
alphabet_size: int = 20 # Amino acids by default
|
|
47
46
|
temperature: float = 1.0
|
|
@@ -309,7 +308,7 @@ class ProfileHMMSearch(TemperatureOperator):
|
|
|
309
308
|
data: PyTree,
|
|
310
309
|
state: PyTree,
|
|
311
310
|
metadata: dict[str, Any] | None,
|
|
312
|
-
|
|
311
|
+
key: jax.Array | None = None,
|
|
313
312
|
stats: dict[str, Any] | None = None,
|
|
314
313
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
315
314
|
"""Apply profile HMM search to sequence.
|
|
@@ -319,7 +318,7 @@ class ProfileHMMSearch(TemperatureOperator):
|
|
|
319
318
|
- "sequence": One-hot encoded sequence (seq_len, alphabet_size)
|
|
320
319
|
state: Element state (passed through unchanged)
|
|
321
320
|
metadata: Element metadata (passed through unchanged)
|
|
322
|
-
|
|
321
|
+
key: Unused.
|
|
323
322
|
stats: Not used
|
|
324
323
|
|
|
325
324
|
Returns:
|
|
@@ -39,7 +39,6 @@ class SmithWatermanConfig(TemperatureConfig):
|
|
|
39
39
|
gap_extend: Penalty for extending a gap.
|
|
40
40
|
"""
|
|
41
41
|
|
|
42
|
-
cacheable: bool = True
|
|
43
42
|
gap_open: float = DEFAULT_GAP_OPEN
|
|
44
43
|
gap_extend: float = DEFAULT_GAP_EXTEND
|
|
45
44
|
|
|
@@ -216,7 +215,7 @@ class SmoothSmithWaterman(TemperatureOperator):
|
|
|
216
215
|
data: PyTree,
|
|
217
216
|
state: PyTree,
|
|
218
217
|
metadata: dict[str, Any] | None,
|
|
219
|
-
|
|
218
|
+
key: jax.Array | None = None,
|
|
220
219
|
stats: dict[str, Any] | None = None,
|
|
221
220
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
222
221
|
"""Apply alignment to sequence pair data.
|
|
@@ -233,7 +232,7 @@ class SmoothSmithWaterman(TemperatureOperator):
|
|
|
233
232
|
- "seq2": Second sequence, one-hot encoded (len2, alphabet_size)
|
|
234
233
|
state: Element state (passed through unchanged)
|
|
235
234
|
metadata: Element metadata (passed through unchanged)
|
|
236
|
-
|
|
235
|
+
key: Unused.
|
|
237
236
|
stats: Not used
|
|
238
237
|
|
|
239
238
|
Returns:
|
|
@@ -339,7 +339,7 @@ class SoftProgressiveMSA(TemperatureOperator):
|
|
|
339
339
|
data: PyTree,
|
|
340
340
|
state: PyTree,
|
|
341
341
|
metadata: dict[str, Any] | None,
|
|
342
|
-
|
|
342
|
+
key: jax.Array | None = None,
|
|
343
343
|
stats: dict[str, Any] | None = None,
|
|
344
344
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
345
345
|
"""Apply soft progressive MSA.
|
|
@@ -349,7 +349,7 @@ class SoftProgressiveMSA(TemperatureOperator):
|
|
|
349
349
|
- "sequences": Input sequences (n_seqs, seq_len, alphabet_size)
|
|
350
350
|
state: Element state (passed through unchanged)
|
|
351
351
|
metadata: Element metadata (passed through unchanged)
|
|
352
|
-
|
|
352
|
+
key: Unused.
|
|
353
353
|
stats: Not used
|
|
354
354
|
|
|
355
355
|
Returns:
|
|
@@ -20,6 +20,7 @@ import logging
|
|
|
20
20
|
from dataclasses import dataclass
|
|
21
21
|
from typing import Any
|
|
22
22
|
|
|
23
|
+
import jax
|
|
23
24
|
import jax.numpy as jnp
|
|
24
25
|
from flax import nnx
|
|
25
26
|
from jaxtyping import Array, Float, Int, PyTree
|
|
@@ -187,7 +188,7 @@ class GNNAssemblyNavigator(GraphOperator):
|
|
|
187
188
|
data: PyTree,
|
|
188
189
|
state: PyTree,
|
|
189
190
|
metadata: dict[str, Any] | None,
|
|
190
|
-
|
|
191
|
+
key: jax.Array | None = None,
|
|
191
192
|
stats: dict[str, Any] | None = None,
|
|
192
193
|
) -> tuple[PyTree, PyTree, dict[str, Any] | None]:
|
|
193
194
|
"""Apply GNN assembly navigation.
|
|
@@ -199,7 +200,7 @@ class GNNAssemblyNavigator(GraphOperator):
|
|
|
199
200
|
- "edge_features": Edge features (n_edges, edge_features)
|
|
200
201
|
state: Element state (passed through unchanged)
|
|
201
202
|
metadata: Element metadata (passed through unchanged)
|
|
202
|
-
|
|
203
|
+
key: Unused.
|
|
203
204
|
stats: Not used
|
|
204
205
|
|
|
205
206
|
Returns:
|
|
@@ -15,6 +15,7 @@ import jax
|
|
|
15
15
|
import jax.numpy as jnp
|
|
16
16
|
from artifex.generative_models.core.base import MLP
|
|
17
17
|
from flax import nnx
|
|
18
|
+
from datarax.core.operator import require_key
|
|
18
19
|
from jaxtyping import Array, Float
|
|
19
20
|
|
|
20
21
|
from diffbio.configs import TemperatureConfig, apply_stochastic_sampling_defaults
|
|
@@ -212,7 +213,7 @@ class DifferentiableMetagenomicBinner(TemperatureOperator, EncoderDecoderOperato
|
|
|
212
213
|
data: dict[str, Array],
|
|
213
214
|
state: dict[str, Any],
|
|
214
215
|
metadata: dict[str, Any] | None,
|
|
215
|
-
|
|
216
|
+
key: jax.Array | None = None, # noqa: ARG002
|
|
216
217
|
stats: dict[str, Any] | None = None, # noqa: ARG002
|
|
217
218
|
) -> tuple[dict[str, Array], dict[str, Any], dict[str, Any] | None]:
|
|
218
219
|
"""Apply metagenomic binning.
|
|
@@ -223,7 +224,8 @@ class DifferentiableMetagenomicBinner(TemperatureOperator, EncoderDecoderOperato
|
|
|
223
224
|
- abundance: Float[Array, "n_contigs n_samples"]
|
|
224
225
|
state: Element state (passed through).
|
|
225
226
|
metadata: Element metadata (passed through).
|
|
226
|
-
|
|
227
|
+
key: The record's PRNG key; in train mode the latent sample is drawn
|
|
228
|
+
from it, in eval mode the mean is used and no key is needed.
|
|
227
229
|
stats: Optional statistics dict.
|
|
228
230
|
|
|
229
231
|
Returns:
|
|
@@ -242,7 +244,7 @@ class DifferentiableMetagenomicBinner(TemperatureOperator, EncoderDecoderOperato
|
|
|
242
244
|
if self.latent_sampling_mode.deterministic:
|
|
243
245
|
z = mu # Eval mode: deterministic
|
|
244
246
|
else:
|
|
245
|
-
z = self.reparameterize(mu, logvar) # Train mode
|
|
247
|
+
z = self.reparameterize(mu, logvar, require_key(key, self)) # Train mode
|
|
246
248
|
|
|
247
249
|
# Decode
|
|
248
250
|
tnf_recon, abundance_recon = self.decode(z)
|
|
@@ -28,6 +28,7 @@ import logging
|
|
|
28
28
|
from dataclasses import dataclass
|
|
29
29
|
from typing import Any
|
|
30
30
|
|
|
31
|
+
import jax
|
|
31
32
|
import jax.numpy as jnp
|
|
32
33
|
from artifex.generative_models.core.base import MLP
|
|
33
34
|
from datarax.core.config import OperatorConfig
|
|
@@ -195,7 +196,7 @@ class DifferentiableCRISPRScorer(OperatorModule):
|
|
|
195
196
|
data: dict[str, Any],
|
|
196
197
|
state: dict[str, Any],
|
|
197
198
|
metadata: dict[str, Any] | None,
|
|
198
|
-
|
|
199
|
+
key: jax.Array | None = None,
|
|
199
200
|
stats: dict[str, Any] | None = None,
|
|
200
201
|
) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any] | None]:
|
|
201
202
|
"""Apply CRISPR scoring to guide sequences.
|
|
@@ -205,7 +206,7 @@ class DifferentiableCRISPRScorer(OperatorModule):
|
|
|
205
206
|
- "guides": One-hot encoded guides (n_guides, guide_length, 4).
|
|
206
207
|
state: Per-element state (passed through).
|
|
207
208
|
metadata: Optional metadata (passed through).
|
|
208
|
-
|
|
209
|
+
key: Unused.
|
|
209
210
|
stats: Optional statistics dictionary.
|
|
210
211
|
|
|
211
212
|
Returns:
|
|
@@ -12,11 +12,6 @@ from diffbio.utils.nn_utils import ensure_rngs
|
|
|
12
12
|
logger = logging.getLogger(__name__)
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
def stabilize_operator_id(module: Any) -> None:
|
|
16
|
-
"""Mark operator unique ID as static for NNX/JAX transformations."""
|
|
17
|
-
module._unique_id = nnx.static(module._unique_id)
|
|
18
|
-
|
|
19
|
-
|
|
20
15
|
def build_encoder(
|
|
21
16
|
*,
|
|
22
17
|
hidden_dim: int,
|
|
@@ -56,8 +51,7 @@ def initialize_graph_encoder(
|
|
|
56
51
|
num_edge_features: int | None = None,
|
|
57
52
|
attr: str = "encoder",
|
|
58
53
|
) -> nnx.Rngs:
|
|
59
|
-
"""
|
|
60
|
-
stabilize_operator_id(module)
|
|
54
|
+
"""Ensure RNGs and attach a message-passing encoder."""
|
|
61
55
|
resolved_rngs = ensure_rngs(rngs)
|
|
62
56
|
setattr(
|
|
63
57
|
module,
|
|
@@ -16,6 +16,7 @@ import logging
|
|
|
16
16
|
from dataclasses import dataclass
|
|
17
17
|
from typing import Any
|
|
18
18
|
|
|
19
|
+
import jax
|
|
19
20
|
import jax.numpy as jnp
|
|
20
21
|
from artifex.generative_models.core.base import MLP
|
|
21
22
|
from datarax.core.config import OperatorConfig
|
|
@@ -201,7 +202,7 @@ class ADMETPredictor(OperatorModule):
|
|
|
201
202
|
data: dict[str, Any],
|
|
202
203
|
state: dict[str, Any],
|
|
203
204
|
metadata: dict[str, Any] | None,
|
|
204
|
-
|
|
205
|
+
key: jax.Array | None = None, # noqa: ARG002
|
|
205
206
|
stats: dict[str, Any] | None = None, # noqa: ARG002
|
|
206
207
|
) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any] | None]:
|
|
207
208
|
"""Predict ADMET properties from molecular graph.
|
|
@@ -214,7 +215,7 @@ class ADMETPredictor(OperatorModule):
|
|
|
214
215
|
- node_mask: (num_nodes,) mask for valid nodes
|
|
215
216
|
state: Per-element state (passed through).
|
|
216
217
|
metadata: Optional metadata.
|
|
217
|
-
|
|
218
|
+
key: Unused.
|
|
218
219
|
stats: Optional statistics dictionary.
|
|
219
220
|
|
|
220
221
|
Returns:
|
|
@@ -223,7 +224,7 @@ class ADMETPredictor(OperatorModule):
|
|
|
223
224
|
- unchanged state
|
|
224
225
|
- unchanged metadata
|
|
225
226
|
"""
|
|
226
|
-
del
|
|
227
|
+
del key, stats # Unused
|
|
227
228
|
|
|
228
229
|
graph_repr = graph_sum_readout(data, self.encoder, dropout=self.dropout)
|
|
229
230
|
|
|
@@ -28,7 +28,6 @@ from flax import nnx
|
|
|
28
28
|
|
|
29
29
|
from diffbio.operators.drug_discovery._graph_utils import (
|
|
30
30
|
build_optional_dropout,
|
|
31
|
-
stabilize_operator_id,
|
|
32
31
|
)
|
|
33
32
|
|
|
34
33
|
logger = logging.getLogger(__name__)
|
|
@@ -232,8 +231,6 @@ class AttentiveFP(OperatorModule):
|
|
|
232
231
|
"""
|
|
233
232
|
super().__init__(config, rngs=rngs)
|
|
234
233
|
|
|
235
|
-
stabilize_operator_id(self)
|
|
236
|
-
|
|
237
234
|
if rngs is None:
|
|
238
235
|
rngs = nnx.Rngs(0)
|
|
239
236
|
|
|
@@ -292,7 +289,7 @@ class AttentiveFP(OperatorModule):
|
|
|
292
289
|
data: dict[str, Any],
|
|
293
290
|
state: dict[str, Any],
|
|
294
291
|
metadata: dict[str, Any] | None,
|
|
295
|
-
|
|
292
|
+
key: jax.Array | None = None, # noqa: ARG002
|
|
296
293
|
stats: dict[str, Any] | None = None, # noqa: ARG002
|
|
297
294
|
) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any] | None]:
|
|
298
295
|
"""Compute AttentiveFP molecular fingerprint.
|
|
@@ -305,7 +302,7 @@ class AttentiveFP(OperatorModule):
|
|
|
305
302
|
- node_mask: (num_nodes,) optional mask for valid nodes
|
|
306
303
|
state: Per-element state (passed through).
|
|
307
304
|
metadata: Optional metadata.
|
|
308
|
-
|
|
305
|
+
key: Unused.
|
|
309
306
|
stats: Optional statistics dictionary.
|
|
310
307
|
|
|
311
308
|
Returns:
|
|
@@ -314,7 +311,7 @@ class AttentiveFP(OperatorModule):
|
|
|
314
311
|
- unchanged state
|
|
315
312
|
- unchanged metadata
|
|
316
313
|
"""
|
|
317
|
-
del
|
|
314
|
+
del key, stats # Unused
|
|
318
315
|
|
|
319
316
|
node_features = data["node_features"]
|
|
320
317
|
adjacency = data["adjacency"]
|
|
@@ -14,6 +14,7 @@ from __future__ import annotations
|
|
|
14
14
|
from dataclasses import dataclass
|
|
15
15
|
from typing import Any
|
|
16
16
|
|
|
17
|
+
import jax
|
|
17
18
|
import jax.numpy as jnp
|
|
18
19
|
import numpy as np
|
|
19
20
|
from datarax.core.config import OperatorConfig
|
|
@@ -150,11 +151,11 @@ class DifferentiableDTIPipeline(nnx.Module):
|
|
|
150
151
|
data: dict[str, Any],
|
|
151
152
|
state: dict[str, Any],
|
|
152
153
|
metadata: dict[str, Any] | None,
|
|
153
|
-
|
|
154
|
+
key: jax.Array | None = None,
|
|
154
155
|
stats: dict[str, Any] | None = None,
|
|
155
156
|
) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any] | None]:
|
|
156
157
|
"""Score a prepared paired protein/drug DTI batch."""
|
|
157
|
-
del
|
|
158
|
+
del key, stats
|
|
158
159
|
|
|
159
160
|
protein_result, _, _ = self.protein_encoder.apply(
|
|
160
161
|
{
|
|
@@ -12,6 +12,7 @@ import logging
|
|
|
12
12
|
from dataclasses import dataclass
|
|
13
13
|
from typing import Any
|
|
14
14
|
|
|
15
|
+
import jax
|
|
15
16
|
import jax.numpy as jnp
|
|
16
17
|
import numpy as np
|
|
17
18
|
from datarax.core.config import OperatorConfig
|
|
@@ -25,7 +26,6 @@ from diffbio.operators.drug_discovery._graph_utils import (
|
|
|
25
26
|
ensure_rngs,
|
|
26
27
|
graph_sum_readout,
|
|
27
28
|
initialize_graph_encoder,
|
|
28
|
-
stabilize_operator_id,
|
|
29
29
|
unpack_graph_inputs,
|
|
30
30
|
)
|
|
31
31
|
|
|
@@ -110,7 +110,7 @@ class DifferentiableMolecularFingerprint(OperatorModule):
|
|
|
110
110
|
data: dict[str, Any],
|
|
111
111
|
state: dict[str, Any],
|
|
112
112
|
metadata: dict[str, Any] | None,
|
|
113
|
-
|
|
113
|
+
key: jax.Array | None = None,
|
|
114
114
|
stats: dict[str, Any] | None = None,
|
|
115
115
|
) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any] | None]:
|
|
116
116
|
"""Compute molecular fingerprint.
|
|
@@ -122,7 +122,7 @@ class DifferentiableMolecularFingerprint(OperatorModule):
|
|
|
122
122
|
- node_mask: (num_nodes,) mask for valid nodes
|
|
123
123
|
state: Per-element state (passed through).
|
|
124
124
|
metadata: Optional metadata.
|
|
125
|
-
|
|
125
|
+
key: Unused.
|
|
126
126
|
stats: Optional statistics dictionary.
|
|
127
127
|
|
|
128
128
|
Returns:
|
|
@@ -244,7 +244,6 @@ class CircularFingerprintOperator(OperatorModule):
|
|
|
244
244
|
"""
|
|
245
245
|
super().__init__(config, rngs=rngs)
|
|
246
246
|
|
|
247
|
-
stabilize_operator_id(self)
|
|
248
247
|
rngs = ensure_rngs(rngs)
|
|
249
248
|
|
|
250
249
|
if config.differentiable:
|
|
@@ -368,7 +367,7 @@ class CircularFingerprintOperator(OperatorModule):
|
|
|
368
367
|
data: dict[str, Any],
|
|
369
368
|
state: dict[str, Any],
|
|
370
369
|
metadata: dict[str, Any] | None,
|
|
371
|
-
|
|
370
|
+
key: jax.Array | None = None,
|
|
372
371
|
stats: dict[str, Any] | None = None,
|
|
373
372
|
) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any] | None]:
|
|
374
373
|
"""Compute circular fingerprint.
|
|
@@ -383,7 +382,7 @@ class CircularFingerprintOperator(OperatorModule):
|
|
|
383
382
|
- smiles: SMILES string
|
|
384
383
|
state: Per-element state (passed through).
|
|
385
384
|
metadata: Optional metadata.
|
|
386
|
-
|
|
385
|
+
key: Unused.
|
|
387
386
|
stats: Optional statistics dictionary.
|
|
388
387
|
|
|
389
388
|
Returns:
|