deepbatch 0.2.0__py3-none-any.whl

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.
deepbatch/__init__.py ADDED
@@ -0,0 +1,13 @@
1
+ """Batch assessment on labeled, analysis-scale molecular measurements."""
2
+ from .model import BatchFit, fit_batch, reference_correct, reference_dispersion
3
+ from .assays import detection_rates, log_cpm, methylation_log_odds, peak_jaccard
4
+ from .evaluation import (adaptive_location_test, feature_batch_tests, guided_pca, pc_batch_share, qc_metrics,
5
+ reference_contrast, silhouette)
6
+ from .upstream import r_evaluation, single_cell_evaluation
7
+
8
+ __all__ = ["BatchFit", "fit_batch", "reference_correct", "detection_rates",
9
+ "log_cpm", "methylation_log_odds", "peak_jaccard", "reference_dispersion",
10
+ "guided_pca", "pc_batch_share", "qc_metrics", "reference_contrast",
11
+ "r_evaluation", "single_cell_evaluation", "feature_batch_tests", "silhouette",
12
+ "adaptive_location_test"]
13
+
deepbatch/assays.py ADDED
@@ -0,0 +1,98 @@
1
+ """Input conversions and diagnostics for molecular assays."""
2
+ import numpy as np
3
+ import pandas as pd
4
+
5
+ from .model import _labels, _matrix
6
+
7
+
8
+ def _counts(data):
9
+ x = _matrix(data)
10
+ if (x < 0).any() or (x != np.floor(x)).any():
11
+ raise ValueError("Counts must be nonnegative integers.")
12
+ return x
13
+
14
+
15
+ def log_cpm(counts, *, library_size=None, prior_cpm=0.5):
16
+ """Log2 counts per million on a common feature panel, with a CPM-scale offset.
17
+
18
+ Supply total library sizes for a panel subset. Row sums are used by default.
19
+ """
20
+ x = _counts(counts)
21
+ sizes = (x.sum(axis=1) if library_size is None
22
+ else _labels(library_size, counts.index).to_numpy(dtype=float))
23
+ if not np.isfinite(sizes).all() or (sizes <= 0).any():
24
+ raise ValueError("Library sizes must be positive and finite.")
25
+ if not np.isfinite(prior_cpm) or prior_cpm <= 0:
26
+ raise ValueError("prior_cpm must be positive and finite.")
27
+ return pd.DataFrame(np.log2(x / sizes[:, None] * 1e6 + prior_cpm),
28
+ index=counts.index, columns=counts.columns)
29
+
30
+
31
+ def methylation_log_odds(methylated, coverage, *, prior=0.5):
32
+ """Log2 methylated-to-unmethylated count ratio. Uncovered sites remain NaN."""
33
+ m = _counts(methylated)
34
+ n = _counts(coverage)
35
+ if not methylated.index.equals(coverage.index) or not methylated.columns.equals(coverage.columns):
36
+ raise ValueError("Methylated and total counts must have identical axes.")
37
+ if (m > n).any() or not np.isfinite(prior) or prior <= 0:
38
+ raise ValueError("Check methylated counts, coverage and positive finite prior.")
39
+ result = np.log2((m + prior) / (n - m + prior))
40
+ result[n == 0] = np.nan
41
+ return pd.DataFrame(result, index=coverage.index, columns=coverage.columns)
42
+
43
+
44
+ def detection_rates(detected, batch):
45
+ """Per-batch fraction detected for each feature, from an explicit 0/1 mask."""
46
+ x = _matrix(detected)
47
+ if not np.isin(x, [0, 1]).all():
48
+ raise ValueError("Supply a boolean or binary detection mask.")
49
+ labels = _labels(batch, detected.index)
50
+ return pd.DataFrame(x, index=detected.index, columns=detected.columns).groupby(
51
+ labels, observed=True, sort=False).mean()
52
+
53
+
54
+ def _regions(peaks):
55
+ columns = ["chrom", "start", "end"]
56
+ if not isinstance(peaks, pd.DataFrame) or not set(columns).issubset(peaks.columns):
57
+ raise ValueError("Supply BED-style chrom, start, end columns.")
58
+ regions = {}
59
+ for chrom, start, end in peaks[columns].itertuples(index=False, name=None):
60
+ if (not isinstance(chrom, str) or not chrom or
61
+ not isinstance(start, (int, np.integer)) or not isinstance(end, (int, np.integer))
62
+ or start < 0 or end <= start):
63
+ raise ValueError("Use named chromosomes and nonempty half-open integer intervals.")
64
+ regions.setdefault(chrom, []).append((start, end))
65
+ merged = {}
66
+ for chrom, intervals in regions.items():
67
+ spans = []
68
+ for start, end in sorted(intervals):
69
+ if spans and start <= spans[-1][1]:
70
+ spans[-1] = (spans[-1][0], max(end, spans[-1][1]))
71
+ else:
72
+ spans.append((start, end))
73
+ merged[chrom] = spans
74
+ return merged
75
+
76
+
77
+ def peak_jaccard(left, right):
78
+ """Base-pair intersection / union for two peak sets on the same genome build.
79
+
80
+ Overlapping intervals within a set count once. Two empty sets yield NaN.
81
+ """
82
+ a, b = _regions(left), _regions(right)
83
+ total = sum(end - start for dataset in (a, b) for spans in dataset.values()
84
+ for start, end in spans)
85
+ overlap = 0
86
+ for chrom in a.keys() & b.keys():
87
+ i = j = 0
88
+ while i < len(a[chrom]) and j < len(b[chrom]):
89
+ s, e = a[chrom][i]
90
+ u, v = b[chrom][j]
91
+ overlap += max(0, min(e, v) - max(s, u))
92
+ if e <= v:
93
+ i += 1
94
+ else:
95
+ j += 1
96
+ union = total - overlap
97
+ return overlap / union if union else np.nan
98
+
deepbatch/evaluate.R ADDED
@@ -0,0 +1,40 @@
1
+ args <- commandArgs(trailingOnly = TRUE)
2
+ method <- args[1]
3
+ set.seed(as.integer(args[4]))
4
+ x <- as.matrix(read.csv("x.csv", header = FALSE))
5
+ m <- read.csv("meta.csv")
6
+ factors <- strsplit(args[5], ",", fixed = TRUE)[[1]]
7
+ m[factors] <- lapply(m[factors], factor)
8
+ terms <- setdiff(names(m), "Block")
9
+ if (method %in% c("permanova", "permdisp")) {
10
+ if (!requireNamespace("vegan", quietly = TRUE)) stop("Install R package vegan.")
11
+ d <- dist(x)
12
+ control <- permute::how(nperm = as.integer(args[2]), blocks = m$Block)
13
+ if (method == "permanova") {
14
+ formula <- reformulate(terms, response = "d")
15
+ design <- model.matrix(reformulate(terms), m)
16
+ if (qr(design)$rank < ncol(design) || nrow(m) <= ncol(design))
17
+ stop("The batch design is aliased or lacks residual degrees of freedom.")
18
+ result <- as.data.frame(vegan::adonis2(formula, m, permutations = control, by = "margin"))
19
+ } else {
20
+ if (any(table(m$Batch) < 2)) stop("PERMDISP requires replicated batches.")
21
+ spread <- vegan::betadisper(d, m$Batch, type = "median", bias.adjust = TRUE)
22
+ result <- as.data.frame(vegan::permutest(spread, permutations = control)$tab)
23
+ }
24
+ } else if (method == "pvca") {
25
+ if (!requireNamespace("pvca", quietly = TRUE)) stop("Install Bioconductor package pvca.")
26
+ colnames(x) <- paste0("feature", seq_len(ncol(x)))
27
+ rownames(x) <- rownames(m)
28
+ eset <- Biobase::ExpressionSet(t(x), phenoData = Biobase::AnnotatedDataFrame(m))
29
+ pv <- pvca::pvcaBatchAssess(eset, batch.factors = terms, threshold = as.numeric(args[3]))
30
+ result <- data.frame(retained_share = as.numeric(pv$dat), row.names = pv$label)
31
+ } else {
32
+ if (!requireNamespace("variancePartition", quietly = TRUE))
33
+ stop("Install Bioconductor package variancePartition.")
34
+ model <- reformulate(c(sprintf("(1|%s)", factors), setdiff(terms, factors)))
35
+ colnames(x) <- paste0("feature", seq_len(ncol(x)))
36
+ rownames(x) <- rownames(m)
37
+ result <- as.data.frame(variancePartition::fitExtractVarPartModel(t(x), model, m))
38
+ }
39
+ write.csv(result, "result.csv")
40
+
@@ -0,0 +1,197 @@
1
+ """Evaluation on independent, labeled samples. All matrices are samples by features."""
2
+ import numpy as np
3
+ import pandas as pd
4
+ from scipy.spatial.distance import cdist
5
+ from scipy.stats import f, rankdata
6
+
7
+ from .model import _labels, _matrix, fit_batch
8
+
9
+
10
+ def adaptive_location_test(data, batch, *, strata=None, permutations=999, seed=0):
11
+ """Dense/sparse omnibus permutation test for two batches of independent samples.
12
+
13
+ Under the joint null, batch labels must be exchangeable within each stratum.
14
+ Both batches must be represented in every supplied stratum. The statistic
15
+ uses squared, within-stratum-adjusted feature/batch correlations. The sum
16
+ emphasizes widespread shifts and the maximum emphasizes localized shifts.
17
+ """
18
+ x = _matrix(data)
19
+ b, levels = pd.factorize(_labels(batch, data.index))
20
+ if len(levels) != 2 or not isinstance(permutations, (int, np.integer)) or permutations < 1:
21
+ raise ValueError("Supply exactly two batches and a positive permutation count.")
22
+ groups = (np.zeros(len(b), dtype=int) if strata is None else
23
+ pd.factorize(_labels(strata, data.index))[0])
24
+ blocks = [np.flatnonzero(groups == g) for g in np.unique(groups)]
25
+ if any(np.unique(b[idx]).size < 2 for idx in blocks):
26
+ raise ValueError("Both batches must occur in each exchangeability stratum.")
27
+ if len(b) <= len(blocks) + 1:
28
+ raise ValueError("Insufficient independent observations.")
29
+ residual = x.copy()
30
+ labels = b.astype(float)
31
+ for idx in blocks:
32
+ residual[idx] -= residual[idx].mean(axis=0)
33
+ labels[idx] -= labels[idx].mean()
34
+ lengths = np.linalg.norm(residual, axis=0)
35
+ usable = lengths > np.finfo(float).eps * np.linalg.norm(x, axis=0) * len(x)
36
+ if not usable.any():
37
+ raise ValueError("No feature varies within strata.")
38
+ features = residual[:, usable] / lengths[usable]
39
+ labels /= np.linalg.norm(labels)
40
+ rng = np.random.default_rng(seed)
41
+ statistics = np.empty((permutations + 1, 2))
42
+ # Bound temporary memory for wide omics matrices.
43
+ for start in range(0, len(statistics), 32):
44
+ count = min(32, len(statistics) - start)
45
+ draws = np.tile(labels, (count, 1))
46
+ first = int(start == 0) # row zero is always the observed arrangement
47
+ for row in draws[first:]:
48
+ for idx in blocks:
49
+ row[idx] = rng.permutation(labels[idx])
50
+ squared = (draws @ features) ** 2
51
+ statistics[start:start+count, 0] = squared.sum(axis=1)
52
+ statistics[start:start+count, 1] = squared.max(axis=1)
53
+ # Include the observation, treat ties conservatively, and rank each draw
54
+ # by its own best component to account for searching both components.
55
+ ranks = rankdata(-np.round(statistics, 12), axis=0, method="max")
56
+ best = ranks.min(axis=1)
57
+ return pd.Series({"dense_p": ranks[0, 0] / len(best), "sparse_p": ranks[0, 1] / len(best),
58
+ "omnibus_p": np.mean(best <= best[0])})
59
+
60
+
61
+ def feature_batch_tests(data, batch, protected=None):
62
+ """Partial F tests of all fixed batch coefficients, with BH across testable features."""
63
+ fit = fit_batch(data, batch, protected)
64
+ r2 = fit.features.partial_r2.to_numpy()
65
+ batch_df = len(fit.offsets) - 1
66
+ with np.errstate(divide="ignore", invalid="ignore"):
67
+ statistic = (r2 / (1 - r2)) * fit.residual_df / batch_df
68
+ p = f.sf(statistic, batch_df, fit.residual_df)
69
+ order = np.flatnonzero(np.isfinite(p))
70
+ order = order[np.argsort(p[order])]
71
+ adjusted = np.full(len(p), np.nan)
72
+ ranked = p[order] * len(order) / np.arange(1, len(order) + 1)
73
+ adjusted[order] = np.minimum(1, np.minimum.accumulate(ranked[::-1])[::-1])
74
+ return pd.DataFrame({"partial_r2": r2, "F": statistic, "p_value": p,
75
+ "bh_q": adjusted}, index=data.columns)
76
+
77
+
78
+ def silhouette(data, labels, *, chunk_size=256):
79
+ """Per-sample ordinary Euclidean silhouette in [-1,1], singleton score zero."""
80
+ x = _matrix(data)
81
+ codes, levels = pd.factorize(_labels(labels, data.index))
82
+ if not 1 < len(levels) < len(data) or not isinstance(chunk_size, int) or chunk_size < 1:
83
+ raise ValueError("Supply at least two groups, one replicated group, and positive chunk_size.")
84
+ masks = codes[:, None] == np.arange(len(levels))
85
+ counts = masks.sum(axis=0)
86
+ result = np.zeros(len(x))
87
+ for start in range(0, len(x), chunk_size):
88
+ idx = np.arange(start, min(start + chunk_size, len(x)))
89
+ distances = cdist(x[idx], x)
90
+ sums = distances @ masks
91
+ loc = (np.arange(len(idx)), codes[idx])
92
+ a = sums[loc] / np.maximum(1, counts[codes[idx]] - 1)
93
+ means = sums / counts
94
+ means[loc] = np.inf
95
+ b = means.min(axis=1)
96
+ denominator = np.maximum(a, b)
97
+ valid = (counts[codes[idx]] > 1) & (denominator > 0)
98
+ result[idx[valid]] = (b[valid] - a[valid]) / denominator[valid]
99
+ return pd.Series(result, index=data.index, name="silhouette")
100
+
101
+
102
+ def guided_pca(data, batch, *, permutations=999, seed=0):
103
+ """Centered, unscaled gPCA delta and Monte Carlo test with exchangeable samples."""
104
+ x = _matrix(data)
105
+ codes, levels = pd.factorize(_labels(batch, data.index))
106
+ if len(levels) < 2 or len(levels) == len(x):
107
+ raise ValueError("Supply replicated batches.")
108
+ if not isinstance(permutations, (int, np.integer)) or permutations < 1:
109
+ raise ValueError("permutations must be a positive integer.")
110
+ x = x - x.mean(axis=0)
111
+ largest = np.linalg.svd(x, compute_uv=False)[0] ** 2
112
+ if largest == 0:
113
+ raise ValueError("gPCA requires variation.")
114
+ indicators = codes[:, None] == np.arange(len(levels))
115
+
116
+ def delta(labels):
117
+ sums = labels.T @ x
118
+ if np.linalg.norm(sums) <= np.finfo(float).eps * np.sqrt(largest) * len(x):
119
+ return 0.0
120
+ loading = np.linalg.svd(sums, full_matrices=False)[2][0]
121
+ return np.sum((x @ loading) ** 2) / largest
122
+
123
+ observed = delta(indicators)
124
+ rng = np.random.default_rng(seed)
125
+ hits = sum(delta(rng.permutation(indicators)) >= observed - 1e-12 for _ in range(permutations))
126
+ return pd.Series({"delta": observed, "p_value": (1 + hits) / (1 + permutations)})
127
+
128
+
129
+ def pc_batch_share(data, batch, protected=None, *, retain=0.9, clip_mad=None):
130
+ """Batch shares in retained PCA scores; optional median/MAD winsorization.
131
+
132
+ Full-space, unclipped batch_share_total equals a variance-weighted PCR score
133
+ when batch is the sole predictor. The clipped variant is experimental GVA.
134
+ """
135
+ if not 0 < retain <= 1:
136
+ raise ValueError("retain must be in (0, 1].")
137
+ x = _matrix(data)
138
+ if clip_mad is not None:
139
+ if not np.isfinite(clip_mad) or clip_mad <= 0:
140
+ raise ValueError("clip_mad must be positive and finite.")
141
+ median = np.median(x, axis=0)
142
+ scale = 1.4826 * np.median(np.abs(x - median), axis=0)
143
+ # Features with zero MAD may contain genuine rare signals. Leave them unchanged.
144
+ width = np.where(scale > 0, clip_mad * scale, np.inf)
145
+ x = np.clip(x, median - width, median + width)
146
+ u, s, _ = np.linalg.svd(x - x.mean(axis=0), full_matrices=False)
147
+ power = s ** 2
148
+ if not power.sum():
149
+ raise ValueError("PCA requires variation.")
150
+ cumulative = np.cumsum(power) / power.sum()
151
+ k = min(len(s), np.searchsorted(cumulative, retain) + 1)
152
+ scores = pd.DataFrame(u[:, :k] * s[:k], index=data.index)
153
+ fit = fit_batch(scores, batch, protected)
154
+ return pd.concat([fit.global_scores, pd.Series({"retained_fraction": cumulative[k - 1],
155
+ "components": k})])
156
+
157
+
158
+ def qc_metrics(references, study):
159
+ """Feature-wise QC RSD (%) and D-ratio (%), using sample SD on positive-scale intensities."""
160
+ r, y = _matrix(references), _matrix(study)
161
+ if not references.columns.equals(study.columns) or min(len(r), len(y)) < 2:
162
+ raise ValueError("Supply matching features and at least two samples per set.")
163
+ if (r < 0).any() or (y < 0).any():
164
+ raise ValueError("Use nonnegative intensity-scale data.")
165
+ sd = r.std(axis=0, ddof=1)
166
+ def percent(denominator):
167
+ return np.divide(100 * sd, denominator, out=np.full_like(sd, np.nan), where=denominator > 0)
168
+ return pd.DataFrame({"qc_rsd_pct": percent(r.mean(axis=0)),
169
+ "d_ratio_pct": percent(y.std(axis=0, ddof=1))}, index=references.columns)
170
+
171
+
172
+ def reference_contrast(data, batch, reference_data, reference_batch, *, target, baseline,
173
+ protected=None):
174
+ """Experimental combination of study and common-reference contrasts by inverse variance.
175
+
176
+ Independent reference measurements and a transferable additive shift are required.
177
+ Returns competing estimates in assay units for the same target-minus-baseline contrast.
178
+ """
179
+ fit = fit_batch(data, batch, protected)
180
+ study = fit.batch_contrast(target, baseline)
181
+ x = _matrix(reference_data)
182
+ if not reference_data.columns.equals(data.columns):
183
+ raise ValueError("Reference features must match the study features in order.")
184
+ ref = _labels(reference_batch, reference_data.index)
185
+ a, b = x[ref.to_numpy() == target], x[ref.to_numpy() == baseline]
186
+ if min(len(a), len(b)) < 2:
187
+ raise ValueError("Each target/reference batch needs at least two reference measurements.")
188
+ reference = a.mean(axis=0) - b.mean(axis=0)
189
+ v_ref = a.var(axis=0, ddof=1) / len(a) + b.var(axis=0, ddof=1) / len(b)
190
+ v_study = study.standard_error.to_numpy() ** 2
191
+ total = v_ref + v_study
192
+ w = np.divide(v_study, total, out=np.full_like(total, 0.5), where=total > 0)
193
+ combined = (1 - w) * study.estimate + w * reference
194
+ return pd.DataFrame({"study": study.estimate, "reference_mean": reference,
195
+ "reference_median": np.median(a, axis=0) - np.median(b, axis=0),
196
+ "combined": combined, "reference_weight": w}, index=data.columns)
197
+
deepbatch/model.py ADDED
@@ -0,0 +1,190 @@
1
+ """Fixed-effects estimates for independent observations and additive batch shifts."""
2
+ from dataclasses import dataclass
3
+
4
+ import numpy as np
5
+ import pandas as pd
6
+ from scipy.stats import t
7
+
8
+
9
+ def _matrix(data, *, allow_missing=False):
10
+ if not isinstance(data, pd.DataFrame) or data.empty:
11
+ raise ValueError("Supply a nonempty samples-by-features DataFrame.")
12
+ for axis in (data.index, data.columns):
13
+ if not axis.is_unique or axis.hasnans:
14
+ raise ValueError("Sample and feature identifiers must be unique and observed.")
15
+ values = data.to_numpy(dtype=float, na_value=np.nan)
16
+ if np.isinf(values).any() or (not allow_missing and np.isnan(values).any()):
17
+ raise ValueError("Check for missing or infinite measurements.")
18
+ return values
19
+
20
+
21
+ def _align(obj, index):
22
+ if not isinstance(obj, (pd.Series, pd.DataFrame)) or not obj.index.is_unique:
23
+ raise ValueError("Supply uniquely sample-indexed metadata.")
24
+ if len(obj) != len(index) or not index.isin(obj.index).all():
25
+ raise ValueError("Sample identifiers in the matrix and metadata must match.")
26
+ obj = obj.reindex(index)
27
+ if obj.isna().to_numpy().any():
28
+ raise ValueError("Metadata contains missing values.")
29
+ return obj
30
+
31
+
32
+ def _labels(series, index):
33
+ if not isinstance(series, pd.Series):
34
+ raise ValueError("Supply labels as a sample-indexed Series.")
35
+ return _align(series, index)
36
+
37
+
38
+ @dataclass
39
+ class BatchFit:
40
+ features: pd.DataFrame
41
+ global_scores: pd.Series
42
+ offsets: pd.DataFrame
43
+ residual_df: int
44
+ condition_number: float
45
+ _batch: pd.Series
46
+ _batch_cov: np.ndarray
47
+ _noise: np.ndarray
48
+
49
+ def correct(self, data, batch):
50
+ """Subtract fitted shifts on the original analysis scale for known batches."""
51
+ return _subtract(data, batch, self.offsets)
52
+
53
+ def batch_contrast(self, batch, reference, confidence=0.95):
54
+ """Adjusted batch minus reference, with pointwise model-based t intervals."""
55
+ if batch == reference or not 0 < confidence < 1:
56
+ raise ValueError("Specify distinct batches and confidence between zero and one.")
57
+ levels = self.offsets.index
58
+ if batch not in levels or reference not in levels:
59
+ raise ValueError("Both batch labels must occur in the fitted samples.")
60
+ weights = np.zeros(len(levels))
61
+ weights[levels.get_loc(batch)] = 1
62
+ weights[levels.get_loc(reference)] = -1
63
+ return self._linear_contrast(weights, confidence)
64
+
65
+ def contrast_distortion(self, group, *, case, control, confidence=0.95):
66
+ """Estimated technical contribution to an unadjusted case-minus-control mean."""
67
+ if case == control or not 0 < confidence < 1:
68
+ raise ValueError("Specify distinct groups and confidence between zero and one.")
69
+ groups = _labels(group, self._batch.index)
70
+ if case not in groups.values or control not in groups.values:
71
+ raise ValueError("Both contrast groups must occur in the fitted samples.")
72
+ def fractions(label):
73
+ return (self._batch[groups == label].value_counts(normalize=True)
74
+ .reindex(self.offsets.index, fill_value=0).to_numpy())
75
+ weights = fractions(case) - fractions(control)
76
+ result = self._linear_contrast(weights, confidence)
77
+ return result.drop(columns="standard_error").rename(columns={"estimate": "distortion"})
78
+
79
+ def _linear_contrast(self, weights, confidence):
80
+ estimate = weights @ self.offsets.to_numpy()
81
+ w = weights[1:] # the first batch is the reference in the fitted design
82
+ se = np.sqrt(max(0.0, w @ self._batch_cov @ w) * self._noise)
83
+ margin = t.ppf((1 + confidence) / 2, self.residual_df) * se
84
+ return pd.DataFrame({"estimate": estimate, "standard_error": se, "lower": estimate - margin,
85
+ "upper": estimate + margin}, index=self.offsets.columns)
86
+
87
+
88
+ def _subtract(data, batch, offsets):
89
+ values = _matrix(data)
90
+ labels = _labels(batch, data.index)
91
+ if not data.columns.equals(offsets.columns):
92
+ raise ValueError("Feature names and order must match calibration.")
93
+ if not labels.isin(offsets.index).all():
94
+ raise ValueError("No calibration for one or more batches.")
95
+ corrected = values - offsets.loc[labels.tolist()].to_numpy()
96
+ return pd.DataFrame(corrected, index=data.index, columns=data.columns)
97
+
98
+
99
+ def fit_batch(data, batch, protected=None):
100
+ """Fit a shared design across features. Numeric covariates are continuous;
101
+ string/category covariates are treatment-coded. Include the biological group
102
+ in protected when estimating distortion of a group comparison.
103
+ """
104
+ y = _matrix(data)
105
+ batch = _labels(batch, data.index).copy()
106
+ codes, levels = pd.factorize(batch, sort=False)
107
+ if len(levels) < 2:
108
+ raise ValueError("At least two observed batches are required.")
109
+ reduced = np.ones((len(data), 1))
110
+ if protected is not None:
111
+ if not isinstance(protected, pd.DataFrame) or not protected.columns.is_unique:
112
+ raise ValueError("protected must be a DataFrame with unique column names.")
113
+ cov = _align(protected, data.index)
114
+ encoded = pd.get_dummies(cov, drop_first=True, dtype=float)
115
+ reduced = np.column_stack((reduced, encoded.to_numpy(dtype=float)))
116
+ indicators = (codes[:, None] == np.arange(1, len(levels))).astype(float)
117
+ design = np.column_stack((reduced, indicators))
118
+ if not np.isfinite(design).all():
119
+ raise ValueError("Design contains nonfinite covariates.")
120
+ q, r = np.linalg.qr(design, mode="reduced")
121
+ singular_values = np.linalg.svd(r, compute_uv=False)
122
+ tolerance = max(design.shape) * np.finfo(float).eps * singular_values[0]
123
+ if np.count_nonzero(singular_values > tolerance) < design.shape[1]:
124
+ raise ValueError("Design is rank deficient or nonfinite; check confounding and redundant covariates.")
125
+ df = len(data) - design.shape[1]
126
+ if df < 1:
127
+ raise ValueError("Insufficient residual degrees of freedom.")
128
+ y = y - y.mean(axis=0)
129
+ y[:, np.ptp(data.to_numpy(dtype=float), axis=0) == 0] = 0
130
+ scores = q.T @ y
131
+ k = reduced.shape[1]
132
+ # The first k orthonormal columns span the protected design.
133
+ extra = np.sum(scores[k:] ** 2, axis=0)
134
+ residual = np.sum((y - q @ scores) ** 2, axis=0)
135
+ total = np.sum(y ** 2, axis=0)
136
+ remaining = residual + extra
137
+ partial = np.divide(extra, remaining, out=np.full_like(extra, np.nan),
138
+ where=(remaining > np.finfo(float).eps * total))
139
+ features = pd.DataFrame({"partial_r2": partial,
140
+ "adjusted_partial_r2": 1 - (1 - partial) * (len(y) - k) / df},
141
+ index=data.columns)
142
+ total_ss = total.sum()
143
+ remaining_ss = remaining.sum()
144
+ share_remaining = adjusted_remaining = np.nan
145
+ if remaining_ss > np.finfo(float).eps * total_ss:
146
+ share_remaining = extra.sum() / remaining_ss
147
+ adjusted_remaining = 1 - (residual.sum() / df) / (remaining_ss / (len(y) - k))
148
+ global_scores = pd.Series({
149
+ "batch_share_total": extra.sum() / total_ss if total_ss > 0 else np.nan,
150
+ "batch_share_remaining": share_remaining,
151
+ "adjusted_batch_share_remaining": adjusted_remaining,
152
+ })
153
+ coef = np.linalg.solve(r, scores)
154
+ offsets = np.vstack((np.zeros(data.shape[1]), coef[k:]))
155
+ offsets -= np.average(offsets, axis=0, weights=np.bincount(codes))
156
+ inv_r = np.linalg.solve(r, np.eye(len(r)))
157
+ return BatchFit(features, global_scores, pd.DataFrame(offsets, index=levels, columns=data.columns),
158
+ df, float(singular_values[0] / singular_values[-1]), batch,
159
+ inv_r[k:] @ inv_r[k:].T, residual / df)
160
+
161
+
162
+ def reference_correct(data, batch, references, reference_batch):
163
+ """Align batches to the equally weighted mean of common-material batch means.
164
+
165
+ references must measure the same reference material in every target batch.
166
+ The reference response must transfer to study samples on the supplied scale.
167
+ """
168
+ _matrix(references)
169
+ labels = _labels(reference_batch, references.index)
170
+ means = references.groupby(labels, observed=True, sort=False).mean()
171
+ if len(means) < 2:
172
+ raise ValueError("At least two reference batches are required.")
173
+ return _subtract(data, batch, means - means.mean(axis=0))
174
+
175
+
176
+ def reference_dispersion(references, reference_batch):
177
+ """RMS Euclidean spread of replicate references around each batch mean.
178
+
179
+ Uses n-1 degrees of freedom. Supply the same material and feature scales
180
+ across batches. Singleton batches have undefined spread.
181
+ """
182
+ x = _matrix(references)
183
+ labels = _labels(reference_batch, references.index)
184
+ groups = pd.DataFrame(x, index=references.index).groupby(labels, observed=True, sort=False)
185
+ centered = x - groups.transform("mean").to_numpy()
186
+ squared = pd.Series(np.sum(centered ** 2, axis=1), index=references.index)
187
+ summary = squared.groupby(labels, observed=True, sort=False).agg(["size", "sum"])
188
+ return pd.DataFrame({"n": summary["size"], "rms_distance":
189
+ np.sqrt(summary["sum"] / (summary["size"] - 1).replace(0, np.nan))})
190
+
deepbatch/upstream.py ADDED
@@ -0,0 +1,88 @@
1
+ """Python interfaces to established R and single-cell evaluation implementations."""
2
+ from pathlib import Path
3
+ import subprocess
4
+ import tempfile
5
+
6
+ import numpy as np
7
+ import pandas as pd
8
+
9
+ from .model import _align, _labels, _matrix
10
+
11
+
12
+ def r_evaluation(data, batch, *, method, protected=None, blocks=None, permutations=999,
13
+ retain=0.6, seed=0, rscript="Rscript"):
14
+ """Run vegan permanova/permdisp, Bioconductor pvca, or variancePartition.
15
+
16
+ Rows are independent samples unless a valid permutation block is supplied.
17
+ For PVCA and variancePartition, all categorical columns are random factors.
18
+ PVCA applies upstream VSN internally and requires at least two design factors.
19
+ """
20
+ if method not in {"permanova", "permdisp", "pvca", "variancePartition"}:
21
+ raise ValueError("Unknown R evaluation method.")
22
+ values = _matrix(data)
23
+ if not isinstance(permutations, (int, np.integer)) or permutations < 1 or not 0 < retain <= 1:
24
+ raise ValueError("Check permutations and retain.")
25
+ b = _labels(batch, data.index)
26
+ if b.nunique() < 2:
27
+ raise ValueError("Supply at least two observed batches.")
28
+ meta = pd.DataFrame({"Batch": pd.factorize(b)[0]}, index=data.index)
29
+ factor_names = ["Batch"]
30
+ names = {}
31
+ if protected is not None:
32
+ if not isinstance(protected, pd.DataFrame) or not protected.columns.is_unique:
33
+ raise ValueError("protected must have uniquely named columns.")
34
+ for i, (name, col) in enumerate(_align(protected, data.index).items()):
35
+ key = f"P{i}"
36
+ names[key] = str(name)
37
+ if method == "pvca" or not pd.api.types.is_numeric_dtype(col) or pd.api.types.is_bool_dtype(col):
38
+ meta[key] = pd.factorize(col)[0]
39
+ factor_names.append(key)
40
+ else:
41
+ meta[key] = col.to_numpy(dtype=float)
42
+ if method == "permdisp" and names:
43
+ raise ValueError("PERMDISP compares unadjusted within-batch spreads; omit protected.")
44
+ if method == "pvca" and not names:
45
+ raise ValueError("Upstream PVCA requires a second categorical factor.")
46
+ if blocks is not None:
47
+ if method not in {"permanova", "permdisp"}:
48
+ raise ValueError("Permutation blocks apply to vegan methods.")
49
+ meta["Block"] = pd.factorize(_labels(blocks, data.index))[0]
50
+ if meta.groupby("Block").Batch.nunique().max() < 2:
51
+ raise ValueError("No within-block batch exchanges are possible.")
52
+ with tempfile.TemporaryDirectory() as directory:
53
+ path = Path(directory)
54
+ pd.DataFrame(values).to_csv(path / "x.csv", header=False, index=False)
55
+ meta.to_csv(path / "meta.csv", index=False)
56
+ command = [str(rscript), "--vanilla", str(Path(__file__).with_name("evaluate.R")),
57
+ method, str(permutations), str(retain), str(seed), ",".join(factor_names)]
58
+ try:
59
+ run = subprocess.run(command, cwd=path, capture_output=True, text=True)
60
+ except FileNotFoundError as exc:
61
+ raise RuntimeError("Install R or pass rscript= with the Rscript executable path.") from exc
62
+ if run.returncode:
63
+ raise RuntimeError(run.stderr.strip() or run.stdout.strip())
64
+ result = pd.read_csv(path / "result.csv", index_col=0)
65
+ def translate(term):
66
+ return ":".join(names.get(x, x) for x in str(term).split(":"))
67
+ if method == "variancePartition":
68
+ result.index = data.columns
69
+ result.columns = [translate(c) for c in result.columns]
70
+ else:
71
+ result.index = [translate(x) for x in result.index]
72
+ result.attrs["diagnostics"] = run.stderr.strip()
73
+ return result
74
+
75
+
76
+ def single_cell_evaluation(adata, *, batch_key, label_key, embeddings, **options):
77
+ """Run scib-metrics on AnnData embeddings. Forward options to Benchmarker."""
78
+ try:
79
+ from scib_metrics.benchmark import Benchmarker
80
+ except ImportError as exc:
81
+ raise ImportError("Install deepbatch[singlecell] to run scib-metrics.") from exc
82
+ if isinstance(embeddings, str) or not embeddings:
83
+ raise ValueError("Supply a sequence of AnnData.obsm embedding keys.")
84
+ bench = Benchmarker(adata, batch_key=batch_key, label_key=label_key,
85
+ embedding_obsm_keys=list(embeddings), **options)
86
+ bench.benchmark()
87
+ return bench.get_results(min_max_scale=False)
88
+
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: deepbatch
3
+ Version: 0.2.0
4
+ Summary: Measure batch effects and their impact on biological contrasts across molecular assays
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: numpy>=1.24
8
+ Requires-Dist: pandas>=2.0
9
+ Requires-Dist: scipy>=1.10
10
+ Provides-Extra: singlecell
11
+ Requires-Dist: scib-metrics<0.7,>=0.6.2; extra == "singlecell"
12
+ Requires-Dist: umap-learn==0.5.9.post2; extra == "singlecell"
13
+
14
+ # DeepBatch
15
+
16
+ DeepBatch 0.2.0 measures batch effects across molecular assays and corrects additive shifts. Rows are samples and columns are features. The core model fits independent observations on a continuous analysis scale.
17
+
18
+ ## Install locally
19
+
20
+ From this directory, run `python -m pip install .`. Python 3.10+ is required.
21
+
22
+ ## Measure, correct, and estimate contrast distortion
23
+
24
+ ```python
25
+ import numpy as np
26
+ import pandas as pd
27
+ from deepbatch import fit_batch
28
+
29
+ rng = np.random.default_rng(42)
30
+ samples = pd.Index([f"s{i}" for i in range(12)])
31
+ group = pd.Series(["control"] * 6 + ["case"] * 6, index=samples, name="group")
32
+ batch = pd.Series(list("AAAABB") + list("AABBBB"), index=samples)
33
+ data = pd.DataFrame(rng.normal(size=(12, 3)), index=samples, columns=["f1", "f2", "f3"])
34
+ data["f1"] += 0.8 * batch.eq("B") + 0.5 * group.eq("case")
35
+
36
+ fit = fit_batch(data, batch, protected=group.to_frame())
37
+ print(fit.global_scores)
38
+ print(fit.features.partial_r2.describe())
39
+ print(fit.features.join(fit.batch_contrast("B", "A")).sort_values("partial_r2", ascending=False))
40
+ print(fit.contrast_distortion(group, case="case", control="control"))
41
+ adjusted = fit.correct(data, batch)
42
+ ```
43
+
44
+ The model includes an intercept, protected covariates, and fixed batch effects. Encode categorical covariates as strings or pandas categories. Numeric covariates enter as continuous predictors. Metadata aligns by sample ID. A rank-deficient design raises an error. The condition number and residual degrees of freedom are available on the fit. Use numeric covariate scales appropriate for interpreting the condition number.
45
+
46
+ - `batch_share_total` divides the additional sum of squares for batch by the total centered sum of squares across features. `batch_share_remaining` uses the residual sum of squares after protecting biology as its denominator. Feature scaling affects both global scores.
47
+ - `partial_r2` and its degrees-of-freedom-adjusted counterpart describe individual features. Undefined fractions are NaN. Adjusted estimates can be negative.
48
+ - `adjusted_batch_share_remaining` compares the pooled residual mean squares of the full and protected models. Negative values are retained. All three global scores pool sums of squares across the supplied features. Features with more variation carry more weight. For equal scale across features, standardize explicitly before fitting and interpret contrasts on that standardized scale.
49
+ - `batch_contrast("B", "A")` returns the adjusted B-minus-A difference, standard error and pointwise t interval for each feature. On log2 intensities, an estimate of 1 represents a twofold difference. The model assumes an additive common shift across biological groups. Intervals assume independent samples and approximately Gaussian, equal-variance residuals within each feature. In study samples, a difference conditional on measured biology can still reflect unmeasured biology.
50
+ - `correct` subtracts fitted batch shifts centered at the training sample-weighted mean. It accepts new samples from known batches with the same ordered feature panel. Correction returns analysis-scale data. Use the original measurements and an appropriate joint model for downstream inference.
51
+ - `contrast_distortion` predicts the signed batch contribution to a case-minus-control arithmetic mean difference on the analysis scale. Include the group in the protected design. Its pointwise t intervals assume independent, homoscedastic Gaussian errors per feature, fixed group allocations, and a common additive batch effect. They do not account for selecting a correction on these same observations.
52
+
53
+ ## Other assays and study designs
54
+
55
+ ### Evaluation methods
56
+
57
+ | Scientific question | Python interface | Interpretation |
58
+ |---|---|---|
59
+ | Does a candidate batch partition align with the measurements? | `guided_pca(data, batch)` | First guided-to-unguided PC variance ratio and a Monte Carlo permutation p-value. Requires exchangeable samples. The native implementation centers the data and uses unscaled batch indicators. |
60
+ | Which features differ after protecting biology? | `feature_batch_tests(data, batch, protected)` | Partial F test across observed batches for each feature, with Benjamini–Hochberg adjustment across testable features. Assumes independent Gaussian observations with constant residual variance per feature. |
61
+ | How much variation in a PCA representation is associated with batch? | `pc_batch_share(data, batch, protected, retain=0.9)` | Reports the retained fraction and component count alongside raw and adjusted fixed-effects shares in that subspace. With all PCs and batch as sole predictor the total share gives the ordinary variance-weighted PCR score. |
62
+ | Is there global batch separation or unequal spread? | `r_evaluation(data, batch, method="permanova", protected=metadata)` or `method="permdisp"` | Upstream vegan marginal Euclidean PERMANOVA and spatial-median PERMDISP with small-sample adjustment. PERMDISP takes unadjusted groups. Optional `blocks=` restricts exchanges to the specified blocks when valid for the design. |
63
+ | How much variance is associated with random factors? | `r_evaluation(..., method="pvca", protected=factors)` or `method="variancePartition"` | Upstream Bioconductor PVCA uses internal VSN, categorical factors and retained-PC attribution. Supply intensities suitable for VSN. variancePartition returns per-feature fractions on the supplied scale. Encode categorical covariates as strings/categories and quantitative covariates as numeric for variancePartition. |
64
+ | Are samples separated or QCs imprecise? | `silhouette(data, labels)`, `qc_metrics(references, study)` | Per-sample ordinary silhouette; feature-level QC RSD and D-ratio from classical sample SDs. QC RSD requires intensities on a ratio scale. Use comparable sample material for interpreting technical dispersion. |
65
+ | Does an integrated single-cell embedding mix batches and preserve biology? | `single_cell_evaluation(adata, batch_key="batch", label_key="cell_type", embeddings=["integrated"])` | Runs the upstream scIB-metrics Benchmarker. Includes local batch mixing (iLISI, kBET), graph connectivity, PCR comparison, label silhouette, cLISI and clustering agreement (ARI/NMI). Results retain upstream score transformations; across-embedding min–max scaling is disabled. Pass a pre-integration embedding with `pre_integrated_embedding_obsm_key=` when available. |
66
+
67
+ Use `python -m pip install ".[singlecell]"` for the AnnData interface. Its dependency set uses the UMAP version tested with the graph metrics. For the R interface, install R and the packages for the desired methods. In R, use `install.packages("vegan")` or `BiocManager::install(c("pvca", "variancePartition"))`. Supply `rscript=` when Rscript is outside PATH. Backend warnings are available in the returned DataFrame's `attrs["diagnostics"]`.
68
+
69
+ Method references: [guided PCA](https://academic.oup.com/bioinformatics/article/29/22/2877/313226), [PERMANOVA](https://vegandevs.github.io/vegan/reference/adonis.html), [PERMDISP](https://vegandevs.github.io/vegan/reference/betadisper.html), [PVCA](https://bioconductor.org/packages/pvca), [variancePartition](https://bioconductor.org/packages/variancePartition), [scIB-metrics](https://scib-metrics.readthedocs.io/en/stable/api.html).
70
+
71
+ ### Experimental estimators and benchmarks
72
+
73
+ For independent samples in two observed batches, `adaptive_location_test(data, batch, strata=group)` combines a sum and a maximum of squared within-stratum batch correlations to detect widespread and localized intensity shifts. Use categorical strata within which batch assignments are exchangeable, with both batches observed in each stratum. The function returns the two component p-values and a permutation-calibrated `omnibus_p` for the joint screen. Use a prespecified effect estimator such as `fit_batch` to quantify shifts and intervals on the relevant assay scale. The permutation test assumes exchangeability of the joint measurements under the null; unequal residual distributions can invalidate a mean-only interpretation.
74
+
75
+ Run `python examples/adaptive_detection.py` to reproduce the [two-batch pilot](examples/adaptive_detection_results.csv). Its 95% Wilson intervals quantify simulation uncertainty under the specific data-generating designs.
76
+
77
+ - `pc_batch_share(data, batch, protected, clip_mad=3)` clips each feature at its median ±3 scaled median absolute deviations before PCA. This experimental GVA variant uses adjusted fixed-effects shares in the retained representation. Its benchmark asks how well that representation estimates a known clean full-space target under outliers.
78
+ - `reference_contrast(data, batch, references, reference_batch, target="B", baseline="A", protected=metadata)` reports study-only, reference-mean, reference-median and inverse-variance-combined estimates of the signed B-minus-A shift. The combined estimate assumes independent study and reference errors and a transferable technical shift. Estimated weights are feature-specific. This is an experimental use of standard inverse-variance weighting.
79
+ - Run `python examples/evaluation_suite.py` for clean, contaminated, mismatched-reference and null simulations. Add `--waves <export-directory>` to resample whole, standardized within-export reference residuals with a known injected shift. Run `python examples/evaluation_suite.py --detection` for an independent detection benchmark. Each scenario uses 200 simulation replicates with seed 2026. Compare RMSE within a target only. Monte Carlo SEs describe simulation uncertainty.
80
+
81
+ Full results: [estimation RMSE](examples/evaluation_results.csv) and [detection rates](examples/detection_results.csv). In the contamination scenario the clipped PC score reduced RMSE for clean variance share from 0.119 to 0.073 relative to ordinary retained PCs. In clean data, full-space adjusted regression achieved 0.011 versus 0.028 for clipped PCs. Combining reference and study shifts improved clean-data RMSE from 0.256 to 0.221, but reference mismatch increased it from 0.259 to 0.328. These scenarios support conditional method choices.
82
+
83
+ ### Assay inputs
84
+
85
+ | Input | Function and scope |
86
+ |---|---|
87
+ | Metabolomics or proteomics | Supply consistently transformed intensities, e.g. log2. Use an explicit detection mask with `detection_rates(mask, batch)` to quantify missing detections separately. |
88
+ | RNA, ATAC-seq or histone peak counts | Use `log_cpm(counts, library_size=totals)` for a log-scale exploratory analysis. Count columns must represent the same genes or regions for every sample. Total-count scaling assumes comparable composition. |
89
+ | Methylation | `methylation_log_odds(methylated, coverage)` computes log2 odds with a pseudocount. Zero coverage remains missing. Filter on coverage and use a common observed panel for the matrix fit. The fit gives observations equal weight. |
90
+ | ATAC or histone peak intervals | `peak_jaccard(left, right)` reports base-pair overlap divided by union on a common genome build using BED-style DataFrames. Compare technical replicates to study peak reproducibility. |
91
+ | Shared references across batches | `reference_correct(data, batch, references, reference_batch)` uses offsets from a common material independently of biological labels. `reference_dispersion(references, reference_batch)` estimates the root sum of feature variances in each batch. Use separate reference replicates to evaluate correction. |
92
+
93
+ The matrix fit requires finite dense data. This release provides transformed-scale diagnostics for count and methylation assays. Native count likelihoods, coverage-weighted models, subject random effects, drift correction and sparse single-cell matrices are outside this version's implemented scope.
94
+
95
+ ## Reproduce the pilot
96
+
97
+ ### Batch magnitude
98
+
99
+ Run `python examples/batch_magnitude.py` for a CSV of bias, RMSE, pointwise interval coverage, sparse-feature recovery and Monte Carlo standard errors. Each scenario has 200 independent simulations. Known truth uses the variance of the injected shifts after removing the true within-group means, on a population sampled uniformly over the designed rows with unit noise variance per feature. The total denominator includes biological signal, technical signal, their covariance and noise. The remaining denominator includes unique technical signal and noise.
100
+
101
+ The [recorded results](examples/batch_magnitude_results.csv) cover 32 scenarios (seed 2026). With 120 samples, 100 features, 80% of cases and 20% of controls in batch B, and zero true batch shift, raw remaining-share bias was 0.00846 (Monte Carlo SE 0.000086). Adjusted bias was −0.000013 (SE 0.000087). In the same design with five shifted features, ranking by partial R² recovered 98.5% of them among the top five (SE 0.37 percentage points). At 40 samples, recovery fell to 68.5% (SE 1.24 points). These simulations use independent Gaussian errors and additive shifts.
102
+
103
+ Run `python examples/batch_magnitude.py --scaling` for median fit time over three runs and peak traced allocations during fitting. On the development machine with one BLAS thread, 200 × 100, 1,000 × 100, 1,000 × 1,000 and 2,000 × 2,000 matrices took 0.002, 0.003, 0.015 and 0.071 seconds and peaked at 0.55, 2.48, 23.11 and 91.94 MiB, respectively. Tracing starts after input creation and excludes untraced native memory.
104
+
105
+ ### Contrast distortion
106
+
107
+ Run `python examples/benchmark.py` after installation. It simulates paired clean and batch-affected matrices, holds the biology and noise fixed, varies batch imbalance, and scores predicted distortion and corrected group differences against the hidden clean contrast. In this particular additive fit the last two estimation errors have the same magnitude by construction. This pilot exercises the estimator under its assumptions. Independent reference materials and additional noise models are needed to evaluate transfer across assays.
108
+
109
+ Run `python -m unittest discover -s tests -v` to check numerical and input-handling behavior.
110
+
@@ -0,0 +1,10 @@
1
+ deepbatch/__init__.py,sha256=7NbO6YJH-2yrUHBktbfa4aGTywEt98Stbw9M86CEr5Y,831
2
+ deepbatch/assays.py,sha256=ROWyyWTHflBBO24orzX8X2BSReqe2rHw3w2NJHq0OB4,4003
3
+ deepbatch/evaluate.R,sha256=RmQKFRa_o9cysYS6v4HNG3ksgqt1eo0rY3TuW-cQ-OY,2088
4
+ deepbatch/evaluation.py,sha256=IFkky1lk5niNzanP04DSxpC-E4c0mtQG7VwOy2LCqa4,9962
5
+ deepbatch/model.py,sha256=m564tuJnaZn9fIQR4_-jA_OanIFx_fk2HmO7pVGvAQE,9233
6
+ deepbatch/upstream.py,sha256=wKJfufq21Q21vFmXLXZKmE0kuoWGPVIxzA16D_rPi7o,4368
7
+ deepbatch-0.2.0.dist-info/METADATA,sha256=xeFVTFC9xBQHolQ5eFt2nhrVjvl2D5vVETLBL2PSSXc,14526
8
+ deepbatch-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
9
+ deepbatch-0.2.0.dist-info/top_level.txt,sha256=yBiF98b6so_Dz6UUjnbGfvSoNgzlD_q-nmxbtF6Hn_U,10
10
+ deepbatch-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ deepbatch