Darren Cusanovich commited on
Commit
7edc0cc
·
1 Parent(s): 1d549a5

t push origin mainInitial SeqTypeAI deployment

Browse files
.DS_Store ADDED
Binary file (10.2 kB). View file
 
DEPLOY.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SeqTypeAI — HuggingFace Spaces Deployment
2
+
3
+ ## Repository layout
4
+
5
+ ```
6
+ seqtypeai-spaces/
7
+ ├── app.py ← FastAPI backend (this session)
8
+ ├── Dockerfile
9
+ ├── requirements.txt
10
+ ├── README.md ← HF Spaces metadata in front matter
11
+ ├── static/
12
+ │ └── index.html ← Production frontend
13
+ └── app/
14
+ ├── core/
15
+ │ └── feature_extractor.py ← copy from your local repo
16
+ └── models/
17
+ ├── seqtype_classifier.joblib
18
+ ├── label_encoder.joblib
19
+ ├── feature_names.json
20
+ ├── model_meta.json
21
+ └── quality_norm.json ← optional
22
+ ```
23
+
24
+ ## Steps
25
+
26
+ ### 1. Copy your trained model artifacts
27
+
28
+ After your HPC run completes:
29
+
30
+ ```bash
31
+ cp app/models/seqtype_classifier.joblib seqtypeai-spaces/app/models/
32
+ cp app/models/label_encoder.joblib seqtypeai-spaces/app/models/
33
+ cp app/models/feature_names.json seqtypeai-spaces/app/models/
34
+ cp app/models/model_meta.json seqtypeai-spaces/app/models/
35
+ cp app/core/feature_extractor.py seqtypeai-spaces/app/core/
36
+ ```
37
+
38
+ ### 2. Create a HuggingFace Space
39
+
40
+ 1. Go to https://huggingface.co/new-space
41
+ 2. Name: `seqtypeai` (or `cusanovich-lab/seqtypeai`)
42
+ 3. SDK: **Docker**
43
+ 4. Visibility: Public (for community) or Private (for lab use)
44
+ 5. Click "Create Space"
45
+
46
+ ### 3. Push the repository
47
+
48
+ ```bash
49
+ cd seqtypeai-spaces
50
+ git init
51
+ git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/seqtypeai
52
+ git add .
53
+ git commit -m "Initial SeqTypeAI deployment"
54
+ git push origin main
55
+ ```
56
+
57
+ HuggingFace will automatically build the Docker image and start the app.
58
+ The URL will be: `https://YOUR_USERNAME-seqtypeai.hf.space`
59
+
60
+ ### 4. Verify
61
+
62
+ ```bash
63
+ # Health check
64
+ curl https://YOUR_USERNAME-seqtypeai.hf.space/health
65
+
66
+ # Classify a FASTQ
67
+ curl -X POST https://YOUR_USERNAME-seqtypeai.hf.space/classify \
68
+ -F "file=@sample.fastq.gz" | python -m json.tool
69
+ ```
70
+
71
+ ## API reference
72
+
73
+ ### POST /classify
74
+
75
+ Upload a FASTQ file, receive ranked predictions.
76
+
77
+ **Request:** `multipart/form-data` with `file` field
78
+ **Response:**
79
+
80
+ ```json
81
+ {
82
+ "filename": "sample.fastq.gz",
83
+ "top_assay": "atac_seq",
84
+ "top_label": "Bulk ATAC-seq",
85
+ "confidence": 0.94,
86
+ "predictions": [
87
+ {"assay": "atac_seq", "label": "Bulk ATAC-seq", "confidence": 0.94, "evidence": ""},
88
+ ...
89
+ ],
90
+ "features": {
91
+ "rl_mean": 51.3,
92
+ "gc_mean": 0.487,
93
+ "tn5_start_approx": 0.534,
94
+ ...
95
+ },
96
+ "qc_checks": [
97
+ {"label": "Tn5 insertion bias", "status": "good", "value": 0.534, "desc": "..."},
98
+ ...
99
+ ],
100
+ "qc_overall": "good",
101
+ "reasoning": "Top prediction is Bulk ATAC-seq (94% confidence). AT-rich read starts indicate Tn5 insertion bias.",
102
+ "model_version": "1.0"
103
+ }
104
+ ```
105
+
106
+ ### GET /health
107
+
108
+ Returns model load status, version, number of features and classes.
109
+
110
+ ## Notes
111
+
112
+ - The `/classify` endpoint uses your actual `HistGradientBoostingClassifier` model
113
+ - If `feature_extractor.py` is present, the server uses it directly — identical features to training
114
+ - If `feature_extractor.py` is missing, a lightweight fallback extractor runs (same features as the browser demo)
115
+ - The chatbot in the production frontend calls the Anthropic API directly from the browser — no API key is stored server-side
116
+ - HuggingFace free tier has a 16 GB RAM limit and 2 vCPU; the model loads in < 1 second and inference is fast (~50ms per file)
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # system deps
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ build-essential gcc && \
8
+ rm -rf /var/lib/apt/lists/*
9
+
10
+ # python deps
11
+ COPY requirements.txt .
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
+
14
+ # app code
15
+ COPY app.py .
16
+ COPY app/ app/
17
+ COPY static/ static/
18
+
19
+ # HuggingFace Spaces runs as non-root
20
+ RUN useradd -m -u 1000 user
21
+ USER user
22
+
23
+ EXPOSE 7860
24
+
25
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ SeqTypeAI — FastAPI backend for HuggingFace Spaces deployment.
3
+
4
+ Directory layout expected:
5
+ app/
6
+ core/
7
+ feature_extractor.py <- your existing extractor
8
+ models/
9
+ seqtype_classifier.joblib
10
+ label_encoder.joblib
11
+ feature_names.json
12
+ model_meta.json
13
+ quality_norm.json <- optional, for QC z-scores
14
+ app.py <- this file
15
+ static/
16
+ index.html <- built React frontend
17
+
18
+ Run locally:
19
+ uvicorn app:app --reload --port 7860
20
+ """
21
+
22
+ import io
23
+ import gzip
24
+ import json
25
+ import tempfile
26
+ import logging
27
+ from pathlib import Path
28
+ from typing import Optional
29
+
30
+ import joblib
31
+ import numpy as np
32
+ import pandas as pd
33
+ from fastapi import FastAPI, File, UploadFile, HTTPException
34
+ from fastapi.responses import HTMLResponse, JSONResponse
35
+ from fastapi.staticfiles import StaticFiles
36
+ from pydantic import BaseModel
37
+
38
+ # ── paths ─────────────────────────────────────────────────────────────────────
39
+ ROOT = Path(__file__).parent
40
+ MODEL_DIR = ROOT / "app" / "models"
41
+ STATIC_DIR = ROOT / "static"
42
+
43
+ # ── logging ───────────────────────────────────────────────────────────────────
44
+ logging.basicConfig(level=logging.INFO)
45
+ log = logging.getLogger("seqtypeai")
46
+
47
+ # ── load model artifacts ──────────────────────────────────────────────────────
48
+ try:
49
+ clf = joblib.load(MODEL_DIR / "seqtype_classifier.joblib")
50
+ le = joblib.load(MODEL_DIR / "label_encoder.joblib")
51
+ feature_names = json.loads((MODEL_DIR / "feature_names.json").read_text())
52
+ model_meta = json.loads((MODEL_DIR / "model_meta.json").read_text())
53
+ log.info("Model loaded — %d classes, %d features",
54
+ len(le.classes_), len(feature_names))
55
+ except Exception as exc:
56
+ log.error("Failed to load model artifacts: %s", exc)
57
+ clf = le = feature_names = model_meta = None
58
+
59
+ # optional: per-assay QC thresholds derived from training data
60
+ try:
61
+ quality_norm = json.loads((MODEL_DIR / "quality_norm.json").read_text())
62
+ except Exception:
63
+ quality_norm = {}
64
+
65
+ # ── feature extractor ─────────────────────────────────────────────────────────
66
+ # Import your existing extractor so browser and server use identical features.
67
+ import sys
68
+ sys.path.insert(0, str(ROOT / "app" / "core"))
69
+ try:
70
+ from feature_extractor import FeatureExtractor
71
+ extractor = FeatureExtractor(max_reads=50_000)
72
+ log.info("FeatureExtractor loaded from app/core/feature_extractor.py")
73
+ except ImportError as exc:
74
+ log.warning("FeatureExtractor not found (%s) — falling back to stub", exc)
75
+ extractor = None
76
+
77
+ # ── assay metadata ────────────────────────────────────────────────────────────
78
+ ASSAY_LABELS = {
79
+ "amplicon_16s": "16S Amplicon",
80
+ "atac_seq": "Bulk ATAC-seq",
81
+ "bisulfite": "Bisulfite-seq (WGBS)",
82
+ "chip_seq": "ChIP-seq",
83
+ "cut_and_run": "CUT&RUN",
84
+ "cut_and_tag": "CUT&Tag",
85
+ "rna_seq": "RNA-seq",
86
+ "sc_atac_seq": "scATAC-seq",
87
+ "sc_rna_seq": "scRNA-seq",
88
+ "spatial": "Spatial transcriptomics",
89
+ "wes": "Whole exome seq",
90
+ "wgs": "Whole genome seq",
91
+ }
92
+
93
+ # ── FastAPI app ───────────────────────────────────────────────────────────────
94
+ app = FastAPI(
95
+ title="SeqTypeAI",
96
+ description="NGS assay type classifier — 12 library types from FASTQ features",
97
+ version=model_meta.get("version", "1.0") if model_meta else "1.0",
98
+ )
99
+
100
+ # serve React frontend
101
+ if STATIC_DIR.exists():
102
+ app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static")
103
+
104
+
105
+ # ── response schemas ──────────────────────────────────────────────────────────
106
+ class PredictionItem(BaseModel):
107
+ assay: str
108
+ label: str
109
+ confidence: float
110
+ evidence: str = ""
111
+
112
+ class QCCheck(BaseModel):
113
+ label: str
114
+ status: str # "good" | "warn" | "poor"
115
+ value: float
116
+ desc: str
117
+
118
+ class ClassifyResponse(BaseModel):
119
+ filename: str
120
+ top_assay: str
121
+ top_label: str
122
+ confidence: float
123
+ predictions: list[PredictionItem]
124
+ features: dict
125
+ qc_checks: list[QCCheck]
126
+ qc_overall: str
127
+ reasoning: str
128
+ model_version: str
129
+
130
+
131
+ # ── helpers ───────────────────────────────────────────────────────────────────
132
+ def read_fastq_bytes(data: bytes, max_reads: int = 50_000) -> list[dict]:
133
+ """Parse FASTQ bytes (plain or gzip) → list of {seq, qual} dicts."""
134
+ if data[:2] == b"\x1f\x8b":
135
+ data = gzip.decompress(data)
136
+ text = data.decode("utf-8", errors="replace")
137
+ lines = text.splitlines()
138
+ reads = []
139
+ for i in range(0, len(lines) - 3, 4):
140
+ h, seq, _, qual = lines[i], lines[i+1], lines[i+2], lines[i+3]
141
+ if h.startswith("@") and seq and qual:
142
+ reads.append({"seq": seq.strip(), "qual": qual.strip()})
143
+ if len(reads) >= max_reads:
144
+ break
145
+ return reads
146
+
147
+
148
+ def reads_to_tempfile(reads: list[dict]) -> str:
149
+ """Write reads to a temporary FASTQ file for FeatureExtractor."""
150
+ with tempfile.NamedTemporaryFile(
151
+ mode="w", suffix=".fastq", delete=False
152
+ ) as fh:
153
+ for i, r in enumerate(reads):
154
+ fh.write(f"@read_{i}\n{r['seq']}\n+\n{r['qual']}\n")
155
+ return fh.name
156
+
157
+
158
+ def run_extractor(reads: list[dict]) -> dict:
159
+ """Extract features using FeatureExtractor or a lightweight fallback."""
160
+ if extractor is not None:
161
+ tmp = reads_to_tempfile(reads)
162
+ try:
163
+ return extractor.extract(tmp)
164
+ finally:
165
+ Path(tmp).unlink(missing_ok=True)
166
+ # ── lightweight fallback (matches browser-side extraction) ──
167
+ import re, math
168
+ seqs = [r["seq"] for r in reads]
169
+ rls = [len(s) for s in seqs]
170
+ gcs = [(s.count("G") + s.count("C")) / len(s) if s else 0 for s in seqs]
171
+ cfs = [s.count("C") / len(s) if s else 0 for s in seqs]
172
+ def shannon(s):
173
+ n = len(s)
174
+ if not n: return 0
175
+ cnt = {c: s.count(c) for c in "ACGT"}
176
+ return -sum((v/n)*math.log2(v/n) for v in cnt.values() if v) / 2
177
+ entropies = [shannon(s) for s in seqs]
178
+ tn5 = [(s[:9].count("A") + s[:9].count("T")) / 9 if len(s) >= 9 else 0 for s in seqs]
179
+ polya = [1 if re.search(r"A{6,}", s[-20:]) else 0 for s in seqs]
180
+ repk = []
181
+ for s in seqs:
182
+ if len(s) < 4: repk.append(0); continue
183
+ km = {}
184
+ for j in range(len(s)-1): k = s[j:j+2]; km[k] = km.get(k, 0) + 1
185
+ repk.append(max(km.values()) / (len(s)-1))
186
+ mean = lambda a: sum(a)/len(a) if a else 0
187
+ std = lambda a: math.sqrt(mean([(v - mean(a))**2 for v in a])) if a else 0
188
+ bc = sum(1 for l in rls if 24 <= l <= 28) / len(rls) if rls else 0
189
+ return {
190
+ "n_reads": len(reads),
191
+ "rl_mean": mean(rls),
192
+ "rl_std": std(rls),
193
+ "rl_min": min(rls) if rls else 0,
194
+ "rl_max": max(rls) if rls else 0,
195
+ "gc_mean": mean(gcs),
196
+ "gc_std": std(gcs),
197
+ "c_fraction": mean(cfs),
198
+ "entropy_mean": mean(entropies),
199
+ "tn5_start_approx": mean(tn5),
200
+ "polya_signal": mean(polya),
201
+ "repeat_kmer_frac": mean(repk),
202
+ "gc_tail_low": sum(1 for v in gcs if v < 0.30) / len(gcs) if gcs else 0,
203
+ "gc_tail_high": sum(1 for v in gcs if v > 0.70) / len(gcs) if gcs else 0,
204
+ "is_barcode_length": 1 if bc > 0.80 else 0,
205
+ }
206
+
207
+
208
+ def model_predict(features: dict) -> list[PredictionItem]:
209
+ """Run the trained sklearn model and return ranked predictions."""
210
+ if clf is None or le is None or feature_names is None:
211
+ raise HTTPException(503, "Model not loaded — check server logs")
212
+ row = pd.DataFrame([{f: features.get(f, 0.0) for f in feature_names}])
213
+ proba = clf.predict_proba(row)[0]
214
+ items = []
215
+ for cls, prob in sorted(
216
+ zip(le.classes_, proba), key=lambda x: -x[1]
217
+ ):
218
+ items.append(PredictionItem(
219
+ assay=cls,
220
+ label=ASSAY_LABELS.get(cls, cls),
221
+ confidence=round(float(prob), 4),
222
+ evidence="",
223
+ ))
224
+ return items
225
+
226
+
227
+ def build_reasoning(preds: list[PredictionItem], features: dict) -> str:
228
+ top = preds[0]
229
+ runner_up = preds[1] if len(preds) > 1 else None
230
+ parts = [
231
+ f"Top prediction is {top.label} ({top.confidence*100:.0f}% confidence)."
232
+ ]
233
+ # add a couple of the most discriminating feature observations
234
+ if features.get("is_barcode_length") == 1:
235
+ parts.append("R1 read length of 24–28 bp is consistent with a 10x-style barcode read.")
236
+ if features.get("c_fraction", 1) < 0.06:
237
+ parts.append(f"Very low C fraction ({features['c_fraction']*100:.1f}%) is a strong bisulfite conversion signal.")
238
+ if features.get("tn5_start_approx", 0) > 0.52:
239
+ parts.append(f"AT-rich read starts ({features['tn5_start_approx']*100:.0f}%) indicate Tn5 or MNase insertion bias.")
240
+ if runner_up and runner_up.confidence > 0.15:
241
+ parts.append(f"Runner-up: {runner_up.label} ({runner_up.confidence*100:.0f}%).")
242
+ return " ".join(parts)
243
+
244
+
245
+ # ── QC assessment (mirrors browser-side logic) ────────────────────────────────
246
+ QC_THRESHOLDS = {
247
+ "atac_seq": [
248
+ ("Tn5 insertion bias", "tn5_start_approx",
249
+ lambda v: v > 0.52, lambda v: v > 0.48,
250
+ "AT-rich read starts indicate Tn5 transposition"),
251
+ ("GC content", "gc_mean",
252
+ lambda v: 0.40 < v < 0.60, lambda v: 0.35 < v < 0.65,
253
+ "Expected 40–60% for open chromatin"),
254
+ ("Library complexity", "entropy_mean",
255
+ lambda v: v > 0.85, lambda v: v > 0.75,
256
+ "High entropy indicates library diversity"),
257
+ ],
258
+ "bisulfite": [
259
+ ("Conversion efficiency", "c_fraction",
260
+ lambda v: v < 0.05, lambda v: v < 0.10,
261
+ "C fraction < 5% = good bisulfite conversion"),
262
+ ("Low-GC read fraction", "gc_tail_low",
263
+ lambda v: v > 0.20, lambda v: v > 0.10,
264
+ "C→T conversion produces GC-depleted reads"),
265
+ ],
266
+ "rna_seq": [
267
+ ("GC content", "gc_mean",
268
+ lambda v: 0.42 < v < 0.58, lambda v: 0.38 < v < 0.62,
269
+ "Human transcriptome: 48–52% GC"),
270
+ ("Library complexity", "entropy_mean",
271
+ lambda v: v > 0.85, lambda v: v > 0.75,
272
+ "Diverse read sequences expected"),
273
+ ("Read length", "rl_mean",
274
+ lambda v: 75 <= v <= 200, lambda v: 50 <= v <= 300,
275
+ "Standard RNA-seq: 75–150 bp"),
276
+ ],
277
+ "sc_rna_seq": [
278
+ ("Barcode read length", "is_barcode_length",
279
+ lambda v: v == 1, lambda v: False,
280
+ "28 bp R1 = 10x v3 barcode + UMI"),
281
+ ],
282
+ "sc_atac_seq": [
283
+ ("Barcode read length", "is_barcode_length",
284
+ lambda v: v == 1, lambda v: False,
285
+ "Short R1 indicates barcode read"),
286
+ ],
287
+ "wgs": [
288
+ ("GC content", "gc_mean",
289
+ lambda v: 0.37 < v < 0.47, lambda v: 0.33 < v < 0.53,
290
+ "Human genome ~41% GC"),
291
+ ("Repeat k-mer content", "repeat_kmer_frac",
292
+ lambda v: 0.003 < v < 0.07, lambda v: v < 0.10,
293
+ "Moderate repeat fraction expected for WGS"),
294
+ ],
295
+ "wes": [
296
+ ("GC content", "gc_mean",
297
+ lambda v: 0.44 < v < 0.56, lambda v: 0.40 < v < 0.60,
298
+ "Exome regions are GC-enriched (~49%)"),
299
+ ("Repeat depletion", "repeat_kmer_frac",
300
+ lambda v: v < 0.04, lambda v: v < 0.07,
301
+ "Exome capture depletes repetitive sequences"),
302
+ ],
303
+ "chip_seq": [
304
+ ("Library complexity", "entropy_mean",
305
+ lambda v: v > 0.85, lambda v: v > 0.75,
306
+ "Low complexity suggests over-amplification"),
307
+ ],
308
+ "cut_and_run": [
309
+ ("MNase start bias", "tn5_start_approx",
310
+ lambda v: v > 0.50, lambda v: v > 0.46,
311
+ "MNase cleaves AT-rich linker regions"),
312
+ ],
313
+ "cut_and_tag": [
314
+ ("Tn5 insertion bias", "tn5_start_approx",
315
+ lambda v: v > 0.52, lambda v: v > 0.48,
316
+ "pA-Tn5 shows AT bias similar to ATAC-seq"),
317
+ ],
318
+ "amplicon_16s": [
319
+ ("Amplicon read length", "rl_mean",
320
+ lambda v: 200 <= v <= 500, lambda v: 150 <= v <= 600,
321
+ "V4: ~253 bp, V3–V4: ~464 bp"),
322
+ ("Community diversity", "entropy_mean",
323
+ lambda v: v > 0.80, lambda v: v > 0.70,
324
+ "Good microbial community diversity expected"),
325
+ ],
326
+ "spatial": [
327
+ ("Read length", "rl_mean",
328
+ lambda v: v < 40, lambda v: v < 60,
329
+ "Visium R1 = 28 bp"),
330
+ ],
331
+ }
332
+
333
+
334
+ def assess_quality(features: dict, assay: str) -> tuple[list[QCCheck], str]:
335
+ checks_def = QC_THRESHOLDS.get(assay, [])
336
+ checks = []
337
+ for label, key, good, warn, desc in checks_def:
338
+ val = features.get(key, 0.0)
339
+ status = "good" if good(val) else ("warn" if warn(val) else "poor")
340
+ checks.append(QCCheck(label=label, status=status, value=round(float(val), 4), desc=desc))
341
+ score_map = {"good": 2, "warn": 1, "poor": 0}
342
+ if checks:
343
+ score = sum(score_map[c.status] for c in checks) / (len(checks) * 2)
344
+ else:
345
+ score = 1.0
346
+ overall = "good" if score >= 0.75 else ("warn" if score >= 0.5 else "poor")
347
+ return checks, overall
348
+
349
+
350
+ # ── routes ────────────────────────────────────────────────────────────────────
351
+ @app.get("/", response_class=HTMLResponse)
352
+ async def root():
353
+ idx = STATIC_DIR / "index.html"
354
+ if idx.exists():
355
+ return HTMLResponse(idx.read_text())
356
+ return HTMLResponse("<h1>SeqTypeAI API</h1><p>Docs: <a href='/docs'>/docs</a></p>")
357
+
358
+
359
+ @app.get("/health")
360
+ async def health():
361
+ return {
362
+ "status": "ok",
363
+ "model_loaded": clf is not None,
364
+ "model_version": model_meta.get("version", "unknown") if model_meta else "unknown",
365
+ "n_features": len(feature_names) if feature_names else 0,
366
+ "n_classes": len(le.classes_) if le else 0,
367
+ }
368
+
369
+
370
+ @app.post("/classify", response_model=ClassifyResponse)
371
+ async def classify(file: UploadFile = File(...)):
372
+ """
373
+ Upload a FASTQ file (.fastq or .fastq.gz) and receive:
374
+ - ranked assay type predictions with confidence scores
375
+ - extracted library features
376
+ - assay-specific QC assessment
377
+ """
378
+ if not file.filename:
379
+ raise HTTPException(400, "No filename provided")
380
+ allowed_ext = {".fastq", ".fq", ".fastq.gz", ".fq.gz"}
381
+ fname = file.filename.lower()
382
+ if not any(fname.endswith(e) for e in allowed_ext):
383
+ raise HTTPException(400, f"File must be one of: {', '.join(allowed_ext)}")
384
+
385
+ data = await file.read()
386
+ if len(data) > 200 * 1024 * 1024: # 200 MB hard limit
387
+ raise HTTPException(413, "File too large — maximum 200 MB")
388
+
389
+ reads = read_fastq_bytes(data, max_reads=50_000)
390
+ if not reads:
391
+ raise HTTPException(422, "No valid FASTQ records found in file")
392
+
393
+ features = run_extractor(reads)
394
+ preds = model_predict(features)
395
+ reasoning = build_reasoning(preds, features)
396
+ qc_checks, qc_overall = assess_quality(features, preds[0].assay)
397
+
398
+ return ClassifyResponse(
399
+ filename = file.filename,
400
+ top_assay = preds[0].assay,
401
+ top_label = preds[0].label,
402
+ confidence = preds[0].confidence,
403
+ predictions = preds,
404
+ features = {k: round(v, 6) if isinstance(v, float) else v
405
+ for k, v in features.items()},
406
+ qc_checks = qc_checks,
407
+ qc_overall = qc_overall,
408
+ reasoning = reasoning,
409
+ model_version = model_meta.get("version", "1.0") if model_meta else "1.0",
410
+ )
app/.DS_Store ADDED
Binary file (10.2 kB). View file
 
app/core/feature_extractor.py ADDED
@@ -0,0 +1,1114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ app/core/feature_extractor.py
3
+ ------------------------------
4
+ Converts a list of FastqRecord objects into a fixed-length numeric feature
5
+ vector suitable for classification.
6
+
7
+ Feature groups
8
+ --------------
9
+ 1. Read length statistics (mean, std, min, max, median, q25, q75,
10
+ skewness, fraction_short, fraction_long,
11
+ bimodality_score, rl_cv)
12
+ 2. Nucleotide frequencies (A, C, G, T, N fractions)
13
+ 3. GC content statistics (mean, std, skewness)
14
+ 4. k-mer frequency profiles (2-mer, 3-mer, 4-mer by default)
15
+ 5. Quality score statistics (mean, std, min, max, q25, q75,
16
+ fraction below Q20/Q30, positional decay)
17
+ 6. Sequence complexity (Shannon entropy mean/std, dust score,
18
+ homopolymer rate, linguistic complexity)
19
+ 7. Adapter / motif signals (presence of common adapter k-mers)
20
+ 8. Structural signals (dinucleotide bias, CpG ratio,
21
+ read pairing signal via length variance)
22
+
23
+ Design note on read length
24
+ --------------------------
25
+ Read length IS a legitimate discriminative feature (sc-RNA-seq barcode reads
26
+ are 28bp; 16S amplicons are fixed at ~250bp; ATAC-seq has a characteristic
27
+ bimodal fragment size distribution). However, the model should not rely on
28
+ read length ALONE. We address this by:
29
+ a) Adding read-length-independent features that capture the same biology
30
+ through sequence composition (CpG ratio for bisulfite, GA dinucleotide
31
+ bias for Tn5-based assays, poly-A signal for RNA-seq).
32
+ b) Normalising all k-mer features by sequence length so they are
33
+ comparable across different read lengths.
34
+ c) Adding explicit bimodality and coefficient-of-variation features so
35
+ the model learns *distributions* rather than just means.
36
+ """
37
+ from __future__ import annotations
38
+
39
+ import json
40
+ import math
41
+ from collections import Counter
42
+ from itertools import product
43
+ from pathlib import Path
44
+ from typing import Sequence
45
+
46
+ import numpy as np
47
+
48
+ from app.utils.fastq_parser import FastqRecord
49
+
50
+
51
+ # ── k-mer helpers ──────────────────────────────────────────────────────────
52
+
53
+ def _all_kmers(k: int, alphabet: str = "ACGT") -> list[str]:
54
+ return ["".join(p) for p in product(alphabet, repeat=k)]
55
+
56
+
57
+ def _kmer_freq(sequence: str, k: int) -> dict[str, float]:
58
+ seq = sequence.upper().replace("N", "")
59
+ counts: Counter[str] = Counter()
60
+ total = len(seq) - k + 1
61
+ if total <= 0:
62
+ return {}
63
+ for i in range(total):
64
+ counts[seq[i : i + k]] += 1
65
+ return {kmer: counts.get(kmer, 0) / total for kmer in _all_kmers(k)}
66
+
67
+
68
+ # ── Quality helpers ────────────────────────────────────────────────────────
69
+
70
+ def _qual_scores(quality_string: str) -> list[float]:
71
+ """Convert Illumina Phred+33 quality string to Q scores."""
72
+ return [ord(c) - 33 for c in quality_string]
73
+
74
+
75
+ def _qual_positional_decay(quality_string: str, n_bins: int = 5) -> float:
76
+ """
77
+ Ratio of mean quality in the last bin vs first bin.
78
+ Low values (close to 0) indicate 3' quality drop typical of short-read
79
+ Illumina sequencing. High values indicate uniform quality (PacBio-like
80
+ or very short reads where no decay is visible).
81
+ """
82
+ qs = _qual_scores(quality_string)
83
+ n = len(qs)
84
+ if n < n_bins * 2:
85
+ return 1.0
86
+ bin_size = n // n_bins
87
+ first_mean = float(np.mean(qs[:bin_size]))
88
+ last_mean = float(np.mean(qs[-bin_size:]))
89
+ return last_mean / max(first_mean, 1.0)
90
+
91
+
92
+ # ── Complexity helpers ─────────────────────────────────────────────────────
93
+
94
+ def _shannon_entropy(sequence: str) -> float:
95
+ seq = sequence.upper()
96
+ n = len(seq)
97
+ if n == 0:
98
+ return 0.0
99
+ counts = Counter(seq)
100
+ return -sum((c / n) * math.log2(c / n) for c in counts.values() if c > 0)
101
+
102
+
103
+ def _linguistic_complexity(sequence: str, k: int = 4) -> float:
104
+ """
105
+ Fraction of possible k-mers observed. Low values indicate low complexity
106
+ (repetitive sequences, primers, adapters).
107
+ """
108
+ seq = sequence.upper().replace("N", "")
109
+ n = len(seq)
110
+ if n < k:
111
+ return 0.0
112
+ observed = len(set(seq[i:i+k] for i in range(n - k + 1)))
113
+ possible = min(4 ** k, n - k + 1)
114
+ return observed / max(possible, 1)
115
+
116
+
117
+ def _homopolymer_rate(sequence: str) -> float:
118
+ """Fraction of bases that are part of a homopolymer run ≥ 4."""
119
+ seq = sequence.upper()
120
+ n = len(seq)
121
+ if n < 4:
122
+ return 0.0
123
+ in_run = 0
124
+ run_len = 1
125
+ for i in range(1, n):
126
+ if seq[i] == seq[i - 1]:
127
+ run_len += 1
128
+ else:
129
+ if run_len >= 4:
130
+ in_run += run_len
131
+ run_len = 1
132
+ if run_len >= 4:
133
+ in_run += run_len
134
+ return in_run / n
135
+
136
+
137
+ # ── Sequence composition signals ───────────────────────────────────────────
138
+
139
+ def _cpg_ratio(sequence: str) -> float:
140
+ """
141
+ CpG observed/expected ratio. Low values indicate CpG suppression
142
+ (unmethylated mammalian genomes); bisulfite data shows distinctive
143
+ CpG depletion on the C→T converted strand.
144
+ Formula: (CpG count * N) / (C count * G count)
145
+ """
146
+ seq = sequence.upper()
147
+ n = len(seq)
148
+ if n < 2:
149
+ return 1.0
150
+ cpg = sum(1 for i in range(n - 1) if seq[i] == "C" and seq[i+1] == "G")
151
+ c_count = seq.count("C")
152
+ g_count = seq.count("G")
153
+ if c_count == 0 or g_count == 0:
154
+ return 0.0
155
+ return (cpg * n) / (c_count * g_count)
156
+
157
+
158
+ def _ga_ct_bias(sequence: str) -> float:
159
+ """
160
+ (GA + CT) / total dinucleotides.
161
+ Tn5 transposase has a strong preference for inserting at GCAG/CTGC motifs,
162
+ producing elevated GA and CT dinucleotides in ATAC-seq and CUT&Tag data.
163
+ """
164
+ seq = sequence.upper()
165
+ n = len(seq) - 1
166
+ if n <= 0:
167
+ return 0.5
168
+ ga = sum(1 for i in range(n) if seq[i:i+2] in ("GA", "CT"))
169
+ return ga / n
170
+
171
+
172
+ def _polya_signal(sequence: str, min_run: int = 8) -> float:
173
+ """
174
+ Fraction of reads with a poly-A or poly-T run of length >= min_run.
175
+ Elevated in RNA-seq due to polyA selection; rare in genomic assays.
176
+ """
177
+ seq = sequence.upper()
178
+ n = len(seq)
179
+ if n < min_run:
180
+ return 0.0
181
+ for base in ("A", "T"):
182
+ run = base * min_run
183
+ if run in seq:
184
+ return 1.0
185
+ return 0.0
186
+
187
+
188
+
189
+
190
+ def _bisulfite_ct_conversion(sequence: str) -> float:
191
+ """
192
+ Proxy for bisulfite C→T conversion rate.
193
+
194
+ In WGBS/RRBS, unmethylated cytosines are converted to uracil (read as T).
195
+ Mammalian genomes are ~70-80% methylated at CpG but nearly 100% unmethylated
196
+ at non-CpG cytosines, so bisulfite R1 reads are severely C-depleted.
197
+
198
+ We return the raw C fraction of the read. Typical values:
199
+ Bisulfite R1: 0.03 – 0.12 (C severely depleted by conversion)
200
+ All other: 0.20 – 0.30 (normal genomic C fraction ~25%)
201
+
202
+ Note: bisulfite R2 (bottom strand) is T-depleted instead — but we only
203
+ use R1, so C-depletion is the correct signal direction.
204
+ """
205
+ seq = sequence.upper()
206
+ n = len(seq)
207
+ if n == 0:
208
+ return 0.25 # return neutral value if empty
209
+ c_count = seq.count("C")
210
+ return c_count / n
211
+
212
+
213
+ def _repeat_kmer_fraction(sequence: str) -> float:
214
+ """
215
+ Fraction of positions matching simple tandem repeat k-mers.
216
+
217
+ WGS reads sample the genome uniformly, so ~50% of reads contain
218
+ repetitive elements (satellite DNA, simple repeats, transposons).
219
+ ChIP-seq enriches for specific genomic loci (TF binding sites,
220
+ histone marks) which are predominantly in unique sequence.
221
+
222
+ We scan for the most abundant simple repeat k-mers in mammalian
223
+ genomes. High values suggest WGS or non-specific genomic sampling;
224
+ low values suggest enriched ChIP or amplicon data.
225
+
226
+ Key repeats targeted:
227
+ AT-satellite: ATATAT / TATATA — abundant pericentromeric repeat
228
+ CA/TG-repeat: CACACA / TGTGTG — common microsatellite
229
+ AATGG-repeat: beta-satellite, prevalent in heterochromatin
230
+ TTAGGG: telomeric repeat (6-mer)
231
+ Alpha satellite core: AATTT (present in ~171bp CENP-B box units)
232
+ """
233
+ seq = sequence.upper()
234
+ n = len(seq)
235
+ if n < 6:
236
+ return 0.0
237
+
238
+ # 6-mer simple repeats — highly abundant in WGS, depleted in ChIP peaks
239
+ repeat_6mers = {
240
+ "ATATAT", "TATATA", # AT satellite
241
+ "AATATA", "TATATT", # AT satellite variant
242
+ "CACACA", "TGTGTG", # CA microsatellite
243
+ "ACACAC", "GTGTGT", # CA microsatellite RC
244
+ "TTAGGG", "CCCTAA", # telomeric repeat and RC
245
+ "AATGAA", "TTCATT", # beta satellite core
246
+ "AATGGG", "CCCATT", # beta satellite variant
247
+ "GAATTT", "AAATTC", # alpha satellite-associated
248
+ }
249
+
250
+ hits = 0
251
+ for i in range(n - 5):
252
+ if seq[i:i+6] in repeat_6mers:
253
+ hits += 1
254
+ return hits / max(n - 5, 1)
255
+
256
+
257
+ def _nucleosome_periodicity(read_lengths: list[int]) -> float:
258
+ """
259
+ Score reflecting whether read lengths cluster at nucleosome multiples.
260
+
261
+ In ATAC-seq and ChIP-seq of histone marks, fragments preferentially
262
+ span nucleosome multiples (~147bp, ~294bp, ~441bp). WGS fragments
263
+ are randomly distributed (controlled only by library prep target size).
264
+
265
+ We compute the fraction of reads whose length falls within ±15bp of
266
+ a nucleosome multiple. High values indicate nucleosome-phased data
267
+ (ATAC, MNase ChIP, nucleosome ChIP); low values suggest non-phased
268
+ data (WGS, TF ChIP where fragments are sub-nucleosomal).
269
+
270
+ Note: this is read length, not fragment length — for paired-end data
271
+ true fragment size would be more informative, but R1 length still
272
+ carries a partial signal since library prep often targets specific sizes.
273
+ """
274
+ if not read_lengths:
275
+ return 0.0
276
+ nucleosome_multiples = [147, 294, 441, 588]
277
+ tolerance = 15
278
+ n_phased = sum(
279
+ 1 for rl in read_lengths
280
+ if any(abs(rl - nm) <= tolerance for nm in nucleosome_multiples)
281
+ )
282
+ return n_phased / len(read_lengths)
283
+
284
+ # ── Tn5 start-of-read motif score ─────────────────────────────────────────
285
+
286
+ # The Tn5 transposase mosaic end sequence is AGATGTGTATAAGAGACAG.
287
+ # After insertion, reads begin with a characteristic sequence derived from
288
+ # this motif. We score the first 15bp of each read against a position-
289
+ # specific scoring matrix (PSSM) derived from known Tn5 insertion sites.
290
+ #
291
+ # This is intentionally a READ-START feature, not a global k-mer count.
292
+ # The signal concentrates at positions 1-15; looking globally dilutes it.
293
+ #
294
+ # Assays where this signal is elevated:
295
+ # - ATAC-seq (bulk and single-cell)
296
+ # - CUT&Tag (Tn5-tethered antibody)
297
+ # - Tn5-based RNA-seq (SMART-seq3, some total RNA protocols)
298
+ #
299
+ # Assays where it is absent:
300
+ # - ChIP-seq (sonication/MNase fragmentation)
301
+ # - CUT&RUN (MNase-based)
302
+ # - Standard RNA-seq (RNase fragmentation + ligation)
303
+ # - WGS/WES (mechanical shearing)
304
+ # - Bisulfite-seq (bisulfite fragmentation)
305
+
306
+ # PSSM derived from Kia et al. 2017 (PMC5240201), Table/Fig showing that the
307
+ # dominant nucleotides at read positions 1-15 are: GTTTA***CTGTGCG
308
+ # where *** (positions 6-8) are degenerate due to Tn5 homodimer symmetry.
309
+ # Positions 6-8 are always the reverse complement of positions 3-1 (TTA→TAA),
310
+ # so we give them a flat (uninformative) prior.
311
+ # Values represent log-odds enrichment; 0.0 = uninformative.
312
+ # PSSM v2: softer penalties to allow natural Tn5 insertion site degeneracy.
313
+ # Strong positions (G>A discrimination at 1, T at 2/4, A at 5, C at 9, G at 11/13/15)
314
+ # use -0.5 penalty for non-consensus bases. Weaker positions (3, 10, 12, 14)
315
+ # use -0.2 to allow variation without zeroing out reads with partial matches.
316
+ # Degenerate positions 6-8 remain uninformative (0.0).
317
+ # This allows reads that start close to but not exactly at the Tn5 insertion
318
+ # site to still receive a meaningful positive score.
319
+ _TN5_PSSM: list[dict[str, float]] = [
320
+ # pos 1: G strongly preferred (most discriminative — flanking genomic bias)
321
+ {"A": -0.5, "C": -0.5, "G": 1.8, "T": -0.5},
322
+ # pos 2: T strongly preferred
323
+ {"A": -0.5, "C": -0.5, "G": -0.5, "T": 1.8},
324
+ # pos 3: T preferred but some variation observed
325
+ {"A": -0.2, "C": -0.2, "G": -0.2, "T": 1.4},
326
+ # pos 4: T strongly preferred
327
+ {"A": -0.5, "C": -0.5, "G": -0.5, "T": 1.8},
328
+ # pos 5: A strongly preferred
329
+ {"A": 1.8, "C": -0.5, "G": -0.5, "T": -0.5},
330
+ # pos 6: degenerate (homodimer symmetry)
331
+ {"A": 0.0, "C": 0.0, "G": 0.0, "T": 0.0},
332
+ # pos 7: degenerate
333
+ {"A": 0.0, "C": 0.0, "G": 0.0, "T": 0.0},
334
+ # pos 8: degenerate
335
+ {"A": 0.0, "C": 0.0, "G": 0.0, "T": 0.0},
336
+ # pos 9: C strongly preferred (mirrors pos 1)
337
+ {"A": -0.5, "C": 1.8, "G": -0.5, "T": -0.5},
338
+ # pos 10: T preferred, some variation
339
+ {"A": -0.2, "C": -0.2, "G": -0.2, "T": 1.4},
340
+ # pos 11: G strongly preferred
341
+ {"A": -0.5, "C": -0.5, "G": 1.8, "T": -0.5},
342
+ # pos 12: T preferred, some variation
343
+ {"A": -0.2, "C": -0.2, "G": -0.2, "T": 1.4},
344
+ # pos 13: G strongly preferred
345
+ {"A": -0.5, "C": -0.5, "G": 1.8, "T": -0.5},
346
+ # pos 14: C preferred, some variation
347
+ {"A": -0.2, "C": 1.4, "G": -0.2, "T": -0.2},
348
+ # pos 15: G strongly preferred
349
+ {"A": -0.5, "C": -0.5, "G": 1.8, "T": -0.5},
350
+ ]
351
+ _TN5_PSSM_LEN = len(_TN5_PSSM)
352
+
353
+ # Max possible score (all positions match perfectly) — used for normalisation
354
+ _TN5_PSSM_MAX = sum(max(pos.values()) for pos in _TN5_PSSM)
355
+
356
+
357
+ def _tn5_start_score(sequence: str) -> float:
358
+ """
359
+ Score the first 15bp of a read against the Tn5 insertion PSSM.
360
+ Motif: GTTTA[NNN]CTGTGCG (Kia et al. 2017, PMC5240201).
361
+ Returns a normalised score in [0, 1] where 1.0 = perfect Tn5 motif match.
362
+
363
+ Uses the reverse complement too, since reads from either strand of a
364
+ Tn5 insertion will carry the motif (possibly RC) at their start.
365
+ """
366
+ seq = sequence.upper()
367
+ if len(seq) < _TN5_PSSM_LEN:
368
+ return 0.0
369
+
370
+ # Score only the forward strand — we are downloading R1 only.
371
+ # R1 from Tn5-based libraries starts with GTTTA[NNN]CTGTGCG.
372
+ # R2 would start with the RC, but we don't use R2.
373
+ raw = sum(_TN5_PSSM[i].get(seq[i], -1.0) for i in range(_TN5_PSSM_LEN))
374
+
375
+ # Normalise against max score; clip negatives to 0.
376
+ # Random sequences score near 0; genuine Tn5 R1 reads score near 1.
377
+ normalised = raw / max(_TN5_PSSM_MAX, 1e-6)
378
+ return float(np.clip(normalised, 0.0, 1.0))
379
+
380
+
381
+ # ── MNase cleavage start-of-read signal ───────────────────────────────────
382
+ #
383
+ # MNase (micrococcal nuclease) cleaves preferentially at AT-rich linker DNA
384
+ # between nucleosomes. CUT&RUN uses pA-MNase tethered to the antibody, so
385
+ # the cleavage sites — and therefore read starts — are enriched at AT-rich
386
+ # sequences flanking nucleosomes.
387
+ #
388
+ # Evidence: Chung et al. 2010 (PMID 20181069) show MNase cut sites have a
389
+ # strong preference for TA dinucleotides at the cleavage point. The released
390
+ # fragment begins at the base immediately 3' of the MNase cut, which is
391
+ # typically A or T in an AT-rich context.
392
+ #
393
+ # PSSM derived from MNase cut-site bias: positions 1-10 of CUT&RUN R1 reads
394
+ # are enriched for A/T with a characteristic profile. We use a soft PSSM
395
+ # that rewards A/T at early positions without penalising legitimate reads that
396
+ # don't start exactly at a canonical MNase site.
397
+ #
398
+ # Assays where this signal is elevated:
399
+ # - CUT&RUN (pA-MNase cleavage)
400
+ # - Native MNase-ChIP
401
+ #
402
+ # Assays where it is absent or opposite:
403
+ # - CUT&Tag (Tn5 cleavage — starts with G, not A/T)
404
+ # - Standard ChIP-seq (sonication — random starts)
405
+ # - ATAC-seq (Tn5 cleavage — starts with G)
406
+
407
+ _MNASE_PSSM: list[dict[str, float]] = [
408
+ # pos 1: A or T strongly preferred (MNase cuts AT|AT, first base is A or T)
409
+ {"A": 1.5, "C": -0.5, "G": -0.5, "T": 1.5},
410
+ # pos 2: T preferred after A (TA dinucleotide bias)
411
+ {"A": 0.5, "C": -0.3, "G": -0.3, "T": 1.2},
412
+ # pos 3: A or T still enriched
413
+ {"A": 0.8, "C": -0.3, "G": -0.3, "T": 0.8},
414
+ # pos 4: weakly AT-biased
415
+ {"A": 0.4, "C": -0.2, "G": -0.2, "T": 0.4},
416
+ # pos 5: weakly AT-biased
417
+ {"A": 0.3, "C": -0.1, "G": -0.1, "T": 0.3},
418
+ # pos 6-10: mild AT enrichment, fading signal
419
+ {"A": 0.2, "C": -0.1, "G": -0.1, "T": 0.2},
420
+ {"A": 0.2, "C": -0.1, "G": -0.1, "T": 0.2},
421
+ {"A": 0.1, "C": 0.0, "G": 0.0, "T": 0.1},
422
+ {"A": 0.1, "C": 0.0, "G": 0.0, "T": 0.1},
423
+ {"A": 0.1, "C": 0.0, "G": 0.0, "T": 0.1},
424
+ ]
425
+ _MNASE_PSSM_LEN = len(_MNASE_PSSM)
426
+ _MNASE_PSSM_MAX = sum(max(pos.values()) for pos in _MNASE_PSSM)
427
+
428
+
429
+ def _mnase_start_score(sequence: str) -> float:
430
+ """
431
+ Score the first 10bp of a read against the MNase cleavage site PSSM.
432
+ Elevated in CUT&RUN (pA-MNase based); low in CUT&Tag and ChIP-seq.
433
+ Returns a normalised score in [0, 1].
434
+ """
435
+ seq = sequence.upper()
436
+ if len(seq) < _MNASE_PSSM_LEN:
437
+ return 0.0
438
+ raw = sum(_MNASE_PSSM[i].get(seq[i], -0.5) for i in range(_MNASE_PSSM_LEN))
439
+ return float(np.clip(raw / max(_MNASE_PSSM_MAX, 1e-6), 0.0, 1.0))
440
+
441
+
442
+ # ── 16S rRNA primer start matching ────────────────────────────────────────
443
+ #
444
+ # 16S amplicon libraries are generated by PCR with primers targeting conserved
445
+ # regions of the 16S rRNA gene. The most common target regions are V3-V4 and
446
+ # V4. A substantial fraction of reads begin with the primer sequence itself
447
+ # (or its reverse complement from the other end).
448
+ #
449
+ # Common primer sets:
450
+ # V3-V4 forward: CCTACGGGNGGCWGCAG (341F, where N=any, W=A/T)
451
+ # V3-V4 reverse: GACTACHVGGGTATCTAATCC (806R)
452
+ # V4 forward: GTGYCAGCMGCCGCGGTAA (515F)
453
+ # V4 reverse: GGACTACNVGGGTWTCTAAT (806R variant)
454
+ #
455
+ # We look for the first 12bp of these primers at the start of R1. A match
456
+ # within 2 mismatches is counted. Even partial primer sequence at read start
457
+ # is highly specific to amplicon libraries.
458
+ #
459
+ # We also include the universal 16S primers commonly used in microbiome studies:
460
+ # 27F: AGAGTTTGATCMTGGCTCAG (position 27 of E. coli 16S)
461
+ # 1492R: TACGGYTACCTTGTTACGACTT
462
+
463
+ _16S_PRIMERS_12MER = [
464
+ "CCTACGGGNGGC", # 341F V3-V4 (N→any, use consensus)
465
+ "CCTACGGGAGGC", # 341F with A
466
+ "CCTACGGGTGGC", # 341F with T
467
+ "CCTACGGGCGGC", # 341F with C
468
+ "GACTACHVGGGT", # 806R V3-V4
469
+ "GACTACNVGGGT", # 806R variant
470
+ "GTGYCAGCMGCC", # 515F V4
471
+ "GTGCCAGCMGCC", # 515F with C
472
+ "GTGTCAGCMGCC", # 515F with T
473
+ "GGACTACNVGGG", # V4 reverse
474
+ "AGAGTTTGATCC", # 27F universal
475
+ "AGAGTTTGATCT", # 27F with T
476
+ "AGAGTTTGATCM", # 27F degenerate base
477
+ "TACGGYTACCTT", # 1492R start
478
+ ]
479
+ # Pre-convert to sets of accepted chars per position using IUPAC codes
480
+ # For matching efficiency, we just use exact 12-mer prefix lookups.
481
+ _16S_PRIMER_SET = set(_16S_PRIMERS_12MER)
482
+
483
+
484
+ def _is_16s_primer_start(sequence: str, max_mismatches: int = 2) -> float:
485
+ """
486
+ Returns 1.0 if the first 12bp of the read match any known 16S primer
487
+ within max_mismatches mismatches, else 0.0.
488
+
489
+ Degenerate positions in IUPAC primers (N, M, W, etc.) are treated as
490
+ wildcards — any base matches them.
491
+ """
492
+ IUPAC_WILDCARDS = set("NWMRYSKHBDV") # degenerate IUPAC bases
493
+ seq = sequence.upper()
494
+ if len(seq) < 12:
495
+ return 0.0
496
+
497
+ read_prefix = seq[:12]
498
+
499
+ for primer in _16S_PRIMERS_12MER:
500
+ mismatches = 0
501
+ for r, p in zip(read_prefix, primer):
502
+ if p in IUPAC_WILDCARDS:
503
+ continue # wildcard matches anything
504
+ if r != p:
505
+ mismatches += 1
506
+ if mismatches > max_mismatches:
507
+ break
508
+ if mismatches <= max_mismatches:
509
+ return 1.0
510
+ return 0.0
511
+
512
+
513
+ # ── GC tail fractions ─────────────────────────────────────────────────────
514
+ #
515
+ # PCR amplification during library preparation preferentially drops very
516
+ # AT-rich (<30% GC) and very GC-rich (>70% GC) fragments due to polymerase
517
+ # efficiency. This creates a characteristic bell-shaped GC distribution with
518
+ # depleted tails.
519
+ #
520
+ # PCR-free WGS libraries retain these extreme GC fragments, resulting in a
521
+ # broader GC distribution. WES is heavily PCR-amplified and shows strong
522
+ # depletion of AT/GC extremes.
523
+ #
524
+ # Expected values:
525
+ # PCR-free WGS: gc_tail_low ~0.05-0.10, gc_tail_high ~0.03-0.07
526
+ # Standard WGS: gc_tail_low ~0.02-0.05, gc_tail_high ~0.01-0.03
527
+ # WES: gc_tail_low ~0.01-0.02, gc_tail_high ~0.005-0.015
528
+ # ChIP-seq: gc_tail_low ~0.01-0.03, gc_tail_high ~0.01-0.02
529
+ # 16S amplicon: gc_tail_low ~0.20-0.40 (AT-rich regions common)
530
+ # Bisulfite: gc_tail_low ~0.30-0.60 (C→T conversion depletes GC severely)
531
+
532
+ def _gc_tail_fractions(gc_fracs: list[float]) -> tuple[float, float]:
533
+ """
534
+ Returns (fraction of reads with GC < 0.30, fraction with GC > 0.70).
535
+ These tails are depleted by PCR bias and enriched in PCR-free or
536
+ bisulfite-converted libraries.
537
+ """
538
+ if not gc_fracs:
539
+ return 0.0, 0.0
540
+ n = len(gc_fracs)
541
+ low = sum(1 for g in gc_fracs if g < 0.30) / n
542
+ high = sum(1 for g in gc_fracs if g > 0.70) / n
543
+ return low, high
544
+
545
+
546
+
547
+ #
548
+ # CTCF (CCCTC-binding factor) is the most abundant transcription factor
549
+ # binding site found in ATAC-seq peaks. It is present at most topological
550
+ # domain boundaries and many insulator elements, making it a reliable
551
+ # indicator of genuine open chromatin signal.
552
+ #
553
+ # JASPAR MA0139.1 consensus: CCGCGNGGNGGCAG (14bp)
554
+ # Simplified degenerate core: CCGCG (5bp, high specificity)
555
+ # Extended cores we scan for: CCGCGGGCG, CCGCGAGCG, CCGCGTGCG (9bp)
556
+ #
557
+ # High CTCF enrichment → reads are coming from real open chromatin peaks
558
+ # → correlates with high FRiP and TSS enrichment
559
+ # Low CTCF enrichment → random genomic noise, adapter dimers, or
560
+ # contamination even if Tn5 bias is present
561
+ #
562
+ # Note: we scan the FULL read (not just start) since CTCF sites can appear
563
+ # anywhere in a fragment. We also count the reverse complement.
564
+ #
565
+ # Other TF motifs included as secondary open-chromatin indicators:
566
+ # AP-1 core: TGASTCA (S = C or G) → prevalent in immune/regulatory peaks
567
+ # ETS core: CCGGAAG → promoter-proximal accessibility
568
+
569
+ # Open chromatin motifs — only 9-mer or longer to avoid chance k-mer collisions.
570
+ # JASPAR MA0139.1 (CTCF): CCGCGNGGNGGCAG (14bp)
571
+ # We represent this as overlapping 9-mers for the most common variants.
572
+ # AP-1 (TGASTCA, 7bp) and ETS (CCGGAAGT, 8bp) are retained as-is since
573
+ # at 7-8bp they are specific enough.
574
+ # CTCF core 9-mers: JASPAR MA0139.1 (human) and MA0139.2 (mouse).
575
+ # The CCGCGNG core is >99% conserved across vertebrates.
576
+ # Human/mouse variants differ primarily in flanking context at positions 7-9.
577
+ _CTCF_CORES_HUMAN = {
578
+ "CCGCGGGCG", "CGCCCGCGG", # CCGCG[G]GCG and RC
579
+ "CCGCGAGCG", "CGCTCGCGG", # CCGCG[A]GCG and RC
580
+ "CCGCGTGCG", "CGCACGCGG", # CCGCG[T]GCG and RC
581
+ "CCGCGCGCG", "CGCGCGCGG", # CCGCG[C]GCG and RC
582
+ "CCGCGGGCGGCAG", "CTGCCGCCCGCGG", # 14-mer full JASPAR core
583
+ }
584
+ _CTCF_CORES_MOUSE = {
585
+ "CCGCGGGCG", "CGCCCGCGG", # shared core (most common in both)
586
+ "CCGCGAGCG", "CGCTCGCGG", # shared
587
+ "GCCGCGGGC", "GCCCGCGGC", # mouse-enriched: 5' G-shift flanking
588
+ "CCGCGCGCGG", "CCGCGCGCGG", # mouse MA0139.2 variant
589
+ }
590
+ _CTCF_CORES = _CTCF_CORES_HUMAN | _CTCF_CORES_MOUSE # union = default
591
+ _AP1_CORES = {
592
+ "TGACTCA", "TGAGTCA", # AP-1 canonical and common variant
593
+ }
594
+ _ETS_CORES = {
595
+ "CCGGAAGT", "ACTTCCGG", # ETS core 8-mer and RC
596
+ "CCGGAAGG", "CCTTCCGG", # ETS variant
597
+ }
598
+ _OPEN_CHROMATIN_MOTIFS = _CTCF_CORES_HUMAN | _CTCF_CORES_MOUSE | _AP1_CORES | _ETS_CORES
599
+ # Pure CTCF motifs only — for the CTCF-specific feature
600
+ _CTCF_MOTIFS_ONLY = _CTCF_CORES_HUMAN | _CTCF_CORES_MOUSE
601
+
602
+
603
+ def _open_chromatin_motif_score(sequence: str) -> float:
604
+ """
605
+ Fraction of possible positions containing any open-chromatin-associated
606
+ motif: CTCF cores (JASPAR MA0139.1/2), AP-1 (TGASTCA), or ETS (CCGGAAGT).
607
+
608
+ This is a composite 'open chromatin' signal — rename from the old
609
+ ctcf_motif_score which was a misnomer since it included AP-1 and ETS.
610
+
611
+ Returns a value in [0, 1]. Typical values:
612
+ Good ATAC-seq: 0.005 - 0.02 (rare but consistently present)
613
+ Poor/contaminated: < 0.001
614
+ Random sequence: ~0.001 (chance occurrence)
615
+ """
616
+ seq = sequence.upper()
617
+ n = len(seq)
618
+ if n < 5:
619
+ return 0.0
620
+ hits = sum(
621
+ 1
622
+ for motif in _OPEN_CHROMATIN_MOTIFS
623
+ for i in range(n - len(motif) + 1)
624
+ if seq[i:i+len(motif)] == motif
625
+ )
626
+ return hits / max(n - 4, 1)
627
+
628
+
629
+ def _ctcf_only_score(sequence: str) -> float:
630
+ """
631
+ Fraction of positions matching CTCF 9-mer cores only (JASPAR MA0139.1/2).
632
+ More specific than open_chromatin_motif_score — AP-1 and ETS excluded.
633
+ CTCF is the dominant insulator/boundary factor in mammalian genomes and
634
+ is strongly enriched at topological domain boundaries visible in ATAC-seq.
635
+
636
+ Returns a value in [0, 1]. Typical values similar to open_chromatin but
637
+ slightly lower since AP-1/ETS hits are excluded.
638
+ """
639
+ seq = sequence.upper()
640
+ n = len(seq)
641
+ if n < 9:
642
+ return 0.0
643
+ hits = sum(
644
+ 1
645
+ for motif in _CTCF_MOTIFS_ONLY
646
+ for i in range(n - len(motif) + 1)
647
+ if seq[i:i+len(motif)] == motif
648
+ )
649
+ return hits / max(n - 8, 1)
650
+
651
+
652
+
653
+ # ── Known adapter k-mers ──────────────────────────────────────────────────
654
+ _ADAPTER_KMERS = {
655
+ "AGATCG", "GATCGG", "ATCGGA", "TCGGAA", "CGGAAG", # TruSeq
656
+ "CTGTCT", "TGTCTC", "GTCTCC", "TCTCCT", # Nextera
657
+ "AAGCAG", "AGCAGT", "GCAGTA", "CAGTAC", # 10x TSO
658
+ "CCTACG", "CTACGG", "TACGGG", "ACGGGG", # 16S V3-V4
659
+ "TCGTCG", "CGTCGG", "GTCGGC", "TCGGCA", # Tn5 mosaic
660
+ }
661
+
662
+
663
+ def _adapter_signal(sequence: str) -> float:
664
+ seq = sequence.upper()
665
+ n = len(seq) - 5
666
+ if n <= 0:
667
+ return 0.0
668
+ hits = sum(1 for i in range(n) if seq[i : i + 6] in _ADAPTER_KMERS)
669
+ return hits / n
670
+
671
+
672
+ # ── Bimodality score ───────────────────────────────────────────────────────
673
+
674
+ def _bimodality_coefficient(values: list[float]) -> float:
675
+ """
676
+ Sarle's bimodality coefficient: bc = (skewness^2 + 1) / kurtosis.
677
+ Values > 0.555 suggest bimodal distribution.
678
+ ATAC-seq fragment sizes are characteristically bimodal.
679
+ """
680
+ arr = np.array(values, dtype=np.float64)
681
+ n = len(arr)
682
+ if n < 4:
683
+ return 0.0
684
+ mean = arr.mean()
685
+ std = arr.std()
686
+ if std == 0:
687
+ return 0.0
688
+ skew = float(np.mean(((arr - mean) / std) ** 3))
689
+ kurt = float(np.mean(((arr - mean) / std) ** 4))
690
+ if kurt == 0:
691
+ return 0.0
692
+ return (skew ** 2 + 1) / kurt
693
+
694
+
695
+
696
+ # ── Single-cell barcode / UMI structural features ─────────────────────────
697
+ #
698
+ # 10x Chromium single-cell libraries have a characteristic R1 structure:
699
+ # - 3' Gene Expression v2: 16bp barcode + 10bp UMI = 26bp R1
700
+ # - 3' Gene Expression v3: 16bp barcode + 12bp UMI = 28bp R1
701
+ # - 5' Gene Expression: 16bp barcode + 10bp UMI = 26bp R1
702
+ # - Chromium ATAC: 16bp barcode + 8bp spacer = 24bp R1 (R2/R3 are genomic)
703
+ # - Multiome ATAC: same as above
704
+ #
705
+ # These reads are distinctively short (24-28bp) with high sequence entropy in
706
+ # the barcode + UMI region (pseudo-random sequences). They do NOT contain
707
+ # meaningful genomic sequence on R1 — that's on R2.
708
+ #
709
+ # Two-layer approach:
710
+ # 1. Structural features — always computed, no external files needed.
711
+ # Captures the entropy and length signature of barcode+UMI reads.
712
+ # 2. Whitelist matching — optional, activates when 10x whitelist files are
713
+ # found at data/barcodes/ (see _load_10x_whitelist). Gives near-definitive
714
+ # classification when available.
715
+ #
716
+ # Whitelist files expected at (relative to working directory):
717
+ # data/barcodes/10x_v2.txt — 737,280 barcodes (3' v2, ATAC)
718
+ # data/barcodes/10x_v3.txt.gz — 6,794,880 barcodes (3' v3)
719
+ # Download from:
720
+ # https://github.com/10XGenomics/cellranger/tree/master/lib/python/cellranger/barcodes
721
+ # 737K-august-2016.txt → 10x_v2.txt
722
+ # 3M-february-2018.txt.gz → 10x_v3.txt.gz
723
+
724
+ _10X_BARCODE_LEN = 16
725
+ _10X_UMI_LENS = (8, 10, 12) # v1=8, v2/5'=10, v3=12
726
+
727
+ # Module-level cache for whitelist sets — loaded once on first use
728
+ _WHITELIST_CACHE: dict[str, set[str]] = {}
729
+
730
+
731
+ def _load_10x_whitelist(path_hint: str | None = None) -> set[str]:
732
+ """
733
+ Load 10x barcode whitelist into a set of 16bp strings.
734
+ Returns empty set if no whitelist file is found.
735
+ Caches result to avoid re-reading on every call.
736
+ """
737
+ global _WHITELIST_CACHE
738
+ cache_key = path_hint or "auto"
739
+ if cache_key in _WHITELIST_CACHE:
740
+ return _WHITELIST_CACHE[cache_key]
741
+
742
+ import gzip as _gz
743
+ from pathlib import Path as _Path
744
+
745
+ candidates = []
746
+ if path_hint:
747
+ candidates.append(_Path(path_hint))
748
+ # Auto-discover from common locations relative to cwd
749
+ for name in ["data/barcodes/3M-february-2018.txt.gz",
750
+ "data/barcodes/737K-august-2016.txt",
751
+ "data/barcodes/737K-cratac-v1.txt", # 10x ATAC-specific whitelist
752
+ "data/barcodes/10x_v3.txt.gz",
753
+ "data/barcodes/10x_v2.txt",
754
+ "data/barcodes/10x_atac.txt"]:
755
+ candidates.append(_Path(name))
756
+
757
+ barcodes: set[str] = set()
758
+ for p in candidates:
759
+ if not p.exists():
760
+ continue
761
+ try:
762
+ opener = _gz.open if p.suffix == ".gz" else open
763
+ n_before = len(barcodes)
764
+ with opener(p, "rt") as fh:
765
+ for line in fh:
766
+ bc = line.strip().split("-")[0] # strip -1 suffix if present
767
+ if len(bc) == _10X_BARCODE_LEN and all(c in "ACGT" for c in bc):
768
+ barcodes.add(bc)
769
+ if len(barcodes) >= 8_000_000: # safety cap
770
+ break
771
+ import logging as _logging
772
+ _logging.getLogger(__name__).info(
773
+ "Loaded %d 10x barcodes from %s (union total: %d)",
774
+ len(barcodes) - n_before, p, len(barcodes)
775
+ )
776
+ # Don't break — keep loading all whitelists to build the union
777
+ except Exception:
778
+ continue
779
+
780
+ _WHITELIST_CACHE[cache_key] = barcodes
781
+ return barcodes
782
+
783
+
784
+ def _barcode_match_score(sequence: str,
785
+ whitelist: set[str],
786
+ max_mm: int = 1) -> float:
787
+ """
788
+ Returns 1.0 if the first 16bp of the read matches any whitelist barcode
789
+ within max_mm mismatches, else 0.0.
790
+ Uses a split-half exact strategy for speed: a 16bp sequence with <=1
791
+ mismatch must have at least one exact 8bp half-match.
792
+ """
793
+ seq = sequence.upper()
794
+ if len(seq) < _10X_BARCODE_LEN:
795
+ return 0.0
796
+
797
+ candidate = seq[:_10X_BARCODE_LEN]
798
+
799
+ if max_mm == 0:
800
+ return 1.0 if candidate in whitelist else 0.0
801
+
802
+ # Fast 1-mismatch: check exact first, then each single-base substitution
803
+ if candidate in whitelist:
804
+ return 1.0
805
+ for i in range(_10X_BARCODE_LEN):
806
+ for base in "ACGT":
807
+ if base != candidate[i]:
808
+ mutant = candidate[:i] + base + candidate[i+1:]
809
+ if mutant in whitelist:
810
+ return 1.0
811
+ return 0.0
812
+
813
+
814
+ def _barcode_region_entropy(sequence: str) -> float:
815
+ """
816
+ Shannon entropy of the first 16bp (barcode region).
817
+ High entropy (~2.0 bits) in real barcodes; low in genomic or adapter sequence.
818
+ """
819
+ return _shannon_entropy(sequence[:_10X_BARCODE_LEN])
820
+
821
+
822
+ def _umi_region_entropy(sequence: str) -> float:
823
+ """
824
+ Shannon entropy of positions 17-28 (UMI region for 10x v3).
825
+ High entropy in UMIs; structured/low in adapter/genomic R1.
826
+ Returns 0 if read is too short.
827
+ """
828
+ region = sequence[_10X_BARCODE_LEN:_10X_BARCODE_LEN + 12]
829
+ if len(region) < 4:
830
+ return 0.0
831
+ return _shannon_entropy(region)
832
+
833
+
834
+ # ── Main extractor ─────────────────────────────────────────────────────────
835
+
836
+ class FeatureExtractor:
837
+ """
838
+ Transforms a list of FastqRecord objects into a 1-D numpy feature vector.
839
+
840
+ Parameters
841
+ ----------
842
+ kmer_sizes : list of k values for k-mer frequency features (default [2, 3, 4])
843
+ include_quality : if False, all 9 Phred quality score features are omitted.
844
+ Quality features showed net-negative permutation importance in benchmarks —
845
+ they encode platform-specific artifacts that hurt generalisation. Set False
846
+ for production models; True to retain for diagnostic analysis.
847
+ whitelist_path : optional path to a 10x barcode whitelist file. If None,
848
+ auto-discovery is attempted from data/barcodes/. If no file is found,
849
+ whitelist-based matching is skipped but structural barcode features
850
+ (entropy, length) are still computed.
851
+ """
852
+
853
+ def __init__(
854
+ self,
855
+ kmer_sizes: list[int] | None = None,
856
+ include_quality: bool = False,
857
+ whitelist_path: str | None = None,
858
+ ):
859
+ self.kmer_sizes: list[int] = kmer_sizes or [2, 3, 4]
860
+ self.include_quality = include_quality
861
+ self._whitelist: set[str] = _load_10x_whitelist(whitelist_path)
862
+ self._has_whitelist = len(self._whitelist) > 0
863
+ self._kmer_keys: list[str] = []
864
+ for k in self.kmer_sizes:
865
+ self._kmer_keys.extend([f"kmer{k}_{kmer}" for kmer in _all_kmers(k)])
866
+ self.feature_names: list[str] = self._build_feature_names()
867
+
868
+ def _build_feature_names(self) -> list[str]:
869
+ names = [
870
+ # Read length — distribution shape, not just mean
871
+ "rl_mean", "rl_std", "rl_min", "rl_max", "rl_median",
872
+ "rl_q25", "rl_q75",
873
+ "rl_skewness", # asymmetry of length distribution
874
+ "rl_cv", # coefficient of variation (std/mean)
875
+ "rl_frac_short", # fraction of reads < 75bp
876
+ "rl_frac_long", # fraction of reads > 200bp
877
+ "rl_bimodality", # Sarle's BC — high for ATAC-seq
878
+ # Nucleotide fractions
879
+ "nuc_A", "nuc_C", "nuc_G", "nuc_T", "nuc_N",
880
+ # GC content
881
+ "gc_mean", "gc_std", "gc_skewness",
882
+ ]
883
+
884
+ if self.include_quality:
885
+ # Quality score features — net-negative permutation importance in
886
+ # benchmarks (encode platform-specific artefacts). Excluded by default.
887
+ names += [
888
+ "qual_mean", "qual_std", "qual_min", "qual_max",
889
+ "qual_q25", "qual_q75",
890
+ "qual_frac_lt20", "qual_frac_lt30",
891
+ "qual_positional_decay",
892
+ ]
893
+
894
+ names += [
895
+ # Sequence complexity
896
+ "entropy_mean", "entropy_std",
897
+ "linguistic_complexity_mean",
898
+ "homopolymer_mean",
899
+ # Adapter signal
900
+ "adapter_signal_mean",
901
+ # Sequence composition signals (read-length-independent)
902
+ "cpg_ratio_mean", # bisulfite signature
903
+ "ga_ct_bias_mean", # Tn5 insertion bias (ATAC/CUT&Tag) — global
904
+ "polya_signal_mean", # RNA-seq poly-A selection signature
905
+ # Motif-based signals
906
+ "tn5_start_score_mean", # Tn5 PSSM score at read start (positions 1-15)
907
+ "open_chromatin_motif_score_mean", # CTCF + AP-1 + ETS motif enrichment
908
+ # Note: renamed from ctcf_motif_score_mean — that was a misnomer since
909
+ # AP-1 and ETS motifs were included. Use ctcf_only_score_mean for pure CTCF.
910
+ "ctcf_only_score_mean", # CTCF 9-mer cores only (JASPAR MA0139.1/2)
911
+ # Library-type discriminators
912
+ "bisulfite_c_fraction", # raw C% — severely depleted in bisulfite R1
913
+ "repeat_kmer_fraction", # simple repeat k-mer rate — high in WGS, low in ChIP
914
+ "nucleosome_periodicity", # fraction of reads at nucleosome-multiple lengths
915
+ # MNase cleavage start signal (CUT&RUN vs ChIP-seq / CUT&Tag)
916
+ "mnase_start_score_mean", # AT-rich read starts from MNase cleavage
917
+ # Note: is_16s_primer_mean removed — most public 16S data is submitted
918
+ # after primer trimming so reads do not start with primer sequence.
919
+ # 16S is well-separated by rl_mean alone (fixed amplicon length).
920
+ # GC tail fractions (PCR bias / bisulfite / amplicon discrimination)
921
+ "gc_tail_low_frac", # fraction of reads with GC < 30%
922
+ "gc_tail_high_frac", # fraction of reads with GC > 70%
923
+ # Single-cell barcode / UMI structural features
924
+ # Captures 10x Chromium R1 structure (16bp barcode + UMI)
925
+ "barcode_region_entropy", # entropy of first 16bp — high in barcodes
926
+ "umi_region_entropy", # entropy of bp 17-28 — high in UMIs
927
+ "rl_is_barcode", # 1 if modal read length is 24-28bp (10x R1 length)
928
+ # Note: raw FASTQ reads are uniform length within a file, so this is
929
+ # effectively binary (0 or 1) — cleaner than rl_frac_28 which was
930
+ # always 0 or 1 anyway since all reads in a file are the same length.
931
+ "barcode_match_frac", # fraction matching 10x whitelist (0 if no whitelist)
932
+ ]
933
+ names.extend(self._kmer_keys)
934
+ return names
935
+
936
+ def extract(self, records: Sequence[FastqRecord]) -> np.ndarray:
937
+ if not records:
938
+ return np.zeros(len(self.feature_names), dtype=np.float32)
939
+
940
+ read_lengths: list[int] = []
941
+ nuc_counts: Counter[str] = Counter()
942
+ gc_fracs: list[float] = []
943
+ qual_scores_all: list[float] = []
944
+ qual_lt20: list[float] = []
945
+ qual_lt30: list[float] = []
946
+ qual_q25_all: list[float] = []
947
+ qual_q75_all: list[float] = []
948
+ qual_decay: list[float] = []
949
+ entropies: list[float] = []
950
+ ling_complexities: list[float] = []
951
+ homopolymers: list[float] = []
952
+ adapter_signals: list[float] = []
953
+ cpg_ratios: list[float] = []
954
+ ga_ct_biases: list[float] = []
955
+ polya_signals: list[float] = []
956
+ tn5_start_scores: list[float] = []
957
+ ctcf_motif_scores: list[float] = []
958
+ ctcf_only_scores: list[float] = []
959
+ bisulfite_c_fracs: list[float] = []
960
+ repeat_kmer_fracs: list[float] = []
961
+ mnase_start_scores: list[float] = []
962
+ barcode_entropies: list[float] = []
963
+ umi_entropies: list[float] = []
964
+ barcode_matches: list[float] = []
965
+ kmer_vecs: list[dict[str, float]] = [dict() for _ in self.kmer_sizes]
966
+
967
+ for rec in records:
968
+ seq = rec.sequence.upper()
969
+ n = len(seq)
970
+ read_lengths.append(n)
971
+
972
+ c = Counter(seq)
973
+ nuc_counts.update(c)
974
+ gc = (c.get("G", 0) + c.get("C", 0)) / max(n, 1)
975
+ gc_fracs.append(gc)
976
+
977
+ qs = _qual_scores(rec.quality)
978
+ if qs and self.include_quality:
979
+ qual_scores_all.extend(qs)
980
+ qa = np.array(qs, dtype=np.float32)
981
+ qual_lt20.append(float((qa < 20).mean()))
982
+ qual_lt30.append(float((qa < 30).mean()))
983
+ qual_q25_all.append(float(np.percentile(qa, 25)))
984
+ qual_q75_all.append(float(np.percentile(qa, 75)))
985
+ qual_decay.append(_qual_positional_decay(rec.quality))
986
+
987
+ entropies.append(_shannon_entropy(seq))
988
+ ling_complexities.append(_linguistic_complexity(seq))
989
+ homopolymers.append(_homopolymer_rate(seq))
990
+ adapter_signals.append(_adapter_signal(seq))
991
+ cpg_ratios.append(_cpg_ratio(seq))
992
+ ga_ct_biases.append(_ga_ct_bias(seq))
993
+ polya_signals.append(_polya_signal(seq))
994
+ tn5_start_scores.append(_tn5_start_score(seq))
995
+ ctcf_motif_scores.append(_open_chromatin_motif_score(seq))
996
+ ctcf_only_scores.append(_ctcf_only_score(seq))
997
+ bisulfite_c_fracs.append(_bisulfite_ct_conversion(seq))
998
+ repeat_kmer_fracs.append(_repeat_kmer_fraction(seq))
999
+ mnase_start_scores.append(_mnase_start_score(seq))
1000
+ barcode_entropies.append(_barcode_region_entropy(seq))
1001
+ umi_entropies.append(_umi_region_entropy(seq))
1002
+ if self._has_whitelist:
1003
+ barcode_matches.append(_barcode_match_score(seq, self._whitelist))
1004
+
1005
+ for ki, k in enumerate(self.kmer_sizes):
1006
+ kf = _kmer_freq(seq, k)
1007
+ for key, val in kf.items():
1008
+ kmer_vecs[ki][f"kmer{k}_{key}"] = kmer_vecs[ki].get(f"kmer{k}_{key}", 0.0) + val
1009
+
1010
+ n_reads = len(records)
1011
+ kmer_mean: dict[str, float] = {}
1012
+ for ki in range(len(self.kmer_sizes)):
1013
+ for key, val in kmer_vecs[ki].items():
1014
+ kmer_mean[key] = val / n_reads
1015
+
1016
+ rl = np.array(read_lengths, dtype=np.float64)
1017
+ gc = np.array(gc_fracs, dtype=np.float64)
1018
+ qs_arr = np.array(qual_scores_all, dtype=np.float64) if qual_scores_all else np.array([0.0])
1019
+ total_bases = int(rl.sum())
1020
+ nuc_total = max(total_bases, 1)
1021
+
1022
+ # Read length shape features
1023
+ rl_mean = float(rl.mean())
1024
+ rl_std = float(rl.std())
1025
+ rl_skew = float(np.mean(((rl - rl_mean) / max(rl_std, 1e-6)) ** 3))
1026
+ rl_cv = rl_std / max(rl_mean, 1.0)
1027
+
1028
+ feature_vec: dict[str, float] = {
1029
+ "rl_mean": rl_mean,
1030
+ "rl_std": rl_std,
1031
+ "rl_min": float(rl.min()),
1032
+ "rl_max": float(rl.max()),
1033
+ "rl_median": float(np.median(rl)),
1034
+ "rl_q25": float(np.percentile(rl, 25)),
1035
+ "rl_q75": float(np.percentile(rl, 75)),
1036
+ "rl_skewness": rl_skew,
1037
+ "rl_cv": rl_cv,
1038
+ "rl_frac_short": float((rl < 75).mean()),
1039
+ "rl_frac_long": float((rl > 200).mean()),
1040
+ "rl_bimodality": _bimodality_coefficient(read_lengths),
1041
+ "nuc_A": nuc_counts.get("A", 0) / nuc_total,
1042
+ "nuc_C": nuc_counts.get("C", 0) / nuc_total,
1043
+ "nuc_G": nuc_counts.get("G", 0) / nuc_total,
1044
+ "nuc_T": nuc_counts.get("T", 0) / nuc_total,
1045
+ "nuc_N": nuc_counts.get("N", 0) / nuc_total,
1046
+ "gc_mean": float(gc.mean()),
1047
+ "gc_std": float(gc.std()),
1048
+ "gc_skewness": float(np.mean(((gc - gc.mean()) / max(gc.std(), 1e-6)) ** 3)),
1049
+ }
1050
+
1051
+ if self.include_quality:
1052
+ feature_vec.update({
1053
+ "qual_mean": float(qs_arr.mean()),
1054
+ "qual_std": float(qs_arr.std()),
1055
+ "qual_min": float(qs_arr.min()),
1056
+ "qual_max": float(qs_arr.max()),
1057
+ "qual_q25": float(np.mean(qual_q25_all)) if qual_q25_all else 0.0,
1058
+ "qual_q75": float(np.mean(qual_q75_all)) if qual_q75_all else 0.0,
1059
+ "qual_frac_lt20": float(np.mean(qual_lt20)) if qual_lt20 else 0.0,
1060
+ "qual_frac_lt30": float(np.mean(qual_lt30)) if qual_lt30 else 0.0,
1061
+ "qual_positional_decay": float(np.mean(qual_decay)) if qual_decay else 1.0,
1062
+ })
1063
+
1064
+ feature_vec.update({
1065
+ "entropy_mean": float(np.mean(entropies)),
1066
+ "entropy_std": float(np.std(entropies)),
1067
+ "linguistic_complexity_mean": float(np.mean(ling_complexities)),
1068
+ "homopolymer_mean": float(np.mean(homopolymers)),
1069
+ "adapter_signal_mean": float(np.mean(adapter_signals)),
1070
+ "cpg_ratio_mean": float(np.mean(cpg_ratios)),
1071
+ "ga_ct_bias_mean": float(np.mean(ga_ct_biases)),
1072
+ "polya_signal_mean": float(np.mean(polya_signals)),
1073
+ "tn5_start_score_mean": float(np.mean(tn5_start_scores)),
1074
+ "open_chromatin_motif_score_mean": float(np.mean(ctcf_motif_scores)),
1075
+ "ctcf_only_score_mean": float(np.mean(ctcf_only_scores)),
1076
+ "bisulfite_c_fraction": float(np.mean(bisulfite_c_fracs)),
1077
+ "repeat_kmer_fraction": float(np.mean(repeat_kmer_fracs)),
1078
+ "nucleosome_periodicity": _nucleosome_periodicity(read_lengths),
1079
+ "mnase_start_score_mean": float(np.mean(mnase_start_scores)),
1080
+ })
1081
+ gc_tail_low, gc_tail_high = _gc_tail_fractions(gc_fracs)
1082
+ feature_vec["gc_tail_low_frac"] = gc_tail_low
1083
+ feature_vec["gc_tail_high_frac"] = gc_tail_high
1084
+ feature_vec["barcode_region_entropy"] = float(np.mean(barcode_entropies))
1085
+ feature_vec["umi_region_entropy"] = float(np.mean(umi_entropies))
1086
+ # rl_is_barcode: 1 if uniform read length falls in 24-28bp range (10x R1).
1087
+ # Raw FASTQs are uniform length so median = all reads; this is binary per file.
1088
+ modal_rl = float(np.median(read_lengths))
1089
+ feature_vec["rl_is_barcode"] = 1.0 if 24 <= modal_rl <= 28 else 0.0
1090
+ feature_vec["barcode_match_frac"] = (float(np.mean(barcode_matches))
1091
+ if barcode_matches else 0.0)
1092
+ feature_vec.update(kmer_mean)
1093
+
1094
+ return np.array(
1095
+ [feature_vec.get(name, 0.0) for name in self.feature_names],
1096
+ dtype=np.float32,
1097
+ )
1098
+
1099
+ def save_feature_names(self, path: Path) -> None:
1100
+ path.write_text(json.dumps(self.feature_names, indent=2))
1101
+
1102
+ @classmethod
1103
+ def from_feature_names_file(cls, path: Path,
1104
+ whitelist_path: str | None = None) -> "FeatureExtractor":
1105
+ names = json.loads(path.read_text())
1106
+ kmer_sizes = sorted(
1107
+ set(int(n.split("_")[0][4:]) for n in names if n.startswith("kmer"))
1108
+ )
1109
+ include_quality = "qual_mean" in names
1110
+ obj = cls(kmer_sizes=kmer_sizes or [2, 3, 4],
1111
+ include_quality=include_quality,
1112
+ whitelist_path=whitelist_path)
1113
+ obj.feature_names = names
1114
+ return obj
app/models/feature_names.json ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ "rl_mean",
3
+ "rl_std",
4
+ "rl_min",
5
+ "rl_max",
6
+ "rl_median",
7
+ "rl_q25",
8
+ "rl_q75",
9
+ "rl_skewness",
10
+ "rl_cv",
11
+ "rl_frac_short",
12
+ "rl_frac_long",
13
+ "rl_bimodality",
14
+ "nuc_A",
15
+ "nuc_C",
16
+ "nuc_G",
17
+ "nuc_T",
18
+ "nuc_N",
19
+ "gc_mean",
20
+ "gc_std",
21
+ "gc_skewness",
22
+ "entropy_mean",
23
+ "entropy_std",
24
+ "linguistic_complexity_mean",
25
+ "homopolymer_mean",
26
+ "adapter_signal_mean",
27
+ "cpg_ratio_mean",
28
+ "ga_ct_bias_mean",
29
+ "polya_signal_mean",
30
+ "tn5_start_score_mean",
31
+ "open_chromatin_motif_score_mean",
32
+ "ctcf_only_score_mean",
33
+ "bisulfite_c_fraction",
34
+ "repeat_kmer_fraction",
35
+ "nucleosome_periodicity",
36
+ "mnase_start_score_mean",
37
+ "gc_tail_low_frac",
38
+ "gc_tail_high_frac",
39
+ "barcode_region_entropy",
40
+ "umi_region_entropy",
41
+ "rl_is_barcode",
42
+ "barcode_match_frac",
43
+ "kmer2_AA",
44
+ "kmer2_AC",
45
+ "kmer2_AG",
46
+ "kmer2_AT",
47
+ "kmer2_CA",
48
+ "kmer2_CC",
49
+ "kmer2_CG",
50
+ "kmer2_CT",
51
+ "kmer2_GA",
52
+ "kmer2_GC",
53
+ "kmer2_GG",
54
+ "kmer2_GT",
55
+ "kmer2_TA",
56
+ "kmer2_TC",
57
+ "kmer2_TG",
58
+ "kmer2_TT",
59
+ "kmer3_AAA",
60
+ "kmer3_AAC",
61
+ "kmer3_AAG",
62
+ "kmer3_AAT",
63
+ "kmer3_ACA",
64
+ "kmer3_ACC",
65
+ "kmer3_ACG",
66
+ "kmer3_ACT",
67
+ "kmer3_AGA",
68
+ "kmer3_AGC",
69
+ "kmer3_AGG",
70
+ "kmer3_AGT",
71
+ "kmer3_ATA",
72
+ "kmer3_ATC",
73
+ "kmer3_ATG",
74
+ "kmer3_ATT",
75
+ "kmer3_CAA",
76
+ "kmer3_CAC",
77
+ "kmer3_CAG",
78
+ "kmer3_CAT",
79
+ "kmer3_CCA",
80
+ "kmer3_CCC",
81
+ "kmer3_CCG",
82
+ "kmer3_CCT",
83
+ "kmer3_CGA",
84
+ "kmer3_CGC",
85
+ "kmer3_CGG",
86
+ "kmer3_CGT",
87
+ "kmer3_CTA",
88
+ "kmer3_CTC",
89
+ "kmer3_CTG",
90
+ "kmer3_CTT",
91
+ "kmer3_GAA",
92
+ "kmer3_GAC",
93
+ "kmer3_GAG",
94
+ "kmer3_GAT",
95
+ "kmer3_GCA",
96
+ "kmer3_GCC",
97
+ "kmer3_GCG",
98
+ "kmer3_GCT",
99
+ "kmer3_GGA",
100
+ "kmer3_GGC",
101
+ "kmer3_GGG",
102
+ "kmer3_GGT",
103
+ "kmer3_GTA",
104
+ "kmer3_GTC",
105
+ "kmer3_GTG",
106
+ "kmer3_GTT",
107
+ "kmer3_TAA",
108
+ "kmer3_TAC",
109
+ "kmer3_TAG",
110
+ "kmer3_TAT",
111
+ "kmer3_TCA",
112
+ "kmer3_TCC",
113
+ "kmer3_TCG",
114
+ "kmer3_TCT",
115
+ "kmer3_TGA",
116
+ "kmer3_TGC",
117
+ "kmer3_TGG",
118
+ "kmer3_TGT",
119
+ "kmer3_TTA",
120
+ "kmer3_TTC",
121
+ "kmer3_TTG",
122
+ "kmer3_TTT",
123
+ "kmer4_AAAA",
124
+ "kmer4_AAAC",
125
+ "kmer4_AAAG",
126
+ "kmer4_AAAT",
127
+ "kmer4_AACA",
128
+ "kmer4_AACC",
129
+ "kmer4_AACG",
130
+ "kmer4_AACT",
131
+ "kmer4_AAGA",
132
+ "kmer4_AAGC",
133
+ "kmer4_AAGG",
134
+ "kmer4_AAGT",
135
+ "kmer4_AATA",
136
+ "kmer4_AATC",
137
+ "kmer4_AATG",
138
+ "kmer4_AATT",
139
+ "kmer4_ACAA",
140
+ "kmer4_ACAC",
141
+ "kmer4_ACAG",
142
+ "kmer4_ACAT",
143
+ "kmer4_ACCA",
144
+ "kmer4_ACCC",
145
+ "kmer4_ACCG",
146
+ "kmer4_ACCT",
147
+ "kmer4_ACGA",
148
+ "kmer4_ACGC",
149
+ "kmer4_ACGG",
150
+ "kmer4_ACGT",
151
+ "kmer4_ACTA",
152
+ "kmer4_ACTC",
153
+ "kmer4_ACTG",
154
+ "kmer4_ACTT",
155
+ "kmer4_AGAA",
156
+ "kmer4_AGAC",
157
+ "kmer4_AGAG",
158
+ "kmer4_AGAT",
159
+ "kmer4_AGCA",
160
+ "kmer4_AGCC",
161
+ "kmer4_AGCG",
162
+ "kmer4_AGCT",
163
+ "kmer4_AGGA",
164
+ "kmer4_AGGC",
165
+ "kmer4_AGGG",
166
+ "kmer4_AGGT",
167
+ "kmer4_AGTA",
168
+ "kmer4_AGTC",
169
+ "kmer4_AGTG",
170
+ "kmer4_AGTT",
171
+ "kmer4_ATAA",
172
+ "kmer4_ATAC",
173
+ "kmer4_ATAG",
174
+ "kmer4_ATAT",
175
+ "kmer4_ATCA",
176
+ "kmer4_ATCC",
177
+ "kmer4_ATCG",
178
+ "kmer4_ATCT",
179
+ "kmer4_ATGA",
180
+ "kmer4_ATGC",
181
+ "kmer4_ATGG",
182
+ "kmer4_ATGT",
183
+ "kmer4_ATTA",
184
+ "kmer4_ATTC",
185
+ "kmer4_ATTG",
186
+ "kmer4_ATTT",
187
+ "kmer4_CAAA",
188
+ "kmer4_CAAC",
189
+ "kmer4_CAAG",
190
+ "kmer4_CAAT",
191
+ "kmer4_CACA",
192
+ "kmer4_CACC",
193
+ "kmer4_CACG",
194
+ "kmer4_CACT",
195
+ "kmer4_CAGA",
196
+ "kmer4_CAGC",
197
+ "kmer4_CAGG",
198
+ "kmer4_CAGT",
199
+ "kmer4_CATA",
200
+ "kmer4_CATC",
201
+ "kmer4_CATG",
202
+ "kmer4_CATT",
203
+ "kmer4_CCAA",
204
+ "kmer4_CCAC",
205
+ "kmer4_CCAG",
206
+ "kmer4_CCAT",
207
+ "kmer4_CCCA",
208
+ "kmer4_CCCC",
209
+ "kmer4_CCCG",
210
+ "kmer4_CCCT",
211
+ "kmer4_CCGA",
212
+ "kmer4_CCGC",
213
+ "kmer4_CCGG",
214
+ "kmer4_CCGT",
215
+ "kmer4_CCTA",
216
+ "kmer4_CCTC",
217
+ "kmer4_CCTG",
218
+ "kmer4_CCTT",
219
+ "kmer4_CGAA",
220
+ "kmer4_CGAC",
221
+ "kmer4_CGAG",
222
+ "kmer4_CGAT",
223
+ "kmer4_CGCA",
224
+ "kmer4_CGCC",
225
+ "kmer4_CGCG",
226
+ "kmer4_CGCT",
227
+ "kmer4_CGGA",
228
+ "kmer4_CGGC",
229
+ "kmer4_CGGG",
230
+ "kmer4_CGGT",
231
+ "kmer4_CGTA",
232
+ "kmer4_CGTC",
233
+ "kmer4_CGTG",
234
+ "kmer4_CGTT",
235
+ "kmer4_CTAA",
236
+ "kmer4_CTAC",
237
+ "kmer4_CTAG",
238
+ "kmer4_CTAT",
239
+ "kmer4_CTCA",
240
+ "kmer4_CTCC",
241
+ "kmer4_CTCG",
242
+ "kmer4_CTCT",
243
+ "kmer4_CTGA",
244
+ "kmer4_CTGC",
245
+ "kmer4_CTGG",
246
+ "kmer4_CTGT",
247
+ "kmer4_CTTA",
248
+ "kmer4_CTTC",
249
+ "kmer4_CTTG",
250
+ "kmer4_CTTT",
251
+ "kmer4_GAAA",
252
+ "kmer4_GAAC",
253
+ "kmer4_GAAG",
254
+ "kmer4_GAAT",
255
+ "kmer4_GACA",
256
+ "kmer4_GACC",
257
+ "kmer4_GACG",
258
+ "kmer4_GACT",
259
+ "kmer4_GAGA",
260
+ "kmer4_GAGC",
261
+ "kmer4_GAGG",
262
+ "kmer4_GAGT",
263
+ "kmer4_GATA",
264
+ "kmer4_GATC",
265
+ "kmer4_GATG",
266
+ "kmer4_GATT",
267
+ "kmer4_GCAA",
268
+ "kmer4_GCAC",
269
+ "kmer4_GCAG",
270
+ "kmer4_GCAT",
271
+ "kmer4_GCCA",
272
+ "kmer4_GCCC",
273
+ "kmer4_GCCG",
274
+ "kmer4_GCCT",
275
+ "kmer4_GCGA",
276
+ "kmer4_GCGC",
277
+ "kmer4_GCGG",
278
+ "kmer4_GCGT",
279
+ "kmer4_GCTA",
280
+ "kmer4_GCTC",
281
+ "kmer4_GCTG",
282
+ "kmer4_GCTT",
283
+ "kmer4_GGAA",
284
+ "kmer4_GGAC",
285
+ "kmer4_GGAG",
286
+ "kmer4_GGAT",
287
+ "kmer4_GGCA",
288
+ "kmer4_GGCC",
289
+ "kmer4_GGCG",
290
+ "kmer4_GGCT",
291
+ "kmer4_GGGA",
292
+ "kmer4_GGGC",
293
+ "kmer4_GGGG",
294
+ "kmer4_GGGT",
295
+ "kmer4_GGTA",
296
+ "kmer4_GGTC",
297
+ "kmer4_GGTG",
298
+ "kmer4_GGTT",
299
+ "kmer4_GTAA",
300
+ "kmer4_GTAC",
301
+ "kmer4_GTAG",
302
+ "kmer4_GTAT",
303
+ "kmer4_GTCA",
304
+ "kmer4_GTCC",
305
+ "kmer4_GTCG",
306
+ "kmer4_GTCT",
307
+ "kmer4_GTGA",
308
+ "kmer4_GTGC",
309
+ "kmer4_GTGG",
310
+ "kmer4_GTGT",
311
+ "kmer4_GTTA",
312
+ "kmer4_GTTC",
313
+ "kmer4_GTTG",
314
+ "kmer4_GTTT",
315
+ "kmer4_TAAA",
316
+ "kmer4_TAAC",
317
+ "kmer4_TAAG",
318
+ "kmer4_TAAT",
319
+ "kmer4_TACA",
320
+ "kmer4_TACC",
321
+ "kmer4_TACG",
322
+ "kmer4_TACT",
323
+ "kmer4_TAGA",
324
+ "kmer4_TAGC",
325
+ "kmer4_TAGG",
326
+ "kmer4_TAGT",
327
+ "kmer4_TATA",
328
+ "kmer4_TATC",
329
+ "kmer4_TATG",
330
+ "kmer4_TATT",
331
+ "kmer4_TCAA",
332
+ "kmer4_TCAC",
333
+ "kmer4_TCAG",
334
+ "kmer4_TCAT",
335
+ "kmer4_TCCA",
336
+ "kmer4_TCCC",
337
+ "kmer4_TCCG",
338
+ "kmer4_TCCT",
339
+ "kmer4_TCGA",
340
+ "kmer4_TCGC",
341
+ "kmer4_TCGG",
342
+ "kmer4_TCGT",
343
+ "kmer4_TCTA",
344
+ "kmer4_TCTC",
345
+ "kmer4_TCTG",
346
+ "kmer4_TCTT",
347
+ "kmer4_TGAA",
348
+ "kmer4_TGAC",
349
+ "kmer4_TGAG",
350
+ "kmer4_TGAT",
351
+ "kmer4_TGCA",
352
+ "kmer4_TGCC",
353
+ "kmer4_TGCG",
354
+ "kmer4_TGCT",
355
+ "kmer4_TGGA",
356
+ "kmer4_TGGC",
357
+ "kmer4_TGGG",
358
+ "kmer4_TGGT",
359
+ "kmer4_TGTA",
360
+ "kmer4_TGTC",
361
+ "kmer4_TGTG",
362
+ "kmer4_TGTT",
363
+ "kmer4_TTAA",
364
+ "kmer4_TTAC",
365
+ "kmer4_TTAG",
366
+ "kmer4_TTAT",
367
+ "kmer4_TTCA",
368
+ "kmer4_TTCC",
369
+ "kmer4_TTCG",
370
+ "kmer4_TTCT",
371
+ "kmer4_TTGA",
372
+ "kmer4_TTGC",
373
+ "kmer4_TTGG",
374
+ "kmer4_TTGT",
375
+ "kmer4_TTTA",
376
+ "kmer4_TTTC",
377
+ "kmer4_TTTG",
378
+ "kmer4_TTTT"
379
+ ]
app/models/label_encoder.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e6e6fb27b929c8a663b428b8785dd1df644870fcb998f0c8c5496c34bc7d275
3
+ size 608
app/models/model_meta.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "HistGradientBoostingClassifier",
3
+ "model_params": {
4
+ "max_iter": 300,
5
+ "max_depth": 6,
6
+ "learning_rate": 0.1,
7
+ "min_samples_leaf": 20,
8
+ "l2_regularization": 1.0,
9
+ "random_state": 42,
10
+ "class_weight": "balanced"
11
+ },
12
+ "n_classes": 12,
13
+ "classes": [
14
+ "amplicon_16s",
15
+ "atac_seq",
16
+ "bisulfite",
17
+ "chip_seq",
18
+ "cut_and_run",
19
+ "cut_and_tag",
20
+ "rna_seq",
21
+ "sc_atac_seq",
22
+ "sc_rna_seq",
23
+ "spatial",
24
+ "wes",
25
+ "wgs"
26
+ ],
27
+ "n_features": 377,
28
+ "test_accuracy": 0.9142,
29
+ "cv_accuracy_mean": 0.9138,
30
+ "cv_accuracy_std": 0.0059,
31
+ "train_samples": 9597,
32
+ "test_samples": 2400
33
+ }
app/models/quality_norm.json ADDED
@@ -0,0 +1,3686 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tn5_start_score_mean": {
3
+ "amplicon_16s": {
4
+ "percentiles": [
5
+ 0,
6
+ 5,
7
+ 10,
8
+ 15,
9
+ 20,
10
+ 25,
11
+ 30,
12
+ 35,
13
+ 40,
14
+ 45,
15
+ 50,
16
+ 55,
17
+ 60,
18
+ 65,
19
+ 70,
20
+ 75,
21
+ 80,
22
+ 85,
23
+ 90,
24
+ 95,
25
+ 100
26
+ ],
27
+ "values": [
28
+ 0.0,
29
+ 0.000894,
30
+ 0.001984,
31
+ 0.005594,
32
+ 0.008631,
33
+ 0.011937,
34
+ 0.016044,
35
+ 0.025043,
36
+ 0.040778,
37
+ 0.061344,
38
+ 0.071632,
39
+ 0.081447,
40
+ 0.096491,
41
+ 0.118351,
42
+ 0.147888,
43
+ 0.217823,
44
+ 0.302702,
45
+ 0.329214,
46
+ 0.365571,
47
+ 0.408725,
48
+ 0.479844
49
+ ],
50
+ "median": 0.071632,
51
+ "p25": 0.011937,
52
+ "p75": 0.217823
53
+ },
54
+ "atac_seq": {
55
+ "percentiles": [
56
+ 0,
57
+ 5,
58
+ 10,
59
+ 15,
60
+ 20,
61
+ 25,
62
+ 30,
63
+ 35,
64
+ 40,
65
+ 45,
66
+ 50,
67
+ 55,
68
+ 60,
69
+ 65,
70
+ 70,
71
+ 75,
72
+ 80,
73
+ 85,
74
+ 90,
75
+ 95,
76
+ 100
77
+ ],
78
+ "values": [
79
+ 0.0,
80
+ 0.145855,
81
+ 0.177172,
82
+ 0.179384,
83
+ 0.180867,
84
+ 0.182179,
85
+ 0.183571,
86
+ 0.184897,
87
+ 0.18629,
88
+ 0.187548,
89
+ 0.18875,
90
+ 0.189789,
91
+ 0.190764,
92
+ 0.192102,
93
+ 0.192975,
94
+ 0.193861,
95
+ 0.194966,
96
+ 0.195841,
97
+ 0.197406,
98
+ 0.200211,
99
+ 0.28489
100
+ ],
101
+ "median": 0.18875,
102
+ "p25": 0.182179,
103
+ "p75": 0.193861
104
+ },
105
+ "bisulfite": {
106
+ "percentiles": [
107
+ 0,
108
+ 5,
109
+ 10,
110
+ 15,
111
+ 20,
112
+ 25,
113
+ 30,
114
+ 35,
115
+ 40,
116
+ 45,
117
+ 50,
118
+ 55,
119
+ 60,
120
+ 65,
121
+ 70,
122
+ 75,
123
+ 80,
124
+ 85,
125
+ 90,
126
+ 95,
127
+ 100
128
+ ],
129
+ "values": [
130
+ 0.0,
131
+ 0.042148,
132
+ 0.048197,
133
+ 0.054105,
134
+ 0.057491,
135
+ 0.062648,
136
+ 0.070771,
137
+ 0.085776,
138
+ 0.099435,
139
+ 0.102149,
140
+ 0.10453,
141
+ 0.112649,
142
+ 0.118852,
143
+ 0.1234,
144
+ 0.128853,
145
+ 0.132511,
146
+ 0.135332,
147
+ 0.141876,
148
+ 0.147758,
149
+ 0.156751,
150
+ 0.246707
151
+ ],
152
+ "median": 0.10453,
153
+ "p25": 0.062648,
154
+ "p75": 0.132511
155
+ },
156
+ "chip_seq": {
157
+ "percentiles": [
158
+ 0,
159
+ 5,
160
+ 10,
161
+ 15,
162
+ 20,
163
+ 25,
164
+ 30,
165
+ 35,
166
+ 40,
167
+ 45,
168
+ 50,
169
+ 55,
170
+ 60,
171
+ 65,
172
+ 70,
173
+ 75,
174
+ 80,
175
+ 85,
176
+ 90,
177
+ 95,
178
+ 100
179
+ ],
180
+ "values": [
181
+ 0.0,
182
+ 0.062441,
183
+ 0.067703,
184
+ 0.081922,
185
+ 0.096405,
186
+ 0.098223,
187
+ 0.099266,
188
+ 0.09975,
189
+ 0.100193,
190
+ 0.100623,
191
+ 0.101056,
192
+ 0.101508,
193
+ 0.102009,
194
+ 0.102594,
195
+ 0.103253,
196
+ 0.104164,
197
+ 0.105427,
198
+ 0.108149,
199
+ 0.130221,
200
+ 0.207263,
201
+ 0.238444
202
+ ],
203
+ "median": 0.101056,
204
+ "p25": 0.098223,
205
+ "p75": 0.104164
206
+ },
207
+ "cut_and_run": {
208
+ "percentiles": [
209
+ 0,
210
+ 5,
211
+ 10,
212
+ 15,
213
+ 20,
214
+ 25,
215
+ 30,
216
+ 35,
217
+ 40,
218
+ 45,
219
+ 50,
220
+ 55,
221
+ 60,
222
+ 65,
223
+ 70,
224
+ 75,
225
+ 80,
226
+ 85,
227
+ 90,
228
+ 95,
229
+ 100
230
+ ],
231
+ "values": [
232
+ 0.038789,
233
+ 0.062226,
234
+ 0.064484,
235
+ 0.066581,
236
+ 0.069399,
237
+ 0.071999,
238
+ 0.075822,
239
+ 0.078853,
240
+ 0.081986,
241
+ 0.084542,
242
+ 0.086876,
243
+ 0.089692,
244
+ 0.092015,
245
+ 0.094378,
246
+ 0.09675,
247
+ 0.099171,
248
+ 0.101641,
249
+ 0.103989,
250
+ 0.106302,
251
+ 0.109542,
252
+ 0.236922
253
+ ],
254
+ "median": 0.086876,
255
+ "p25": 0.071999,
256
+ "p75": 0.099171
257
+ },
258
+ "cut_and_tag": {
259
+ "percentiles": [
260
+ 0,
261
+ 5,
262
+ 10,
263
+ 15,
264
+ 20,
265
+ 25,
266
+ 30,
267
+ 35,
268
+ 40,
269
+ 45,
270
+ 50,
271
+ 55,
272
+ 60,
273
+ 65,
274
+ 70,
275
+ 75,
276
+ 80,
277
+ 85,
278
+ 90,
279
+ 95,
280
+ 100
281
+ ],
282
+ "values": [
283
+ 0.063623,
284
+ 0.100106,
285
+ 0.171863,
286
+ 0.203993,
287
+ 0.214263,
288
+ 0.218704,
289
+ 0.221272,
290
+ 0.22286,
291
+ 0.224168,
292
+ 0.225594,
293
+ 0.226505,
294
+ 0.227904,
295
+ 0.228983,
296
+ 0.230164,
297
+ 0.231519,
298
+ 0.232466,
299
+ 0.234021,
300
+ 0.235497,
301
+ 0.237154,
302
+ 0.240781,
303
+ 0.291421
304
+ ],
305
+ "median": 0.226505,
306
+ "p25": 0.218704,
307
+ "p75": 0.232466
308
+ },
309
+ "rna_seq": {
310
+ "percentiles": [
311
+ 0,
312
+ 5,
313
+ 10,
314
+ 15,
315
+ 20,
316
+ 25,
317
+ 30,
318
+ 35,
319
+ 40,
320
+ 45,
321
+ 50,
322
+ 55,
323
+ 60,
324
+ 65,
325
+ 70,
326
+ 75,
327
+ 80,
328
+ 85,
329
+ 90,
330
+ 95,
331
+ 100
332
+ ],
333
+ "values": [
334
+ 0.0,
335
+ 0.088305,
336
+ 0.099781,
337
+ 0.105986,
338
+ 0.108324,
339
+ 0.109676,
340
+ 0.110794,
341
+ 0.112202,
342
+ 0.11495,
343
+ 0.116642,
344
+ 0.118239,
345
+ 0.119673,
346
+ 0.121148,
347
+ 0.124214,
348
+ 0.125932,
349
+ 0.127967,
350
+ 0.130972,
351
+ 0.137857,
352
+ 0.184656,
353
+ 0.189731,
354
+ 0.26102
355
+ ],
356
+ "median": 0.118239,
357
+ "p25": 0.109676,
358
+ "p75": 0.127967
359
+ },
360
+ "sc_atac_seq": {
361
+ "percentiles": [
362
+ 0,
363
+ 5,
364
+ 10,
365
+ 15,
366
+ 20,
367
+ 25,
368
+ 30,
369
+ 35,
370
+ 40,
371
+ 45,
372
+ 50,
373
+ 55,
374
+ 60,
375
+ 65,
376
+ 70,
377
+ 75,
378
+ 80,
379
+ 85,
380
+ 90,
381
+ 95,
382
+ 100
383
+ ],
384
+ "values": [
385
+ 0.0,
386
+ 0.159644,
387
+ 0.166292,
388
+ 0.175322,
389
+ 0.178952,
390
+ 0.180728,
391
+ 0.18227,
392
+ 0.183756,
393
+ 0.184676,
394
+ 0.185637,
395
+ 0.18637,
396
+ 0.187052,
397
+ 0.187887,
398
+ 0.188842,
399
+ 0.190498,
400
+ 0.207788,
401
+ 0.269949,
402
+ 0.28214,
403
+ 0.28753,
404
+ 0.291858,
405
+ 0.321238
406
+ ],
407
+ "median": 0.18637,
408
+ "p25": 0.180728,
409
+ "p75": 0.207788
410
+ },
411
+ "sc_rna_seq": {
412
+ "percentiles": [
413
+ 0,
414
+ 5,
415
+ 10,
416
+ 15,
417
+ 20,
418
+ 25,
419
+ 30,
420
+ 35,
421
+ 40,
422
+ 45,
423
+ 50,
424
+ 55,
425
+ 60,
426
+ 65,
427
+ 70,
428
+ 75,
429
+ 80,
430
+ 85,
431
+ 90,
432
+ 95,
433
+ 100
434
+ ],
435
+ "values": [
436
+ 0.0,
437
+ 0.092157,
438
+ 0.096699,
439
+ 0.099436,
440
+ 0.101617,
441
+ 0.103759,
442
+ 0.106222,
443
+ 0.110892,
444
+ 0.116992,
445
+ 0.129408,
446
+ 0.175916,
447
+ 0.178622,
448
+ 0.180915,
449
+ 0.182405,
450
+ 0.184215,
451
+ 0.185351,
452
+ 0.186584,
453
+ 0.187843,
454
+ 0.190498,
455
+ 0.194522,
456
+ 0.260389
457
+ ],
458
+ "median": 0.175916,
459
+ "p25": 0.103759,
460
+ "p75": 0.185351
461
+ },
462
+ "spatial": {
463
+ "percentiles": [
464
+ 0,
465
+ 5,
466
+ 10,
467
+ 15,
468
+ 20,
469
+ 25,
470
+ 30,
471
+ 35,
472
+ 40,
473
+ 45,
474
+ 50,
475
+ 55,
476
+ 60,
477
+ 65,
478
+ 70,
479
+ 75,
480
+ 80,
481
+ 85,
482
+ 90,
483
+ 95,
484
+ 100
485
+ ],
486
+ "values": [
487
+ 0.0,
488
+ 0.087317,
489
+ 0.09583,
490
+ 0.097933,
491
+ 0.099539,
492
+ 0.101307,
493
+ 0.102524,
494
+ 0.104046,
495
+ 0.106007,
496
+ 0.109129,
497
+ 0.111013,
498
+ 0.112164,
499
+ 0.113778,
500
+ 0.167671,
501
+ 0.17587,
502
+ 0.177165,
503
+ 0.178175,
504
+ 0.17988,
505
+ 0.18412,
506
+ 0.188916,
507
+ 0.248412
508
+ ],
509
+ "median": 0.111013,
510
+ "p25": 0.101307,
511
+ "p75": 0.177165
512
+ },
513
+ "wes": {
514
+ "percentiles": [
515
+ 0,
516
+ 5,
517
+ 10,
518
+ 15,
519
+ 20,
520
+ 25,
521
+ 30,
522
+ 35,
523
+ 40,
524
+ 45,
525
+ 50,
526
+ 55,
527
+ 60,
528
+ 65,
529
+ 70,
530
+ 75,
531
+ 80,
532
+ 85,
533
+ 90,
534
+ 95,
535
+ 100
536
+ ],
537
+ "values": [
538
+ 0.0,
539
+ 0.095707,
540
+ 0.096815,
541
+ 0.097616,
542
+ 0.098166,
543
+ 0.098543,
544
+ 0.098977,
545
+ 0.09942,
546
+ 0.099828,
547
+ 0.100215,
548
+ 0.100663,
549
+ 0.101181,
550
+ 0.101888,
551
+ 0.102689,
552
+ 0.104104,
553
+ 0.105861,
554
+ 0.10981,
555
+ 0.115087,
556
+ 0.118128,
557
+ 0.125351,
558
+ 0.236199
559
+ ],
560
+ "median": 0.100663,
561
+ "p25": 0.098543,
562
+ "p75": 0.105861
563
+ },
564
+ "wgs": {
565
+ "percentiles": [
566
+ 0,
567
+ 5,
568
+ 10,
569
+ 15,
570
+ 20,
571
+ 25,
572
+ 30,
573
+ 35,
574
+ 40,
575
+ 45,
576
+ 50,
577
+ 55,
578
+ 60,
579
+ 65,
580
+ 70,
581
+ 75,
582
+ 80,
583
+ 85,
584
+ 90,
585
+ 95,
586
+ 100
587
+ ],
588
+ "values": [
589
+ 0.0,
590
+ 0.068677,
591
+ 0.094451,
592
+ 0.097001,
593
+ 0.0986,
594
+ 0.099386,
595
+ 0.100347,
596
+ 0.101323,
597
+ 0.102044,
598
+ 0.103639,
599
+ 0.105664,
600
+ 0.107608,
601
+ 0.109631,
602
+ 0.114234,
603
+ 0.11786,
604
+ 0.119877,
605
+ 0.120959,
606
+ 0.122248,
607
+ 0.141463,
608
+ 0.194196,
609
+ 0.410086
610
+ ],
611
+ "median": 0.105664,
612
+ "p25": 0.099386,
613
+ "p75": 0.119877
614
+ }
615
+ },
616
+ "bisulfite_c_fraction": {
617
+ "amplicon_16s": {
618
+ "percentiles": [
619
+ 0,
620
+ 5,
621
+ 10,
622
+ 15,
623
+ 20,
624
+ 25,
625
+ 30,
626
+ 35,
627
+ 40,
628
+ 45,
629
+ 50,
630
+ 55,
631
+ 60,
632
+ 65,
633
+ 70,
634
+ 75,
635
+ 80,
636
+ 85,
637
+ 90,
638
+ 95,
639
+ 100
640
+ ],
641
+ "values": [
642
+ 0.015556,
643
+ 0.177339,
644
+ 0.183246,
645
+ 0.187891,
646
+ 0.191396,
647
+ 0.194574,
648
+ 0.19805,
649
+ 0.200581,
650
+ 0.202684,
651
+ 0.206373,
652
+ 0.210206,
653
+ 0.212484,
654
+ 0.215381,
655
+ 0.218238,
656
+ 0.221563,
657
+ 0.226838,
658
+ 0.233005,
659
+ 0.241686,
660
+ 0.25801,
661
+ 0.312592,
662
+ 0.37216
663
+ ],
664
+ "median": 0.210206,
665
+ "p25": 0.194574,
666
+ "p75": 0.226838
667
+ },
668
+ "atac_seq": {
669
+ "percentiles": [
670
+ 0,
671
+ 5,
672
+ 10,
673
+ 15,
674
+ 20,
675
+ 25,
676
+ 30,
677
+ 35,
678
+ 40,
679
+ 45,
680
+ 50,
681
+ 55,
682
+ 60,
683
+ 65,
684
+ 70,
685
+ 75,
686
+ 80,
687
+ 85,
688
+ 90,
689
+ 95,
690
+ 100
691
+ ],
692
+ "values": [
693
+ 0.0,
694
+ 0.214701,
695
+ 0.222002,
696
+ 0.225811,
697
+ 0.229995,
698
+ 0.233129,
699
+ 0.236159,
700
+ 0.23857,
701
+ 0.240741,
702
+ 0.243062,
703
+ 0.245562,
704
+ 0.24839,
705
+ 0.251184,
706
+ 0.253091,
707
+ 0.255975,
708
+ 0.259674,
709
+ 0.263196,
710
+ 0.265992,
711
+ 0.271333,
712
+ 0.279813,
713
+ 0.5
714
+ ],
715
+ "median": 0.245562,
716
+ "p25": 0.233129,
717
+ "p75": 0.259674
718
+ },
719
+ "bisulfite": {
720
+ "percentiles": [
721
+ 0,
722
+ 5,
723
+ 10,
724
+ 15,
725
+ 20,
726
+ 25,
727
+ 30,
728
+ 35,
729
+ 40,
730
+ 45,
731
+ 50,
732
+ 55,
733
+ 60,
734
+ 65,
735
+ 70,
736
+ 75,
737
+ 80,
738
+ 85,
739
+ 90,
740
+ 95,
741
+ 100
742
+ ],
743
+ "values": [
744
+ 0.000837,
745
+ 0.010494,
746
+ 0.012231,
747
+ 0.013887,
748
+ 0.015619,
749
+ 0.018725,
750
+ 0.021674,
751
+ 0.026212,
752
+ 0.029973,
753
+ 0.033789,
754
+ 0.039726,
755
+ 0.053629,
756
+ 0.070849,
757
+ 0.142602,
758
+ 0.171624,
759
+ 0.182307,
760
+ 0.191769,
761
+ 0.211143,
762
+ 0.23323,
763
+ 0.264364,
764
+ 0.664913
765
+ ],
766
+ "median": 0.039726,
767
+ "p25": 0.018725,
768
+ "p75": 0.182307
769
+ },
770
+ "chip_seq": {
771
+ "percentiles": [
772
+ 0,
773
+ 5,
774
+ 10,
775
+ 15,
776
+ 20,
777
+ 25,
778
+ 30,
779
+ 35,
780
+ 40,
781
+ 45,
782
+ 50,
783
+ 55,
784
+ 60,
785
+ 65,
786
+ 70,
787
+ 75,
788
+ 80,
789
+ 85,
790
+ 90,
791
+ 95,
792
+ 100
793
+ ],
794
+ "values": [
795
+ 0.0,
796
+ 0.197815,
797
+ 0.204072,
798
+ 0.206361,
799
+ 0.20858,
800
+ 0.210149,
801
+ 0.211669,
802
+ 0.212992,
803
+ 0.214904,
804
+ 0.216921,
805
+ 0.219053,
806
+ 0.220815,
807
+ 0.223258,
808
+ 0.225982,
809
+ 0.228276,
810
+ 0.232698,
811
+ 0.237295,
812
+ 0.242973,
813
+ 0.250806,
814
+ 0.264639,
815
+ 0.331423
816
+ ],
817
+ "median": 0.219053,
818
+ "p25": 0.210149,
819
+ "p75": 0.232698
820
+ },
821
+ "cut_and_run": {
822
+ "percentiles": [
823
+ 0,
824
+ 5,
825
+ 10,
826
+ 15,
827
+ 20,
828
+ 25,
829
+ 30,
830
+ 35,
831
+ 40,
832
+ 45,
833
+ 50,
834
+ 55,
835
+ 60,
836
+ 65,
837
+ 70,
838
+ 75,
839
+ 80,
840
+ 85,
841
+ 90,
842
+ 95,
843
+ 100
844
+ ],
845
+ "values": [
846
+ 0.126956,
847
+ 0.195046,
848
+ 0.200038,
849
+ 0.202678,
850
+ 0.205527,
851
+ 0.207294,
852
+ 0.20903,
853
+ 0.210414,
854
+ 0.212206,
855
+ 0.213973,
856
+ 0.216305,
857
+ 0.218286,
858
+ 0.220453,
859
+ 0.222526,
860
+ 0.225384,
861
+ 0.229037,
862
+ 0.232606,
863
+ 0.237496,
864
+ 0.243784,
865
+ 0.260612,
866
+ 0.314882
867
+ ],
868
+ "median": 0.216305,
869
+ "p25": 0.207294,
870
+ "p75": 0.229037
871
+ },
872
+ "cut_and_tag": {
873
+ "percentiles": [
874
+ 0,
875
+ 5,
876
+ 10,
877
+ 15,
878
+ 20,
879
+ 25,
880
+ 30,
881
+ 35,
882
+ 40,
883
+ 45,
884
+ 50,
885
+ 55,
886
+ 60,
887
+ 65,
888
+ 70,
889
+ 75,
890
+ 80,
891
+ 85,
892
+ 90,
893
+ 95,
894
+ 100
895
+ ],
896
+ "values": [
897
+ 0.006607,
898
+ 0.197487,
899
+ 0.214081,
900
+ 0.219909,
901
+ 0.224144,
902
+ 0.228075,
903
+ 0.231409,
904
+ 0.234625,
905
+ 0.237165,
906
+ 0.239207,
907
+ 0.242203,
908
+ 0.244729,
909
+ 0.247355,
910
+ 0.250583,
911
+ 0.253722,
912
+ 0.258361,
913
+ 0.263192,
914
+ 0.269291,
915
+ 0.279407,
916
+ 0.291713,
917
+ 0.34247
918
+ ],
919
+ "median": 0.242203,
920
+ "p25": 0.228075,
921
+ "p75": 0.258361
922
+ },
923
+ "rna_seq": {
924
+ "percentiles": [
925
+ 0,
926
+ 5,
927
+ 10,
928
+ 15,
929
+ 20,
930
+ 25,
931
+ 30,
932
+ 35,
933
+ 40,
934
+ 45,
935
+ 50,
936
+ 55,
937
+ 60,
938
+ 65,
939
+ 70,
940
+ 75,
941
+ 80,
942
+ 85,
943
+ 90,
944
+ 95,
945
+ 100
946
+ ],
947
+ "values": [
948
+ 0.0,
949
+ 0.194421,
950
+ 0.201575,
951
+ 0.211928,
952
+ 0.215877,
953
+ 0.221278,
954
+ 0.228643,
955
+ 0.23168,
956
+ 0.23506,
957
+ 0.237654,
958
+ 0.240386,
959
+ 0.243169,
960
+ 0.244864,
961
+ 0.246423,
962
+ 0.248094,
963
+ 0.24991,
964
+ 0.25181,
965
+ 0.253961,
966
+ 0.257858,
967
+ 0.264937,
968
+ 0.40389
969
+ ],
970
+ "median": 0.240386,
971
+ "p25": 0.221278,
972
+ "p75": 0.24991
973
+ },
974
+ "sc_atac_seq": {
975
+ "percentiles": [
976
+ 0,
977
+ 5,
978
+ 10,
979
+ 15,
980
+ 20,
981
+ 25,
982
+ 30,
983
+ 35,
984
+ 40,
985
+ 45,
986
+ 50,
987
+ 55,
988
+ 60,
989
+ 65,
990
+ 70,
991
+ 75,
992
+ 80,
993
+ 85,
994
+ 90,
995
+ 95,
996
+ 100
997
+ ],
998
+ "values": [
999
+ 0.0,
1000
+ 0.20243,
1001
+ 0.21027,
1002
+ 0.214415,
1003
+ 0.222481,
1004
+ 0.227881,
1005
+ 0.23085,
1006
+ 0.235297,
1007
+ 0.238443,
1008
+ 0.242278,
1009
+ 0.245661,
1010
+ 0.248201,
1011
+ 0.251184,
1012
+ 0.253508,
1013
+ 0.255729,
1014
+ 0.259579,
1015
+ 0.262982,
1016
+ 0.26882,
1017
+ 0.275761,
1018
+ 0.283509,
1019
+ 0.5
1020
+ ],
1021
+ "median": 0.245661,
1022
+ "p25": 0.227881,
1023
+ "p75": 0.259579
1024
+ },
1025
+ "sc_rna_seq": {
1026
+ "percentiles": [
1027
+ 0,
1028
+ 5,
1029
+ 10,
1030
+ 15,
1031
+ 20,
1032
+ 25,
1033
+ 30,
1034
+ 35,
1035
+ 40,
1036
+ 45,
1037
+ 50,
1038
+ 55,
1039
+ 60,
1040
+ 65,
1041
+ 70,
1042
+ 75,
1043
+ 80,
1044
+ 85,
1045
+ 90,
1046
+ 95,
1047
+ 100
1048
+ ],
1049
+ "values": [
1050
+ 0.061657,
1051
+ 0.179066,
1052
+ 0.204088,
1053
+ 0.21547,
1054
+ 0.222374,
1055
+ 0.226808,
1056
+ 0.231285,
1057
+ 0.234612,
1058
+ 0.237638,
1059
+ 0.242176,
1060
+ 0.246343,
1061
+ 0.249246,
1062
+ 0.252082,
1063
+ 0.254963,
1064
+ 0.258045,
1065
+ 0.261169,
1066
+ 0.264605,
1067
+ 0.269313,
1068
+ 0.279226,
1069
+ 0.287784,
1070
+ 0.399834
1071
+ ],
1072
+ "median": 0.246343,
1073
+ "p25": 0.226808,
1074
+ "p75": 0.261169
1075
+ },
1076
+ "spatial": {
1077
+ "percentiles": [
1078
+ 0,
1079
+ 5,
1080
+ 10,
1081
+ 15,
1082
+ 20,
1083
+ 25,
1084
+ 30,
1085
+ 35,
1086
+ 40,
1087
+ 45,
1088
+ 50,
1089
+ 55,
1090
+ 60,
1091
+ 65,
1092
+ 70,
1093
+ 75,
1094
+ 80,
1095
+ 85,
1096
+ 90,
1097
+ 95,
1098
+ 100
1099
+ ],
1100
+ "values": [
1101
+ 0.050136,
1102
+ 0.147656,
1103
+ 0.18271,
1104
+ 0.19422,
1105
+ 0.209594,
1106
+ 0.218773,
1107
+ 0.222778,
1108
+ 0.225476,
1109
+ 0.228943,
1110
+ 0.233884,
1111
+ 0.236583,
1112
+ 0.239005,
1113
+ 0.244396,
1114
+ 0.247538,
1115
+ 0.250638,
1116
+ 0.257428,
1117
+ 0.264408,
1118
+ 0.291273,
1119
+ 0.295884,
1120
+ 0.299379,
1121
+ 0.4
1122
+ ],
1123
+ "median": 0.236583,
1124
+ "p25": 0.218773,
1125
+ "p75": 0.257428
1126
+ },
1127
+ "wes": {
1128
+ "percentiles": [
1129
+ 0,
1130
+ 5,
1131
+ 10,
1132
+ 15,
1133
+ 20,
1134
+ 25,
1135
+ 30,
1136
+ 35,
1137
+ 40,
1138
+ 45,
1139
+ 50,
1140
+ 55,
1141
+ 60,
1142
+ 65,
1143
+ 70,
1144
+ 75,
1145
+ 80,
1146
+ 85,
1147
+ 90,
1148
+ 95,
1149
+ 100
1150
+ ],
1151
+ "values": [
1152
+ 0.0,
1153
+ 0.201001,
1154
+ 0.208351,
1155
+ 0.212599,
1156
+ 0.215673,
1157
+ 0.218126,
1158
+ 0.220985,
1159
+ 0.223899,
1160
+ 0.227208,
1161
+ 0.230208,
1162
+ 0.234122,
1163
+ 0.237135,
1164
+ 0.239873,
1165
+ 0.242525,
1166
+ 0.244714,
1167
+ 0.248086,
1168
+ 0.251841,
1169
+ 0.25539,
1170
+ 0.259824,
1171
+ 0.269998,
1172
+ 0.331348
1173
+ ],
1174
+ "median": 0.234122,
1175
+ "p25": 0.218126,
1176
+ "p75": 0.248086
1177
+ },
1178
+ "wgs": {
1179
+ "percentiles": [
1180
+ 0,
1181
+ 5,
1182
+ 10,
1183
+ 15,
1184
+ 20,
1185
+ 25,
1186
+ 30,
1187
+ 35,
1188
+ 40,
1189
+ 45,
1190
+ 50,
1191
+ 55,
1192
+ 60,
1193
+ 65,
1194
+ 70,
1195
+ 75,
1196
+ 80,
1197
+ 85,
1198
+ 90,
1199
+ 95,
1200
+ 100
1201
+ ],
1202
+ "values": [
1203
+ 0.0,
1204
+ 0.190142,
1205
+ 0.194458,
1206
+ 0.196641,
1207
+ 0.198517,
1208
+ 0.200955,
1209
+ 0.203234,
1210
+ 0.205788,
1211
+ 0.207916,
1212
+ 0.210466,
1213
+ 0.21283,
1214
+ 0.21681,
1215
+ 0.222122,
1216
+ 0.229035,
1217
+ 0.234799,
1218
+ 0.240574,
1219
+ 0.247848,
1220
+ 0.256174,
1221
+ 0.267682,
1222
+ 0.289874,
1223
+ 0.335155
1224
+ ],
1225
+ "median": 0.21283,
1226
+ "p25": 0.200955,
1227
+ "p75": 0.240574
1228
+ }
1229
+ },
1230
+ "ga_ct_bias_mean": {
1231
+ "amplicon_16s": {
1232
+ "percentiles": [
1233
+ 0,
1234
+ 5,
1235
+ 10,
1236
+ 15,
1237
+ 20,
1238
+ 25,
1239
+ 30,
1240
+ 35,
1241
+ 40,
1242
+ 45,
1243
+ 50,
1244
+ 55,
1245
+ 60,
1246
+ 65,
1247
+ 70,
1248
+ 75,
1249
+ 80,
1250
+ 85,
1251
+ 90,
1252
+ 95,
1253
+ 100
1254
+ ],
1255
+ "values": [
1256
+ 0.007866,
1257
+ 0.104527,
1258
+ 0.10934,
1259
+ 0.11175,
1260
+ 0.113481,
1261
+ 0.115099,
1262
+ 0.116559,
1263
+ 0.117838,
1264
+ 0.119102,
1265
+ 0.120163,
1266
+ 0.121125,
1267
+ 0.122307,
1268
+ 0.123768,
1269
+ 0.124675,
1270
+ 0.125799,
1271
+ 0.1275,
1272
+ 0.128726,
1273
+ 0.130923,
1274
+ 0.132887,
1275
+ 0.134792,
1276
+ 0.150922
1277
+ ],
1278
+ "median": 0.121125,
1279
+ "p25": 0.115099,
1280
+ "p75": 0.1275
1281
+ },
1282
+ "atac_seq": {
1283
+ "percentiles": [
1284
+ 0,
1285
+ 5,
1286
+ 10,
1287
+ 15,
1288
+ 20,
1289
+ 25,
1290
+ 30,
1291
+ 35,
1292
+ 40,
1293
+ 45,
1294
+ 50,
1295
+ 55,
1296
+ 60,
1297
+ 65,
1298
+ 70,
1299
+ 75,
1300
+ 80,
1301
+ 85,
1302
+ 90,
1303
+ 95,
1304
+ 100
1305
+ ],
1306
+ "values": [
1307
+ 0.089965,
1308
+ 0.126187,
1309
+ 0.128802,
1310
+ 0.130261,
1311
+ 0.131689,
1312
+ 0.132879,
1313
+ 0.134053,
1314
+ 0.135068,
1315
+ 0.13617,
1316
+ 0.136799,
1317
+ 0.137646,
1318
+ 0.138245,
1319
+ 0.139012,
1320
+ 0.139986,
1321
+ 0.140843,
1322
+ 0.141799,
1323
+ 0.142857,
1324
+ 0.144205,
1325
+ 0.146251,
1326
+ 0.150097,
1327
+ 0.428571
1328
+ ],
1329
+ "median": 0.137646,
1330
+ "p25": 0.132879,
1331
+ "p75": 0.141799
1332
+ },
1333
+ "bisulfite": {
1334
+ "percentiles": [
1335
+ 0,
1336
+ 5,
1337
+ 10,
1338
+ 15,
1339
+ 20,
1340
+ 25,
1341
+ 30,
1342
+ 35,
1343
+ 40,
1344
+ 45,
1345
+ 50,
1346
+ 55,
1347
+ 60,
1348
+ 65,
1349
+ 70,
1350
+ 75,
1351
+ 80,
1352
+ 85,
1353
+ 90,
1354
+ 95,
1355
+ 100
1356
+ ],
1357
+ "values": [
1358
+ 0.013668,
1359
+ 0.061839,
1360
+ 0.063452,
1361
+ 0.064724,
1362
+ 0.0658,
1363
+ 0.067099,
1364
+ 0.068448,
1365
+ 0.069427,
1366
+ 0.071149,
1367
+ 0.073198,
1368
+ 0.075253,
1369
+ 0.076977,
1370
+ 0.078698,
1371
+ 0.080257,
1372
+ 0.083252,
1373
+ 0.086926,
1374
+ 0.092093,
1375
+ 0.099332,
1376
+ 0.105341,
1377
+ 0.11477,
1378
+ 0.179359
1379
+ ],
1380
+ "median": 0.075253,
1381
+ "p25": 0.067099,
1382
+ "p75": 0.086926
1383
+ },
1384
+ "chip_seq": {
1385
+ "percentiles": [
1386
+ 0,
1387
+ 5,
1388
+ 10,
1389
+ 15,
1390
+ 20,
1391
+ 25,
1392
+ 30,
1393
+ 35,
1394
+ 40,
1395
+ 45,
1396
+ 50,
1397
+ 55,
1398
+ 60,
1399
+ 65,
1400
+ 70,
1401
+ 75,
1402
+ 80,
1403
+ 85,
1404
+ 90,
1405
+ 95,
1406
+ 100
1407
+ ],
1408
+ "values": [
1409
+ 0.0,
1410
+ 0.12334,
1411
+ 0.127566,
1412
+ 0.128617,
1413
+ 0.129486,
1414
+ 0.130568,
1415
+ 0.131269,
1416
+ 0.131992,
1417
+ 0.132516,
1418
+ 0.133202,
1419
+ 0.133703,
1420
+ 0.134248,
1421
+ 0.134795,
1422
+ 0.135397,
1423
+ 0.136075,
1424
+ 0.136899,
1425
+ 0.137684,
1426
+ 0.138612,
1427
+ 0.140078,
1428
+ 0.142535,
1429
+ 0.157896
1430
+ ],
1431
+ "median": 0.133703,
1432
+ "p25": 0.130568,
1433
+ "p75": 0.136899
1434
+ },
1435
+ "cut_and_run": {
1436
+ "percentiles": [
1437
+ 0,
1438
+ 5,
1439
+ 10,
1440
+ 15,
1441
+ 20,
1442
+ 25,
1443
+ 30,
1444
+ 35,
1445
+ 40,
1446
+ 45,
1447
+ 50,
1448
+ 55,
1449
+ 60,
1450
+ 65,
1451
+ 70,
1452
+ 75,
1453
+ 80,
1454
+ 85,
1455
+ 90,
1456
+ 95,
1457
+ 100
1458
+ ],
1459
+ "values": [
1460
+ 0.078337,
1461
+ 0.114382,
1462
+ 0.122298,
1463
+ 0.125959,
1464
+ 0.127814,
1465
+ 0.12889,
1466
+ 0.129894,
1467
+ 0.13048,
1468
+ 0.130922,
1469
+ 0.131432,
1470
+ 0.131989,
1471
+ 0.132551,
1472
+ 0.133126,
1473
+ 0.133928,
1474
+ 0.134599,
1475
+ 0.135297,
1476
+ 0.13614,
1477
+ 0.137055,
1478
+ 0.138203,
1479
+ 0.140458,
1480
+ 0.192198
1481
+ ],
1482
+ "median": 0.131989,
1483
+ "p25": 0.12889,
1484
+ "p75": 0.135297
1485
+ },
1486
+ "cut_and_tag": {
1487
+ "percentiles": [
1488
+ 0,
1489
+ 5,
1490
+ 10,
1491
+ 15,
1492
+ 20,
1493
+ 25,
1494
+ 30,
1495
+ 35,
1496
+ 40,
1497
+ 45,
1498
+ 50,
1499
+ 55,
1500
+ 60,
1501
+ 65,
1502
+ 70,
1503
+ 75,
1504
+ 80,
1505
+ 85,
1506
+ 90,
1507
+ 95,
1508
+ 100
1509
+ ],
1510
+ "values": [
1511
+ 0.063582,
1512
+ 0.115517,
1513
+ 0.12698,
1514
+ 0.129646,
1515
+ 0.131638,
1516
+ 0.133028,
1517
+ 0.133912,
1518
+ 0.134714,
1519
+ 0.135467,
1520
+ 0.13611,
1521
+ 0.136871,
1522
+ 0.137458,
1523
+ 0.138328,
1524
+ 0.139091,
1525
+ 0.139921,
1526
+ 0.140716,
1527
+ 0.141688,
1528
+ 0.143081,
1529
+ 0.144828,
1530
+ 0.147051,
1531
+ 0.165953
1532
+ ],
1533
+ "median": 0.136871,
1534
+ "p25": 0.133028,
1535
+ "p75": 0.140716
1536
+ },
1537
+ "rna_seq": {
1538
+ "percentiles": [
1539
+ 0,
1540
+ 5,
1541
+ 10,
1542
+ 15,
1543
+ 20,
1544
+ 25,
1545
+ 30,
1546
+ 35,
1547
+ 40,
1548
+ 45,
1549
+ 50,
1550
+ 55,
1551
+ 60,
1552
+ 65,
1553
+ 70,
1554
+ 75,
1555
+ 80,
1556
+ 85,
1557
+ 90,
1558
+ 95,
1559
+ 100
1560
+ ],
1561
+ "values": [
1562
+ 0.0,
1563
+ 0.115327,
1564
+ 0.122745,
1565
+ 0.12433,
1566
+ 0.126428,
1567
+ 0.129373,
1568
+ 0.131164,
1569
+ 0.132473,
1570
+ 0.133693,
1571
+ 0.134375,
1572
+ 0.134811,
1573
+ 0.13538,
1574
+ 0.135977,
1575
+ 0.136453,
1576
+ 0.137195,
1577
+ 0.137935,
1578
+ 0.138776,
1579
+ 0.139653,
1580
+ 0.140707,
1581
+ 0.142372,
1582
+ 0.172347
1583
+ ],
1584
+ "median": 0.134811,
1585
+ "p25": 0.129373,
1586
+ "p75": 0.137935
1587
+ },
1588
+ "sc_atac_seq": {
1589
+ "percentiles": [
1590
+ 0,
1591
+ 5,
1592
+ 10,
1593
+ 15,
1594
+ 20,
1595
+ 25,
1596
+ 30,
1597
+ 35,
1598
+ 40,
1599
+ 45,
1600
+ 50,
1601
+ 55,
1602
+ 60,
1603
+ 65,
1604
+ 70,
1605
+ 75,
1606
+ 80,
1607
+ 85,
1608
+ 90,
1609
+ 95,
1610
+ 100
1611
+ ],
1612
+ "values": [
1613
+ 0.0,
1614
+ 0.129783,
1615
+ 0.131639,
1616
+ 0.133319,
1617
+ 0.134498,
1618
+ 0.135292,
1619
+ 0.136006,
1620
+ 0.136466,
1621
+ 0.136834,
1622
+ 0.137277,
1623
+ 0.137845,
1624
+ 0.138435,
1625
+ 0.139265,
1626
+ 0.140658,
1627
+ 0.141708,
1628
+ 0.142587,
1629
+ 0.143238,
1630
+ 0.144643,
1631
+ 0.146344,
1632
+ 0.147943,
1633
+ 0.285714
1634
+ ],
1635
+ "median": 0.137845,
1636
+ "p25": 0.135292,
1637
+ "p75": 0.142587
1638
+ },
1639
+ "sc_rna_seq": {
1640
+ "percentiles": [
1641
+ 0,
1642
+ 5,
1643
+ 10,
1644
+ 15,
1645
+ 20,
1646
+ 25,
1647
+ 30,
1648
+ 35,
1649
+ 40,
1650
+ 45,
1651
+ 50,
1652
+ 55,
1653
+ 60,
1654
+ 65,
1655
+ 70,
1656
+ 75,
1657
+ 80,
1658
+ 85,
1659
+ 90,
1660
+ 95,
1661
+ 100
1662
+ ],
1663
+ "values": [
1664
+ 0.000169,
1665
+ 0.090469,
1666
+ 0.108787,
1667
+ 0.116877,
1668
+ 0.120533,
1669
+ 0.122006,
1670
+ 0.123215,
1671
+ 0.12439,
1672
+ 0.125328,
1673
+ 0.126909,
1674
+ 0.128634,
1675
+ 0.129889,
1676
+ 0.130949,
1677
+ 0.132221,
1678
+ 0.133282,
1679
+ 0.134451,
1680
+ 0.135848,
1681
+ 0.137181,
1682
+ 0.13878,
1683
+ 0.142794,
1684
+ 0.222222
1685
+ ],
1686
+ "median": 0.128634,
1687
+ "p25": 0.122006,
1688
+ "p75": 0.134451
1689
+ },
1690
+ "spatial": {
1691
+ "percentiles": [
1692
+ 0,
1693
+ 5,
1694
+ 10,
1695
+ 15,
1696
+ 20,
1697
+ 25,
1698
+ 30,
1699
+ 35,
1700
+ 40,
1701
+ 45,
1702
+ 50,
1703
+ 55,
1704
+ 60,
1705
+ 65,
1706
+ 70,
1707
+ 75,
1708
+ 80,
1709
+ 85,
1710
+ 90,
1711
+ 95,
1712
+ 100
1713
+ ],
1714
+ "values": [
1715
+ 0.0,
1716
+ 0.078721,
1717
+ 0.100563,
1718
+ 0.112461,
1719
+ 0.118873,
1720
+ 0.12118,
1721
+ 0.12193,
1722
+ 0.12234,
1723
+ 0.122955,
1724
+ 0.124023,
1725
+ 0.125218,
1726
+ 0.1263,
1727
+ 0.127531,
1728
+ 0.130331,
1729
+ 0.132622,
1730
+ 0.136023,
1731
+ 0.143443,
1732
+ 0.146096,
1733
+ 0.147712,
1734
+ 0.153156,
1735
+ 0.332627
1736
+ ],
1737
+ "median": 0.125218,
1738
+ "p25": 0.12118,
1739
+ "p75": 0.136023
1740
+ },
1741
+ "wes": {
1742
+ "percentiles": [
1743
+ 0,
1744
+ 5,
1745
+ 10,
1746
+ 15,
1747
+ 20,
1748
+ 25,
1749
+ 30,
1750
+ 35,
1751
+ 40,
1752
+ 45,
1753
+ 50,
1754
+ 55,
1755
+ 60,
1756
+ 65,
1757
+ 70,
1758
+ 75,
1759
+ 80,
1760
+ 85,
1761
+ 90,
1762
+ 95,
1763
+ 100
1764
+ ],
1765
+ "values": [
1766
+ 0.0,
1767
+ 0.129325,
1768
+ 0.132386,
1769
+ 0.134054,
1770
+ 0.13565,
1771
+ 0.136623,
1772
+ 0.137353,
1773
+ 0.137988,
1774
+ 0.138751,
1775
+ 0.139285,
1776
+ 0.139661,
1777
+ 0.140247,
1778
+ 0.140866,
1779
+ 0.14146,
1780
+ 0.142032,
1781
+ 0.142519,
1782
+ 0.143015,
1783
+ 0.143518,
1784
+ 0.144249,
1785
+ 0.145278,
1786
+ 0.16023
1787
+ ],
1788
+ "median": 0.139661,
1789
+ "p25": 0.136623,
1790
+ "p75": 0.142519
1791
+ },
1792
+ "wgs": {
1793
+ "percentiles": [
1794
+ 0,
1795
+ 5,
1796
+ 10,
1797
+ 15,
1798
+ 20,
1799
+ 25,
1800
+ 30,
1801
+ 35,
1802
+ 40,
1803
+ 45,
1804
+ 50,
1805
+ 55,
1806
+ 60,
1807
+ 65,
1808
+ 70,
1809
+ 75,
1810
+ 80,
1811
+ 85,
1812
+ 90,
1813
+ 95,
1814
+ 100
1815
+ ],
1816
+ "values": [
1817
+ 0.0,
1818
+ 0.117174,
1819
+ 0.121423,
1820
+ 0.124694,
1821
+ 0.127162,
1822
+ 0.12866,
1823
+ 0.129714,
1824
+ 0.13069,
1825
+ 0.131558,
1826
+ 0.132276,
1827
+ 0.132701,
1828
+ 0.133086,
1829
+ 0.133441,
1830
+ 0.133845,
1831
+ 0.134272,
1832
+ 0.134903,
1833
+ 0.135574,
1834
+ 0.136905,
1835
+ 0.139199,
1836
+ 0.144646,
1837
+ 0.161315
1838
+ ],
1839
+ "median": 0.132701,
1840
+ "p25": 0.12866,
1841
+ "p75": 0.134903
1842
+ }
1843
+ },
1844
+ "entropy_mean": {
1845
+ "amplicon_16s": {
1846
+ "percentiles": [
1847
+ 0,
1848
+ 5,
1849
+ 10,
1850
+ 15,
1851
+ 20,
1852
+ 25,
1853
+ 30,
1854
+ 35,
1855
+ 40,
1856
+ 45,
1857
+ 50,
1858
+ 55,
1859
+ 60,
1860
+ 65,
1861
+ 70,
1862
+ 75,
1863
+ 80,
1864
+ 85,
1865
+ 90,
1866
+ 95,
1867
+ 100
1868
+ ],
1869
+ "values": [
1870
+ 0.193185,
1871
+ 1.925168,
1872
+ 1.942663,
1873
+ 1.946122,
1874
+ 1.949497,
1875
+ 1.952257,
1876
+ 1.955384,
1877
+ 1.957797,
1878
+ 1.959115,
1879
+ 1.961291,
1880
+ 1.962554,
1881
+ 1.963916,
1882
+ 1.964967,
1883
+ 1.966308,
1884
+ 1.967599,
1885
+ 1.969294,
1886
+ 1.971775,
1887
+ 1.974463,
1888
+ 1.977014,
1889
+ 1.983662,
1890
+ 2.013528
1891
+ ],
1892
+ "median": 1.962554,
1893
+ "p25": 1.952257,
1894
+ "p75": 1.969294
1895
+ },
1896
+ "atac_seq": {
1897
+ "percentiles": [
1898
+ 0,
1899
+ 5,
1900
+ 10,
1901
+ 15,
1902
+ 20,
1903
+ 25,
1904
+ 30,
1905
+ 35,
1906
+ 40,
1907
+ 45,
1908
+ 50,
1909
+ 55,
1910
+ 60,
1911
+ 65,
1912
+ 70,
1913
+ 75,
1914
+ 80,
1915
+ 85,
1916
+ 90,
1917
+ 95,
1918
+ 100
1919
+ ],
1920
+ "values": [
1921
+ 1.405639,
1922
+ 1.851622,
1923
+ 1.862082,
1924
+ 1.868587,
1925
+ 1.874501,
1926
+ 1.878449,
1927
+ 1.882454,
1928
+ 1.886164,
1929
+ 1.890785,
1930
+ 1.894906,
1931
+ 1.899933,
1932
+ 1.90529,
1933
+ 1.910042,
1934
+ 1.914997,
1935
+ 1.919155,
1936
+ 1.92274,
1937
+ 1.927037,
1938
+ 1.931565,
1939
+ 1.936152,
1940
+ 1.942722,
1941
+ 2.041712
1942
+ ],
1943
+ "median": 1.899933,
1944
+ "p25": 1.878449,
1945
+ "p75": 1.92274
1946
+ },
1947
+ "bisulfite": {
1948
+ "percentiles": [
1949
+ 0,
1950
+ 5,
1951
+ 10,
1952
+ 15,
1953
+ 20,
1954
+ 25,
1955
+ 30,
1956
+ 35,
1957
+ 40,
1958
+ 45,
1959
+ 50,
1960
+ 55,
1961
+ 60,
1962
+ 65,
1963
+ 70,
1964
+ 75,
1965
+ 80,
1966
+ 85,
1967
+ 90,
1968
+ 95,
1969
+ 100
1970
+ ],
1971
+ "values": [
1972
+ 1.137866,
1973
+ 1.491558,
1974
+ 1.509153,
1975
+ 1.519845,
1976
+ 1.529636,
1977
+ 1.535733,
1978
+ 1.543511,
1979
+ 1.55348,
1980
+ 1.56368,
1981
+ 1.575252,
1982
+ 1.583118,
1983
+ 1.593065,
1984
+ 1.602064,
1985
+ 1.609356,
1986
+ 1.623046,
1987
+ 1.641838,
1988
+ 1.664016,
1989
+ 1.69915,
1990
+ 1.763204,
1991
+ 1.829143,
1992
+ 1.938364
1993
+ ],
1994
+ "median": 1.583118,
1995
+ "p25": 1.535733,
1996
+ "p75": 1.641838
1997
+ },
1998
+ "chip_seq": {
1999
+ "percentiles": [
2000
+ 0,
2001
+ 5,
2002
+ 10,
2003
+ 15,
2004
+ 20,
2005
+ 25,
2006
+ 30,
2007
+ 35,
2008
+ 40,
2009
+ 45,
2010
+ 50,
2011
+ 55,
2012
+ 60,
2013
+ 65,
2014
+ 70,
2015
+ 75,
2016
+ 80,
2017
+ 85,
2018
+ 90,
2019
+ 95,
2020
+ 100
2021
+ ],
2022
+ "values": [
2023
+ 1.143516,
2024
+ 1.852296,
2025
+ 1.863842,
2026
+ 1.87193,
2027
+ 1.875994,
2028
+ 1.880474,
2029
+ 1.883374,
2030
+ 1.887672,
2031
+ 1.891368,
2032
+ 1.895441,
2033
+ 1.898685,
2034
+ 1.901801,
2035
+ 1.906409,
2036
+ 1.911554,
2037
+ 1.915614,
2038
+ 1.920679,
2039
+ 1.926242,
2040
+ 1.930762,
2041
+ 1.936285,
2042
+ 1.949113,
2043
+ 2.082121
2044
+ ],
2045
+ "median": 1.898685,
2046
+ "p25": 1.880474,
2047
+ "p75": 1.920679
2048
+ },
2049
+ "cut_and_run": {
2050
+ "percentiles": [
2051
+ 0,
2052
+ 5,
2053
+ 10,
2054
+ 15,
2055
+ 20,
2056
+ 25,
2057
+ 30,
2058
+ 35,
2059
+ 40,
2060
+ 45,
2061
+ 50,
2062
+ 55,
2063
+ 60,
2064
+ 65,
2065
+ 70,
2066
+ 75,
2067
+ 80,
2068
+ 85,
2069
+ 90,
2070
+ 95,
2071
+ 100
2072
+ ],
2073
+ "values": [
2074
+ 1.149211,
2075
+ 1.828256,
2076
+ 1.847069,
2077
+ 1.856197,
2078
+ 1.861266,
2079
+ 1.865769,
2080
+ 1.869439,
2081
+ 1.873303,
2082
+ 1.876558,
2083
+ 1.87942,
2084
+ 1.882917,
2085
+ 1.890433,
2086
+ 1.897795,
2087
+ 1.902813,
2088
+ 1.907286,
2089
+ 1.911696,
2090
+ 1.91658,
2091
+ 1.921016,
2092
+ 1.926219,
2093
+ 1.932498,
2094
+ 1.9697
2095
+ ],
2096
+ "median": 1.882917,
2097
+ "p25": 1.865769,
2098
+ "p75": 1.911696
2099
+ },
2100
+ "cut_and_tag": {
2101
+ "percentiles": [
2102
+ 0,
2103
+ 5,
2104
+ 10,
2105
+ 15,
2106
+ 20,
2107
+ 25,
2108
+ 30,
2109
+ 35,
2110
+ 40,
2111
+ 45,
2112
+ 50,
2113
+ 55,
2114
+ 60,
2115
+ 65,
2116
+ 70,
2117
+ 75,
2118
+ 80,
2119
+ 85,
2120
+ 90,
2121
+ 95,
2122
+ 100
2123
+ ],
2124
+ "values": [
2125
+ 1.496533,
2126
+ 1.844185,
2127
+ 1.867149,
2128
+ 1.880951,
2129
+ 1.888998,
2130
+ 1.896179,
2131
+ 1.901587,
2132
+ 1.906967,
2133
+ 1.911241,
2134
+ 1.915885,
2135
+ 1.919622,
2136
+ 1.922613,
2137
+ 1.925787,
2138
+ 1.927742,
2139
+ 1.93007,
2140
+ 1.93251,
2141
+ 1.934917,
2142
+ 1.937767,
2143
+ 1.941743,
2144
+ 1.946995,
2145
+ 2.002251
2146
+ ],
2147
+ "median": 1.919622,
2148
+ "p25": 1.896179,
2149
+ "p75": 1.93251
2150
+ },
2151
+ "rna_seq": {
2152
+ "percentiles": [
2153
+ 0,
2154
+ 5,
2155
+ 10,
2156
+ 15,
2157
+ 20,
2158
+ 25,
2159
+ 30,
2160
+ 35,
2161
+ 40,
2162
+ 45,
2163
+ 50,
2164
+ 55,
2165
+ 60,
2166
+ 65,
2167
+ 70,
2168
+ 75,
2169
+ 80,
2170
+ 85,
2171
+ 90,
2172
+ 95,
2173
+ 100
2174
+ ],
2175
+ "values": [
2176
+ 1.503762,
2177
+ 1.804615,
2178
+ 1.838448,
2179
+ 1.843808,
2180
+ 1.859994,
2181
+ 1.881329,
2182
+ 1.895739,
2183
+ 1.900167,
2184
+ 1.904418,
2185
+ 1.91002,
2186
+ 1.916552,
2187
+ 1.924123,
2188
+ 1.928528,
2189
+ 1.933234,
2190
+ 1.936649,
2191
+ 1.938232,
2192
+ 1.942162,
2193
+ 1.946659,
2194
+ 1.949771,
2195
+ 1.959196,
2196
+ 2.042898
2197
+ ],
2198
+ "median": 1.916552,
2199
+ "p25": 1.881329,
2200
+ "p75": 1.938232
2201
+ },
2202
+ "sc_atac_seq": {
2203
+ "percentiles": [
2204
+ 0,
2205
+ 5,
2206
+ 10,
2207
+ 15,
2208
+ 20,
2209
+ 25,
2210
+ 30,
2211
+ 35,
2212
+ 40,
2213
+ 45,
2214
+ 50,
2215
+ 55,
2216
+ 60,
2217
+ 65,
2218
+ 70,
2219
+ 75,
2220
+ 80,
2221
+ 85,
2222
+ 90,
2223
+ 95,
2224
+ 100
2225
+ ],
2226
+ "values": [
2227
+ 0.995414,
2228
+ 1.849842,
2229
+ 1.856174,
2230
+ 1.862734,
2231
+ 1.868832,
2232
+ 1.877282,
2233
+ 1.882924,
2234
+ 1.886493,
2235
+ 1.890392,
2236
+ 1.893958,
2237
+ 1.897648,
2238
+ 1.900949,
2239
+ 1.90329,
2240
+ 1.906675,
2241
+ 1.916659,
2242
+ 1.928856,
2243
+ 1.938433,
2244
+ 1.940955,
2245
+ 1.952466,
2246
+ 1.955661,
2247
+ 2.049615
2248
+ ],
2249
+ "median": 1.897648,
2250
+ "p25": 1.877282,
2251
+ "p75": 1.928856
2252
+ },
2253
+ "sc_rna_seq": {
2254
+ "percentiles": [
2255
+ 0,
2256
+ 5,
2257
+ 10,
2258
+ 15,
2259
+ 20,
2260
+ 25,
2261
+ 30,
2262
+ 35,
2263
+ 40,
2264
+ 45,
2265
+ 50,
2266
+ 55,
2267
+ 60,
2268
+ 65,
2269
+ 70,
2270
+ 75,
2271
+ 80,
2272
+ 85,
2273
+ 90,
2274
+ 95,
2275
+ 100
2276
+ ],
2277
+ "values": [
2278
+ 0.809289,
2279
+ 1.770048,
2280
+ 1.843228,
2281
+ 1.875872,
2282
+ 1.891787,
2283
+ 1.898915,
2284
+ 1.905365,
2285
+ 1.910111,
2286
+ 1.913525,
2287
+ 1.915818,
2288
+ 1.917421,
2289
+ 1.920067,
2290
+ 1.922905,
2291
+ 1.926937,
2292
+ 1.931372,
2293
+ 1.93507,
2294
+ 1.939136,
2295
+ 1.945157,
2296
+ 1.952392,
2297
+ 1.961407,
2298
+ 2.189453
2299
+ ],
2300
+ "median": 1.917421,
2301
+ "p25": 1.898915,
2302
+ "p75": 1.93507
2303
+ },
2304
+ "spatial": {
2305
+ "percentiles": [
2306
+ 0,
2307
+ 5,
2308
+ 10,
2309
+ 15,
2310
+ 20,
2311
+ 25,
2312
+ 30,
2313
+ 35,
2314
+ 40,
2315
+ 45,
2316
+ 50,
2317
+ 55,
2318
+ 60,
2319
+ 65,
2320
+ 70,
2321
+ 75,
2322
+ 80,
2323
+ 85,
2324
+ 90,
2325
+ 95,
2326
+ 100
2327
+ ],
2328
+ "values": [
2329
+ 1.105342,
2330
+ 1.66277,
2331
+ 1.796645,
2332
+ 1.844675,
2333
+ 1.860301,
2334
+ 1.885395,
2335
+ 1.905456,
2336
+ 1.912486,
2337
+ 1.914435,
2338
+ 1.916414,
2339
+ 1.918305,
2340
+ 1.920779,
2341
+ 1.927201,
2342
+ 1.933186,
2343
+ 1.943598,
2344
+ 1.947934,
2345
+ 1.949879,
2346
+ 1.952701,
2347
+ 1.962617,
2348
+ 2.022818,
2349
+ 2.089907
2350
+ ],
2351
+ "median": 1.918305,
2352
+ "p25": 1.885395,
2353
+ "p75": 1.947934
2354
+ },
2355
+ "wes": {
2356
+ "percentiles": [
2357
+ 0,
2358
+ 5,
2359
+ 10,
2360
+ 15,
2361
+ 20,
2362
+ 25,
2363
+ 30,
2364
+ 35,
2365
+ 40,
2366
+ 45,
2367
+ 50,
2368
+ 55,
2369
+ 60,
2370
+ 65,
2371
+ 70,
2372
+ 75,
2373
+ 80,
2374
+ 85,
2375
+ 90,
2376
+ 95,
2377
+ 100
2378
+ ],
2379
+ "values": [
2380
+ 1.704365,
2381
+ 1.872484,
2382
+ 1.88638,
2383
+ 1.895231,
2384
+ 1.905065,
2385
+ 1.911485,
2386
+ 1.916918,
2387
+ 1.920861,
2388
+ 1.92439,
2389
+ 1.926777,
2390
+ 1.928476,
2391
+ 1.931436,
2392
+ 1.934177,
2393
+ 1.9363,
2394
+ 1.93906,
2395
+ 1.941046,
2396
+ 1.944485,
2397
+ 1.94725,
2398
+ 1.9516,
2399
+ 1.957561,
2400
+ 2.160871
2401
+ ],
2402
+ "median": 1.928476,
2403
+ "p25": 1.911485,
2404
+ "p75": 1.941046
2405
+ },
2406
+ "wgs": {
2407
+ "percentiles": [
2408
+ 0,
2409
+ 5,
2410
+ 10,
2411
+ 15,
2412
+ 20,
2413
+ 25,
2414
+ 30,
2415
+ 35,
2416
+ 40,
2417
+ 45,
2418
+ 50,
2419
+ 55,
2420
+ 60,
2421
+ 65,
2422
+ 70,
2423
+ 75,
2424
+ 80,
2425
+ 85,
2426
+ 90,
2427
+ 95,
2428
+ 100
2429
+ ],
2430
+ "values": [
2431
+ 0.34797,
2432
+ 1.849846,
2433
+ 1.872729,
2434
+ 1.881007,
2435
+ 1.887597,
2436
+ 1.893615,
2437
+ 1.897042,
2438
+ 1.900972,
2439
+ 1.903767,
2440
+ 1.906265,
2441
+ 1.90811,
2442
+ 1.910049,
2443
+ 1.912162,
2444
+ 1.914175,
2445
+ 1.916922,
2446
+ 1.921965,
2447
+ 1.927197,
2448
+ 1.933066,
2449
+ 1.93988,
2450
+ 1.947826,
2451
+ 2.014753
2452
+ ],
2453
+ "median": 1.90811,
2454
+ "p25": 1.893615,
2455
+ "p75": 1.921965
2456
+ }
2457
+ },
2458
+ "gc_std": {
2459
+ "amplicon_16s": {
2460
+ "percentiles": [
2461
+ 0,
2462
+ 5,
2463
+ 10,
2464
+ 15,
2465
+ 20,
2466
+ 25,
2467
+ 30,
2468
+ 35,
2469
+ 40,
2470
+ 45,
2471
+ 50,
2472
+ 55,
2473
+ 60,
2474
+ 65,
2475
+ 70,
2476
+ 75,
2477
+ 80,
2478
+ 85,
2479
+ 90,
2480
+ 95,
2481
+ 100
2482
+ ],
2483
+ "values": [
2484
+ 0.001895,
2485
+ 0.01336,
2486
+ 0.018023,
2487
+ 0.021839,
2488
+ 0.024426,
2489
+ 0.026254,
2490
+ 0.027911,
2491
+ 0.029732,
2492
+ 0.031045,
2493
+ 0.032493,
2494
+ 0.03387,
2495
+ 0.035785,
2496
+ 0.037183,
2497
+ 0.039145,
2498
+ 0.041189,
2499
+ 0.043405,
2500
+ 0.046369,
2501
+ 0.050096,
2502
+ 0.056564,
2503
+ 0.078586,
2504
+ 0.261359
2505
+ ],
2506
+ "median": 0.03387,
2507
+ "p25": 0.026254,
2508
+ "p75": 0.043405
2509
+ },
2510
+ "atac_seq": {
2511
+ "percentiles": [
2512
+ 0,
2513
+ 5,
2514
+ 10,
2515
+ 15,
2516
+ 20,
2517
+ 25,
2518
+ 30,
2519
+ 35,
2520
+ 40,
2521
+ 45,
2522
+ 50,
2523
+ 55,
2524
+ 60,
2525
+ 65,
2526
+ 70,
2527
+ 75,
2528
+ 80,
2529
+ 85,
2530
+ 90,
2531
+ 95,
2532
+ 100
2533
+ ],
2534
+ "values": [
2535
+ 0.0,
2536
+ 0.08038,
2537
+ 0.090207,
2538
+ 0.094017,
2539
+ 0.097892,
2540
+ 0.101084,
2541
+ 0.103607,
2542
+ 0.105773,
2543
+ 0.107576,
2544
+ 0.110075,
2545
+ 0.112357,
2546
+ 0.114346,
2547
+ 0.115827,
2548
+ 0.117661,
2549
+ 0.119961,
2550
+ 0.122501,
2551
+ 0.125733,
2552
+ 0.129009,
2553
+ 0.134045,
2554
+ 0.140502,
2555
+ 0.165652
2556
+ ],
2557
+ "median": 0.112357,
2558
+ "p25": 0.101084,
2559
+ "p75": 0.122501
2560
+ },
2561
+ "bisulfite": {
2562
+ "percentiles": [
2563
+ 0,
2564
+ 5,
2565
+ 10,
2566
+ 15,
2567
+ 20,
2568
+ 25,
2569
+ 30,
2570
+ 35,
2571
+ 40,
2572
+ 45,
2573
+ 50,
2574
+ 55,
2575
+ 60,
2576
+ 65,
2577
+ 70,
2578
+ 75,
2579
+ 80,
2580
+ 85,
2581
+ 90,
2582
+ 95,
2583
+ 100
2584
+ ],
2585
+ "values": [
2586
+ 0.027845,
2587
+ 0.062375,
2588
+ 0.067806,
2589
+ 0.071196,
2590
+ 0.073931,
2591
+ 0.0757,
2592
+ 0.077264,
2593
+ 0.078834,
2594
+ 0.081037,
2595
+ 0.083931,
2596
+ 0.087846,
2597
+ 0.090553,
2598
+ 0.093697,
2599
+ 0.097733,
2600
+ 0.102805,
2601
+ 0.107529,
2602
+ 0.112251,
2603
+ 0.117758,
2604
+ 0.126466,
2605
+ 0.152782,
2606
+ 0.240678
2607
+ ],
2608
+ "median": 0.087846,
2609
+ "p25": 0.0757,
2610
+ "p75": 0.107529
2611
+ },
2612
+ "chip_seq": {
2613
+ "percentiles": [
2614
+ 0,
2615
+ 5,
2616
+ 10,
2617
+ 15,
2618
+ 20,
2619
+ 25,
2620
+ 30,
2621
+ 35,
2622
+ 40,
2623
+ 45,
2624
+ 50,
2625
+ 55,
2626
+ 60,
2627
+ 65,
2628
+ 70,
2629
+ 75,
2630
+ 80,
2631
+ 85,
2632
+ 90,
2633
+ 95,
2634
+ 100
2635
+ ],
2636
+ "values": [
2637
+ 0.0,
2638
+ 0.075679,
2639
+ 0.083144,
2640
+ 0.087393,
2641
+ 0.090747,
2642
+ 0.09436,
2643
+ 0.096761,
2644
+ 0.099456,
2645
+ 0.102292,
2646
+ 0.104934,
2647
+ 0.107486,
2648
+ 0.109768,
2649
+ 0.111966,
2650
+ 0.114029,
2651
+ 0.116774,
2652
+ 0.119694,
2653
+ 0.122398,
2654
+ 0.127196,
2655
+ 0.13363,
2656
+ 0.143464,
2657
+ 0.294369
2658
+ ],
2659
+ "median": 0.107486,
2660
+ "p25": 0.09436,
2661
+ "p75": 0.119694
2662
+ },
2663
+ "cut_and_run": {
2664
+ "percentiles": [
2665
+ 0,
2666
+ 5,
2667
+ 10,
2668
+ 15,
2669
+ 20,
2670
+ 25,
2671
+ 30,
2672
+ 35,
2673
+ 40,
2674
+ 45,
2675
+ 50,
2676
+ 55,
2677
+ 60,
2678
+ 65,
2679
+ 70,
2680
+ 75,
2681
+ 80,
2682
+ 85,
2683
+ 90,
2684
+ 95,
2685
+ 100
2686
+ ],
2687
+ "values": [
2688
+ 0.045938,
2689
+ 0.087978,
2690
+ 0.09319,
2691
+ 0.097476,
2692
+ 0.101975,
2693
+ 0.104279,
2694
+ 0.106071,
2695
+ 0.107837,
2696
+ 0.10965,
2697
+ 0.111754,
2698
+ 0.113555,
2699
+ 0.115361,
2700
+ 0.117212,
2701
+ 0.120033,
2702
+ 0.122416,
2703
+ 0.124665,
2704
+ 0.126853,
2705
+ 0.130253,
2706
+ 0.136392,
2707
+ 0.147702,
2708
+ 0.252199
2709
+ ],
2710
+ "median": 0.113555,
2711
+ "p25": 0.104279,
2712
+ "p75": 0.124665
2713
+ },
2714
+ "cut_and_tag": {
2715
+ "percentiles": [
2716
+ 0,
2717
+ 5,
2718
+ 10,
2719
+ 15,
2720
+ 20,
2721
+ 25,
2722
+ 30,
2723
+ 35,
2724
+ 40,
2725
+ 45,
2726
+ 50,
2727
+ 55,
2728
+ 60,
2729
+ 65,
2730
+ 70,
2731
+ 75,
2732
+ 80,
2733
+ 85,
2734
+ 90,
2735
+ 95,
2736
+ 100
2737
+ ],
2738
+ "values": [
2739
+ 0.048899,
2740
+ 0.076303,
2741
+ 0.081961,
2742
+ 0.084236,
2743
+ 0.087584,
2744
+ 0.090112,
2745
+ 0.092952,
2746
+ 0.095378,
2747
+ 0.097978,
2748
+ 0.100252,
2749
+ 0.102105,
2750
+ 0.104116,
2751
+ 0.107345,
2752
+ 0.109807,
2753
+ 0.111821,
2754
+ 0.114043,
2755
+ 0.116637,
2756
+ 0.11989,
2757
+ 0.124333,
2758
+ 0.130972,
2759
+ 0.25996
2760
+ ],
2761
+ "median": 0.102105,
2762
+ "p25": 0.090112,
2763
+ "p75": 0.114043
2764
+ },
2765
+ "rna_seq": {
2766
+ "percentiles": [
2767
+ 0,
2768
+ 5,
2769
+ 10,
2770
+ 15,
2771
+ 20,
2772
+ 25,
2773
+ 30,
2774
+ 35,
2775
+ 40,
2776
+ 45,
2777
+ 50,
2778
+ 55,
2779
+ 60,
2780
+ 65,
2781
+ 70,
2782
+ 75,
2783
+ 80,
2784
+ 85,
2785
+ 90,
2786
+ 95,
2787
+ 100
2788
+ ],
2789
+ "values": [
2790
+ 0.0,
2791
+ 0.065229,
2792
+ 0.083491,
2793
+ 0.088745,
2794
+ 0.091853,
2795
+ 0.094859,
2796
+ 0.098158,
2797
+ 0.100844,
2798
+ 0.103884,
2799
+ 0.107284,
2800
+ 0.109788,
2801
+ 0.111824,
2802
+ 0.114524,
2803
+ 0.117164,
2804
+ 0.123097,
2805
+ 0.129667,
2806
+ 0.134646,
2807
+ 0.137511,
2808
+ 0.139496,
2809
+ 0.143283,
2810
+ 0.20731
2811
+ ],
2812
+ "median": 0.109788,
2813
+ "p25": 0.094859,
2814
+ "p75": 0.129667
2815
+ },
2816
+ "sc_atac_seq": {
2817
+ "percentiles": [
2818
+ 0,
2819
+ 5,
2820
+ 10,
2821
+ 15,
2822
+ 20,
2823
+ 25,
2824
+ 30,
2825
+ 35,
2826
+ 40,
2827
+ 45,
2828
+ 50,
2829
+ 55,
2830
+ 60,
2831
+ 65,
2832
+ 70,
2833
+ 75,
2834
+ 80,
2835
+ 85,
2836
+ 90,
2837
+ 95,
2838
+ 100
2839
+ ],
2840
+ "values": [
2841
+ 0.0,
2842
+ 0.072902,
2843
+ 0.075847,
2844
+ 0.078594,
2845
+ 0.082696,
2846
+ 0.085975,
2847
+ 0.099143,
2848
+ 0.106649,
2849
+ 0.113083,
2850
+ 0.119095,
2851
+ 0.123179,
2852
+ 0.126109,
2853
+ 0.127901,
2854
+ 0.130235,
2855
+ 0.131888,
2856
+ 0.133861,
2857
+ 0.135808,
2858
+ 0.13819,
2859
+ 0.141073,
2860
+ 0.146388,
2861
+ 0.159718
2862
+ ],
2863
+ "median": 0.123179,
2864
+ "p25": 0.085975,
2865
+ "p75": 0.133861
2866
+ },
2867
+ "sc_rna_seq": {
2868
+ "percentiles": [
2869
+ 0,
2870
+ 5,
2871
+ 10,
2872
+ 15,
2873
+ 20,
2874
+ 25,
2875
+ 30,
2876
+ 35,
2877
+ 40,
2878
+ 45,
2879
+ 50,
2880
+ 55,
2881
+ 60,
2882
+ 65,
2883
+ 70,
2884
+ 75,
2885
+ 80,
2886
+ 85,
2887
+ 90,
2888
+ 95,
2889
+ 100
2890
+ ],
2891
+ "values": [
2892
+ 0.0,
2893
+ 0.056431,
2894
+ 0.070452,
2895
+ 0.078632,
2896
+ 0.081714,
2897
+ 0.083689,
2898
+ 0.086067,
2899
+ 0.088649,
2900
+ 0.091335,
2901
+ 0.093926,
2902
+ 0.096223,
2903
+ 0.10001,
2904
+ 0.104035,
2905
+ 0.108049,
2906
+ 0.110658,
2907
+ 0.113447,
2908
+ 0.11727,
2909
+ 0.120539,
2910
+ 0.125225,
2911
+ 0.138567,
2912
+ 0.23613
2913
+ ],
2914
+ "median": 0.096223,
2915
+ "p25": 0.083689,
2916
+ "p75": 0.113447
2917
+ },
2918
+ "spatial": {
2919
+ "percentiles": [
2920
+ 0,
2921
+ 5,
2922
+ 10,
2923
+ 15,
2924
+ 20,
2925
+ 25,
2926
+ 30,
2927
+ 35,
2928
+ 40,
2929
+ 45,
2930
+ 50,
2931
+ 55,
2932
+ 60,
2933
+ 65,
2934
+ 70,
2935
+ 75,
2936
+ 80,
2937
+ 85,
2938
+ 90,
2939
+ 95,
2940
+ 100
2941
+ ],
2942
+ "values": [
2943
+ 0.0,
2944
+ 0.050046,
2945
+ 0.067016,
2946
+ 0.068215,
2947
+ 0.069571,
2948
+ 0.074751,
2949
+ 0.080277,
2950
+ 0.081531,
2951
+ 0.082901,
2952
+ 0.085903,
2953
+ 0.090073,
2954
+ 0.091848,
2955
+ 0.092933,
2956
+ 0.094467,
2957
+ 0.096229,
2958
+ 0.099566,
2959
+ 0.106082,
2960
+ 0.11314,
2961
+ 0.118563,
2962
+ 0.131164,
2963
+ 0.228159
2964
+ ],
2965
+ "median": 0.090073,
2966
+ "p25": 0.074751,
2967
+ "p75": 0.099566
2968
+ },
2969
+ "wes": {
2970
+ "percentiles": [
2971
+ 0,
2972
+ 5,
2973
+ 10,
2974
+ 15,
2975
+ 20,
2976
+ 25,
2977
+ 30,
2978
+ 35,
2979
+ 40,
2980
+ 45,
2981
+ 50,
2982
+ 55,
2983
+ 60,
2984
+ 65,
2985
+ 70,
2986
+ 75,
2987
+ 80,
2988
+ 85,
2989
+ 90,
2990
+ 95,
2991
+ 100
2992
+ ],
2993
+ "values": [
2994
+ 0.0,
2995
+ 0.073633,
2996
+ 0.078212,
2997
+ 0.080561,
2998
+ 0.083047,
2999
+ 0.085195,
3000
+ 0.088278,
3001
+ 0.089869,
3002
+ 0.091656,
3003
+ 0.09356,
3004
+ 0.095482,
3005
+ 0.097813,
3006
+ 0.099416,
3007
+ 0.102481,
3008
+ 0.105618,
3009
+ 0.108779,
3010
+ 0.11187,
3011
+ 0.114336,
3012
+ 0.11806,
3013
+ 0.121856,
3014
+ 0.142186
3015
+ ],
3016
+ "median": 0.095482,
3017
+ "p25": 0.085195,
3018
+ "p75": 0.108779
3019
+ },
3020
+ "wgs": {
3021
+ "percentiles": [
3022
+ 0,
3023
+ 5,
3024
+ 10,
3025
+ 15,
3026
+ 20,
3027
+ 25,
3028
+ 30,
3029
+ 35,
3030
+ 40,
3031
+ 45,
3032
+ 50,
3033
+ 55,
3034
+ 60,
3035
+ 65,
3036
+ 70,
3037
+ 75,
3038
+ 80,
3039
+ 85,
3040
+ 90,
3041
+ 95,
3042
+ 100
3043
+ ],
3044
+ "values": [
3045
+ 0.0,
3046
+ 0.068401,
3047
+ 0.073701,
3048
+ 0.076647,
3049
+ 0.079266,
3050
+ 0.08276,
3051
+ 0.084433,
3052
+ 0.087341,
3053
+ 0.091022,
3054
+ 0.09486,
3055
+ 0.096905,
3056
+ 0.099366,
3057
+ 0.102506,
3058
+ 0.105296,
3059
+ 0.10871,
3060
+ 0.112384,
3061
+ 0.116113,
3062
+ 0.120504,
3063
+ 0.126012,
3064
+ 0.135487,
3065
+ 0.180212
3066
+ ],
3067
+ "median": 0.096905,
3068
+ "p25": 0.08276,
3069
+ "p75": 0.112384
3070
+ }
3071
+ },
3072
+ "rl_mean": {
3073
+ "amplicon_16s": {
3074
+ "percentiles": [
3075
+ 0,
3076
+ 5,
3077
+ 10,
3078
+ 15,
3079
+ 20,
3080
+ 25,
3081
+ 30,
3082
+ 35,
3083
+ 40,
3084
+ 45,
3085
+ 50,
3086
+ 55,
3087
+ 60,
3088
+ 65,
3089
+ 70,
3090
+ 75,
3091
+ 80,
3092
+ 85,
3093
+ 90,
3094
+ 95,
3095
+ 100
3096
+ ],
3097
+ "values": [
3098
+ 55.623138,
3099
+ 151.0,
3100
+ 230.163214,
3101
+ 249.436923,
3102
+ 250.0,
3103
+ 250.942261,
3104
+ 251.0,
3105
+ 251.0,
3106
+ 275.93479,
3107
+ 292.286449,
3108
+ 296.0,
3109
+ 300.0,
3110
+ 300.648901,
3111
+ 300.901807,
3112
+ 301.0,
3113
+ 301.0,
3114
+ 301.0,
3115
+ 301.0,
3116
+ 356.875131,
3117
+ 468.32173,
3118
+ 3042.0
3119
+ ],
3120
+ "median": 296.0,
3121
+ "p25": 250.942261,
3122
+ "p75": 301.0
3123
+ },
3124
+ "atac_seq": {
3125
+ "percentiles": [
3126
+ 0,
3127
+ 5,
3128
+ 10,
3129
+ 15,
3130
+ 20,
3131
+ 25,
3132
+ 30,
3133
+ 35,
3134
+ 40,
3135
+ 45,
3136
+ 50,
3137
+ 55,
3138
+ 60,
3139
+ 65,
3140
+ 70,
3141
+ 75,
3142
+ 80,
3143
+ 85,
3144
+ 90,
3145
+ 95,
3146
+ 100
3147
+ ],
3148
+ "values": [
3149
+ 8.0,
3150
+ 36.0,
3151
+ 37.509673,
3152
+ 42.0,
3153
+ 50.0,
3154
+ 50.0,
3155
+ 50.0,
3156
+ 51.0,
3157
+ 51.0,
3158
+ 65.0,
3159
+ 75.653683,
3160
+ 82.67833,
3161
+ 100.0,
3162
+ 101.0,
3163
+ 101.0,
3164
+ 150.0,
3165
+ 150.0,
3166
+ 150.0,
3167
+ 150.0,
3168
+ 151.0,
3169
+ 225.302994
3170
+ ],
3171
+ "median": 75.653687,
3172
+ "p25": 50.0,
3173
+ "p75": 150.0
3174
+ },
3175
+ "bisulfite": {
3176
+ "percentiles": [
3177
+ 0,
3178
+ 5,
3179
+ 10,
3180
+ 15,
3181
+ 20,
3182
+ 25,
3183
+ 30,
3184
+ 35,
3185
+ 40,
3186
+ 45,
3187
+ 50,
3188
+ 55,
3189
+ 60,
3190
+ 65,
3191
+ 70,
3192
+ 75,
3193
+ 80,
3194
+ 85,
3195
+ 90,
3196
+ 95,
3197
+ 100
3198
+ ],
3199
+ "values": [
3200
+ 6.0,
3201
+ 51.0,
3202
+ 61.0,
3203
+ 65.108395,
3204
+ 76.0,
3205
+ 100.0,
3206
+ 100.0,
3207
+ 100.0,
3208
+ 101.0,
3209
+ 117.671698,
3210
+ 127.182083,
3211
+ 143.003043,
3212
+ 150.0,
3213
+ 150.0,
3214
+ 150.0,
3215
+ 150.0,
3216
+ 151.0,
3217
+ 151.0,
3218
+ 151.0,
3219
+ 151.0,
3220
+ 301.0
3221
+ ],
3222
+ "median": 127.182083,
3223
+ "p25": 100.0,
3224
+ "p75": 150.0
3225
+ },
3226
+ "chip_seq": {
3227
+ "percentiles": [
3228
+ 0,
3229
+ 5,
3230
+ 10,
3231
+ 15,
3232
+ 20,
3233
+ 25,
3234
+ 30,
3235
+ 35,
3236
+ 40,
3237
+ 45,
3238
+ 50,
3239
+ 55,
3240
+ 60,
3241
+ 65,
3242
+ 70,
3243
+ 75,
3244
+ 80,
3245
+ 85,
3246
+ 90,
3247
+ 95,
3248
+ 100
3249
+ ],
3250
+ "values": [
3251
+ 25.0,
3252
+ 36.0,
3253
+ 49.995287,
3254
+ 50.0,
3255
+ 50.456245,
3256
+ 51.0,
3257
+ 51.0,
3258
+ 60.463809,
3259
+ 74.551271,
3260
+ 75.484213,
3261
+ 76.0,
3262
+ 76.0,
3263
+ 100.0,
3264
+ 101.0,
3265
+ 147.368027,
3266
+ 150.0,
3267
+ 150.0,
3268
+ 150.0,
3269
+ 150.0,
3270
+ 151.0,
3271
+ 183.811844
3272
+ ],
3273
+ "median": 76.0,
3274
+ "p25": 51.0,
3275
+ "p75": 150.0
3276
+ },
3277
+ "cut_and_run": {
3278
+ "percentiles": [
3279
+ 0,
3280
+ 5,
3281
+ 10,
3282
+ 15,
3283
+ 20,
3284
+ 25,
3285
+ 30,
3286
+ 35,
3287
+ 40,
3288
+ 45,
3289
+ 50,
3290
+ 55,
3291
+ 60,
3292
+ 65,
3293
+ 70,
3294
+ 75,
3295
+ 80,
3296
+ 85,
3297
+ 90,
3298
+ 95,
3299
+ 100
3300
+ ],
3301
+ "values": [
3302
+ 21.0,
3303
+ 36.188413,
3304
+ 38.480304,
3305
+ 39.0,
3306
+ 40.0,
3307
+ 43.0,
3308
+ 44.506591,
3309
+ 49.751845,
3310
+ 50.473156,
3311
+ 51.0,
3312
+ 51.0,
3313
+ 71.099979,
3314
+ 76.0,
3315
+ 100.0,
3316
+ 101.0,
3317
+ 128.191463,
3318
+ 150.0,
3319
+ 150.0,
3320
+ 150.0,
3321
+ 151.0,
3322
+ 151.0
3323
+ ],
3324
+ "median": 51.0,
3325
+ "p25": 43.0,
3326
+ "p75": 128.191463
3327
+ },
3328
+ "cut_and_tag": {
3329
+ "percentiles": [
3330
+ 0,
3331
+ 5,
3332
+ 10,
3333
+ 15,
3334
+ 20,
3335
+ 25,
3336
+ 30,
3337
+ 35,
3338
+ 40,
3339
+ 45,
3340
+ 50,
3341
+ 55,
3342
+ 60,
3343
+ 65,
3344
+ 70,
3345
+ 75,
3346
+ 80,
3347
+ 85,
3348
+ 90,
3349
+ 95,
3350
+ 100
3351
+ ],
3352
+ "values": [
3353
+ 25.0,
3354
+ 38.0,
3355
+ 50.0,
3356
+ 51.0,
3357
+ 59.0,
3358
+ 74.08643,
3359
+ 76.0,
3360
+ 101.0,
3361
+ 134.950009,
3362
+ 150.0,
3363
+ 150.0,
3364
+ 150.0,
3365
+ 150.0,
3366
+ 150.0,
3367
+ 150.0,
3368
+ 150.0,
3369
+ 150.0,
3370
+ 150.0,
3371
+ 150.0,
3372
+ 151.0,
3373
+ 155.0
3374
+ ],
3375
+ "median": 150.0,
3376
+ "p25": 74.08643,
3377
+ "p75": 150.0
3378
+ },
3379
+ "rna_seq": {
3380
+ "percentiles": [
3381
+ 0,
3382
+ 5,
3383
+ 10,
3384
+ 15,
3385
+ 20,
3386
+ 25,
3387
+ 30,
3388
+ 35,
3389
+ 40,
3390
+ 45,
3391
+ 50,
3392
+ 55,
3393
+ 60,
3394
+ 65,
3395
+ 70,
3396
+ 75,
3397
+ 80,
3398
+ 85,
3399
+ 90,
3400
+ 95,
3401
+ 100
3402
+ ],
3403
+ "values": [
3404
+ 19.0,
3405
+ 36.0,
3406
+ 50.0,
3407
+ 51.0,
3408
+ 60.0,
3409
+ 65.0,
3410
+ 65.0,
3411
+ 75.463577,
3412
+ 86.0,
3413
+ 100.0,
3414
+ 101.0,
3415
+ 101.0,
3416
+ 101.0,
3417
+ 115.0,
3418
+ 147.407436,
3419
+ 150.0,
3420
+ 150.0,
3421
+ 150.0,
3422
+ 150.0,
3423
+ 151.0,
3424
+ 584.454468
3425
+ ],
3426
+ "median": 101.0,
3427
+ "p25": 65.0,
3428
+ "p75": 150.0
3429
+ },
3430
+ "sc_atac_seq": {
3431
+ "percentiles": [
3432
+ 0,
3433
+ 5,
3434
+ 10,
3435
+ 15,
3436
+ 20,
3437
+ 25,
3438
+ 30,
3439
+ 35,
3440
+ 40,
3441
+ 45,
3442
+ 50,
3443
+ 55,
3444
+ 60,
3445
+ 65,
3446
+ 70,
3447
+ 75,
3448
+ 80,
3449
+ 85,
3450
+ 90,
3451
+ 95,
3452
+ 100
3453
+ ],
3454
+ "values": [
3455
+ 8.0,
3456
+ 36.0,
3457
+ 36.0,
3458
+ 36.0,
3459
+ 50.0,
3460
+ 50.0,
3461
+ 50.0,
3462
+ 51.0,
3463
+ 58.0,
3464
+ 75.0,
3465
+ 75.0,
3466
+ 75.0,
3467
+ 75.0,
3468
+ 75.0,
3469
+ 75.0,
3470
+ 101.0,
3471
+ 101.0,
3472
+ 101.0,
3473
+ 151.0,
3474
+ 151.0,
3475
+ 151.0
3476
+ ],
3477
+ "median": 75.0,
3478
+ "p25": 50.0,
3479
+ "p75": 101.0
3480
+ },
3481
+ "sc_rna_seq": {
3482
+ "percentiles": [
3483
+ 0,
3484
+ 5,
3485
+ 10,
3486
+ 15,
3487
+ 20,
3488
+ 25,
3489
+ 30,
3490
+ 35,
3491
+ 40,
3492
+ 45,
3493
+ 50,
3494
+ 55,
3495
+ 60,
3496
+ 65,
3497
+ 70,
3498
+ 75,
3499
+ 80,
3500
+ 85,
3501
+ 90,
3502
+ 95,
3503
+ 100
3504
+ ],
3505
+ "values": [
3506
+ 8.0,
3507
+ 26.0,
3508
+ 28.0,
3509
+ 34.0,
3510
+ 59.0,
3511
+ 70.573565,
3512
+ 71.0,
3513
+ 75.0,
3514
+ 76.0,
3515
+ 76.0,
3516
+ 76.0,
3517
+ 76.0,
3518
+ 90.0,
3519
+ 96.0,
3520
+ 101.0,
3521
+ 126.0,
3522
+ 150.0,
3523
+ 150.0,
3524
+ 150.0,
3525
+ 151.0,
3526
+ 1561.704224
3527
+ ],
3528
+ "median": 76.0,
3529
+ "p25": 70.573565,
3530
+ "p75": 126.0
3531
+ },
3532
+ "spatial": {
3533
+ "percentiles": [
3534
+ 0,
3535
+ 5,
3536
+ 10,
3537
+ 15,
3538
+ 20,
3539
+ 25,
3540
+ 30,
3541
+ 35,
3542
+ 40,
3543
+ 45,
3544
+ 50,
3545
+ 55,
3546
+ 60,
3547
+ 65,
3548
+ 70,
3549
+ 75,
3550
+ 80,
3551
+ 85,
3552
+ 90,
3553
+ 95,
3554
+ 100
3555
+ ],
3556
+ "values": [
3557
+ 10.0,
3558
+ 26.0,
3559
+ 27.0,
3560
+ 28.0,
3561
+ 28.0,
3562
+ 28.0,
3563
+ 28.0,
3564
+ 29.0,
3565
+ 35.0,
3566
+ 51.0,
3567
+ 75.268921,
3568
+ 75.773059,
3569
+ 92.0,
3570
+ 100.0,
3571
+ 100.0,
3572
+ 100.0,
3573
+ 100.0,
3574
+ 100.0,
3575
+ 148.657333,
3576
+ 150.0,
3577
+ 254.770981
3578
+ ],
3579
+ "median": 75.268921,
3580
+ "p25": 28.0,
3581
+ "p75": 100.0
3582
+ },
3583
+ "wes": {
3584
+ "percentiles": [
3585
+ 0,
3586
+ 5,
3587
+ 10,
3588
+ 15,
3589
+ 20,
3590
+ 25,
3591
+ 30,
3592
+ 35,
3593
+ 40,
3594
+ 45,
3595
+ 50,
3596
+ 55,
3597
+ 60,
3598
+ 65,
3599
+ 70,
3600
+ 75,
3601
+ 80,
3602
+ 85,
3603
+ 90,
3604
+ 95,
3605
+ 100
3606
+ ],
3607
+ "values": [
3608
+ 48.979759,
3609
+ 75.0,
3610
+ 75.0,
3611
+ 75.0,
3612
+ 75.0,
3613
+ 76.0,
3614
+ 100.0,
3615
+ 100.0,
3616
+ 101.0,
3617
+ 101.0,
3618
+ 101.0,
3619
+ 101.0,
3620
+ 125.0,
3621
+ 141.747827,
3622
+ 150.0,
3623
+ 150.0,
3624
+ 150.0,
3625
+ 150.455434,
3626
+ 151.0,
3627
+ 151.0,
3628
+ 182.827667
3629
+ ],
3630
+ "median": 101.0,
3631
+ "p25": 76.0,
3632
+ "p75": 150.0
3633
+ },
3634
+ "wgs": {
3635
+ "percentiles": [
3636
+ 0,
3637
+ 5,
3638
+ 10,
3639
+ 15,
3640
+ 20,
3641
+ 25,
3642
+ 30,
3643
+ 35,
3644
+ 40,
3645
+ 45,
3646
+ 50,
3647
+ 55,
3648
+ 60,
3649
+ 65,
3650
+ 70,
3651
+ 75,
3652
+ 80,
3653
+ 85,
3654
+ 90,
3655
+ 95,
3656
+ 100
3657
+ ],
3658
+ "values": [
3659
+ 26.0,
3660
+ 47.564059,
3661
+ 52.979281,
3662
+ 68.600939,
3663
+ 77.0,
3664
+ 79.867451,
3665
+ 95.094289,
3666
+ 100.858166,
3667
+ 101.0,
3668
+ 128.3,
3669
+ 143.201843,
3670
+ 147.976035,
3671
+ 150.0,
3672
+ 150.0,
3673
+ 151.0,
3674
+ 151.0,
3675
+ 151.0,
3676
+ 151.0,
3677
+ 151.0,
3678
+ 151.0,
3679
+ 373.643005
3680
+ ],
3681
+ "median": 143.201843,
3682
+ "p25": 79.867451,
3683
+ "p75": 151.0
3684
+ }
3685
+ }
3686
+ }
app/models/seqtype_classifier.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a39236a1b6e0b80a596dc416216375b5c4001870eaa204c1581f9b0d82473ff
3
+ size 5414027
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ fastapi==0.115.0
2
+ uvicorn[standard]==0.30.6
3
+ python-multipart==0.0.9
4
+ joblib==1.4.2
5
+ scikit-learn==1.5.2
6
+ pandas==2.2.3
7
+ numpy==1.26.4
8
+ pydantic==2.9.2
static/index.html ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8"/>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
+ <title>SeqTypeAI — NGS Library Classifier</title>
7
+ <style>
8
+ :root{--bg:#fff;--bg2:#f7f7f5;--bg3:#f0efec;--text:#1a1a18;--text2:#5a5955;--text3:#9a9890;--border:rgba(0,0,0,0.12);--border2:rgba(0,0,0,0.2);--blue:#1D6FA4;--bluebg:#E6F1FB;--green:#1A7A4A;--greenbg:#EAF3DE;--amber:#854F0B;--amberbg:#FEF3C7;--red:#A32D2D;--redbg:#FCEBEB;--r:8px;--rl:12px}
9
+ *{box-sizing:border-box;margin:0;padding:0}
10
+ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:15px;line-height:1.6;color:var(--text);background:var(--bg3);min-height:100vh}
11
+ header{background:var(--bg);border-bottom:0.5px solid var(--border);padding:12px 24px;display:flex;align-items:center;gap:12px}
12
+ header h1{font-size:20px;font-weight:500;letter-spacing:-0.02em}
13
+ header small{font-size:12px;color:var(--text3);font-family:monospace}
14
+ header .lab-logo{height:32px;width:auto;display:block;opacity:0.85}
15
+ header .spacer{flex:1}
16
+ @media(max-width:600px){header .lab-logo{height:24px}}
17
+ main{max-width:1100px;margin:0 auto;padding:24px 16px}
18
+ .card{background:var(--bg);border:0.5px solid var(--border);border-radius:var(--rl);padding:20px}
19
+ .drop-zone{border:1.5px dashed var(--border2);border-radius:var(--rl);padding:48px 24px;text-align:center;cursor:pointer;transition:all .15s;background:var(--bg)}
20
+ .drop-zone:hover,.drop-zone.drag{border-color:var(--blue);background:var(--bluebg)}
21
+ .drop-zone h2{font-size:16px;font-weight:500;margin-bottom:6px}
22
+ .drop-zone p{font-size:13px;color:var(--text2)}
23
+ .badge{display:inline-block;font-size:11px;padding:2px 7px;border-radius:10px;font-weight:500}
24
+ .badge-good{background:var(--greenbg);color:var(--green)}
25
+ .badge-warn{background:var(--amberbg);color:var(--amber)}
26
+ .badge-poor{background:var(--redbg);color:var(--red)}
27
+ .top-label{font-size:22px;font-weight:500;letter-spacing:-0.01em;margin-bottom:4px}
28
+ .conf-big{font-size:36px;font-weight:500;font-family:monospace}
29
+ .bar-row{display:flex;align-items:center;gap:8px;padding:3px 0}
30
+ .bar-track{flex:1;height:5px;background:var(--bg3);border-radius:3px;overflow:hidden}
31
+ .bar-fill{height:100%;border-radius:3px}
32
+ .mono{font-family:monospace;font-size:12px}
33
+ .tabs{display:flex;border-bottom:0.5px solid var(--border);margin-bottom:16px;gap:0}
34
+ .tab{padding:8px 16px;font-size:13px;cursor:pointer;border-bottom:2px solid transparent;color:var(--text2);background:none;border-top:none;border-left:none;border-right:none;margin-bottom:-1px}
35
+ .tab.active{border-bottom-color:var(--text);color:var(--text);font-weight:500}
36
+ .tab-panel{display:none}.tab-panel.active{display:block}
37
+ .step{display:flex;gap:12px;margin-bottom:6px}
38
+ .step-num{width:24px;height:24px;border-radius:50%;background:var(--bg3);border:0.5px solid var(--border2);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:500;flex-shrink:0;color:var(--text2)}
39
+ .step-body{flex:1;padding-bottom:6px}
40
+ .step-name{font-size:13px;font-weight:500;display:flex;align-items:center;gap:6px;margin-bottom:3px}
41
+ .step-role{font-size:11px;background:var(--bg3);color:var(--text2);padding:1px 6px;border-radius:4px}
42
+ .cmd{font-size:11px;font-family:monospace;background:var(--bg2);padding:5px 8px;border-radius:4px;color:var(--text2);word-break:break-all;line-height:1.5}
43
+ .qc-row{padding:9px 11px;margin-bottom:7px;border-radius:6px;border:0.5px solid var(--border)}
44
+ .qc-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:3px}
45
+ .qc-bottom{display:flex;justify-content:space-between;gap:8px}
46
+ .frow{display:flex;justify-content:space-between;align-items:center;padding:4px 0;border-bottom:0.5px solid var(--border)}
47
+ .chat-bubble{max-width:88%;padding:8px 12px;border-radius:10px;font-size:13px;line-height:1.6;white-space:pre-wrap}
48
+ .chat-bubble.user{background:var(--bluebg);border-bottom-right-radius:3px;align-self:flex-end;margin-left:auto}
49
+ .chat-bubble.assistant{background:var(--bg2);border-bottom-left-radius:3px}
50
+ .chat-wrap{display:flex;flex-direction:column;gap:8px;min-height:280px;max-height:400px;overflow-y:auto;margin-bottom:12px}
51
+ .chat-input-row{display:flex;gap:8px;border-top:0.5px solid var(--border);padding-top:10px}
52
+ input[type=text]{flex:1;height:36px;border:0.5px solid var(--border2);border-radius:var(--r);padding:0 12px;font-size:13px;outline:none}
53
+ input[type=text]:focus{border-color:var(--blue)}
54
+ button{height:36px;padding:0 16px;border:0.5px solid var(--border2);border-radius:var(--r);background:var(--bg);font-size:13px;cursor:pointer}
55
+ button:hover{background:var(--bg2)}button:disabled{opacity:0.4;cursor:default}
56
+ .spinner{width:32px;height:32px;border:2px solid var(--border);border-top-color:var(--text);border-radius:50%;animation:spin .8s linear infinite;margin:0 auto}
57
+ @keyframes spin{to{transform:rotate(360deg)}}
58
+ .grid2{display:grid;grid-template-columns:minmax(0,280px) minmax(0,1fr);gap:14px;align-items:start}
59
+ .pill{font-size:11px;padding:3px 7px;border-radius:4px;background:var(--bg3);color:var(--text3);display:inline-block;margin:2px}
60
+ @media(max-width:720px){.grid2{grid-template-columns:1fr}}
61
+ .dot{width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:5px;flex-shrink:0}
62
+ </style>
63
+ </head>
64
+ <body>
65
+ <header>
66
+ <div>
67
+ <h1>SeqTypeAI</h1>
68
+ <small id="ver">NGS library classifier</small>
69
+ </div>
70
+ <div class="spacer"></div>
71
+ <a href="https://cusanovichlab.github.io" target="_blank" rel="noopener">
72
+ <img src="/static/logo.png" alt="Cusanovich Lab" class="lab-logo"/>
73
+ </a>
74
+ </header>
75
+ <main>
76
+ <div id="upload-view">
77
+ <div class="card" style="max-width:560px;margin:40px auto">
78
+ <div class="drop-zone" id="drop" onclick="document.getElementById('fi').click()">
79
+ <svg width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" style="color:#aaa;margin-bottom:10px"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
80
+ <h2>Drop a FASTQ file here</h2>
81
+ <p style="margin-top:4px">.fastq and .fastq.gz supported · up to 200 MB · first 50,000 reads analyzed</p>
82
+ <input type="file" id="fi" accept=".fastq,.fq,.fastq.gz,.fq.gz" style="display:none" onchange="handleFile(this.files[0])"/>
83
+ </div>
84
+ <div id="err" style="display:none;margin-top:12px;padding:9px 12px;border-radius:8px;background:var(--redbg);color:var(--red);font-size:13px"></div>
85
+ <div style="margin-top:16px;display:flex;flex-wrap:wrap">
86
+ <span class="pill">16S Amplicon</span><span class="pill">ATAC-seq</span><span class="pill">Bisulfite-seq</span>
87
+ <span class="pill">ChIP-seq</span><span class="pill">CUT&RUN</span><span class="pill">CUT&Tag</span>
88
+ <span class="pill">RNA-seq</span><span class="pill">scATAC-seq</span><span class="pill">scRNA-seq</span>
89
+ <span class="pill">Spatial</span><span class="pill">WES</span><span class="pill">WGS</span>
90
+ </div>
91
+ </div>
92
+ </div>
93
+
94
+ <div id="loading-view" style="display:none;text-align:center;padding:80px 0">
95
+ <div class="spinner" style="margin-bottom:16px"></div>
96
+ <p id="load-msg" style="font-size:14px;font-weight:500">Uploading file…</p>
97
+ <p id="load-file" style="font-size:12px;color:var(--text3);font-family:monospace;margin-top:4px"></p>
98
+ </div>
99
+
100
+ <div id="result-view" style="display:none">
101
+ <div class="grid2">
102
+ <div style="display:flex;flex-direction:column;gap:10px">
103
+ <div class="card" id="top-card"></div>
104
+ <div class="card" id="pred-card"></div>
105
+ <div class="card" id="feat-card"></div>
106
+ <button onclick="reset()" style="font-size:13px">Classify another file</button>
107
+ </div>
108
+ <div class="card" style="display:flex;flex-direction:column">
109
+ <div class="tabs">
110
+ <button class="tab active" onclick="switchTab('quality')">Quality assessment</button>
111
+ <button class="tab" onclick="switchTab('pipeline')">Processing pipeline</button>
112
+ <button class="tab" onclick="switchTab('chat')">Discuss results</button>
113
+ </div>
114
+ <div id="tab-quality" class="tab-panel active" id="tab-quality"></div>
115
+ <div id="tab-pipeline" class="tab-panel"></div>
116
+ <div id="tab-chat" class="tab-panel" style="display:flex;flex-direction:column;flex:1"></div>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </main>
121
+
122
+ <script>
123
+ const COLORS={amplicon_16s:"#D85A30",atac_seq:"#1D9E75",bisulfite:"#3B6D11",chip_seq:"#534AB7",cut_and_run:"#EF9F27",cut_and_tag:"#378ADD",rna_seq:"#97C459",sc_atac_seq:"#D4537E",sc_rna_seq:"#7F77DD",spatial:"#BA7517",wes:"#185FA5",wgs:"#5F5E5A"};
124
+ const LABELS={amplicon_16s:"16S Amplicon",atac_seq:"Bulk ATAC-seq",bisulfite:"Bisulfite-seq (WGBS)",chip_seq:"ChIP-seq",cut_and_run:"CUT&RUN",cut_and_tag:"CUT&Tag",rna_seq:"RNA-seq",sc_atac_seq:"scATAC-seq",sc_rna_seq:"scRNA-seq",spatial:"Spatial transcriptomics",wes:"Whole exome seq",wgs:"Whole genome seq"};
125
+
126
+ const PIPELINES={
127
+ atac_seq:{summary:"Maps open chromatin using Tn5 transposase. Align paired-end reads, remove duplicates and mitochondrial reads, then call peaks in nucleosome-free regions.",tools:[{n:"FastQC",r:"QC",c:"fastqc *.fastq.gz -o qc/"},{n:"Trimmomatic",r:"Adapter trim",c:"trimmomatic PE R1.fq.gz R2.fq.gz ... ILLUMINACLIP:NexteraPE-PE.fa:2:30:10 MINLEN:38"},{n:"Bowtie2",r:"Align",c:"bowtie2 --very-sensitive -X 2000 -x genome -1 R1 -2 R2 | samtools sort -o aligned.bam"},{n:"Picard + samtools",r:"Deduplicate & filter",c:"MarkDuplicates REMOVE_DUPLICATES=true && samtools view -F 1804 -f 2 -q 30"},{n:"MACS2",r:"Peak calling",c:"macs2 callpeak -f BAMPE -t dedup.bam --nomodel --shift -100 --extsize 200 -g hs"},{n:"deepTools",r:"QC & tracks",c:"plotFingerprint && bamCoverage --normalizeUsing RPKM"}],notes:"Apply +4/−5 bp Tn5 offset correction. Remove ENCODE blacklist regions."},
128
+ sc_atac_seq:{summary:"Profiles open chromatin in individual cells. R1 carries the cell barcode and UMI. Cell Ranger ATAC handles demultiplexing; ArchR or Signac for downstream analysis.",tools:[{n:"Cell Ranger ATAC",r:"Align + demux",c:"cellranger-atac count --id=sample --reference=refdata --fastqs=fastq_dir"},{n:"ArchR",r:"Arrow files",c:"createArrowFiles(inputFiles, minTSS=4, minFrags=1000)"},{n:"ArchR",r:"Dim reduction",c:"addIterativeLSI() → addClusters() → addUMAP()"},{n:"ArchR",r:"Peak calling",c:"addGroupCoverages() → addReproduciblePeakSet() → addPeakMatrix()"},{n:"chromVAR",r:"TF activity",c:"addDeviationsMatrix(peakAnnotation='Motif')"}],notes:"TSS enrichment > 4 is a good library benchmark."},
129
+ chip_seq:{summary:"Profiles protein–DNA interactions by immunoprecipitation. Requires matched input or IgG controls.",tools:[{n:"FastQC",r:"QC",c:"fastqc *.fastq.gz"},{n:"BWA-MEM2",r:"Align",c:"bwa-mem2 mem -t 16 genome.fa trimmed.fq.gz | samtools sort -o aligned.bam"},{n:"Picard + samtools",r:"Deduplicate",c:"MarkDuplicates REMOVE_DUPLICATES=true"},{n:"MACS2",r:"Peak calling",c:"macs2 callpeak -t chip.bam -c input.bam -n sample -g hs -q 0.01"},{n:"deepTools",r:"QC & tracks",c:"plotFingerprint -b chip.bam input.bam"}],notes:"Input control is mandatory. Narrow peaks (TFs): --nomodel. Broad marks: --broad."},
130
+ cut_and_run:{summary:"Protein A–MNase cleaves DNA adjacent to antibody-bound targets. Very low background compared with ChIP-seq.",tools:[{n:"Trimmomatic",r:"Adapter trim",c:"trimmomatic PE ... ILLUMINACLIP:adapters.fa:2:30:10 MINLEN:25"},{n:"Bowtie2",r:"Align",c:"bowtie2 --end-to-end --very-sensitive --no-mixed --no-discordant -I 10 -X 700"},{n:"SEACR",r:"Peak calling",c:"SEACR.sh sample.bedgraph IgG.bedgraph non stringent output"},{n:"deepTools",r:"Fragment QC",c:"bamPEFragmentSize"}],notes:"E. coli spike-in calibration recommended. nf-core/cutandrun pipeline available."},
131
+ cut_and_tag:{summary:"Uses pA-Tn5 transposase, enabling single-cell compatibility. Analysis mirrors CUT&RUN.",tools:[{n:"Trimmomatic",r:"Adapter trim",c:"trimmomatic PE ... ILLUMINACLIP:NexteraPE-PE.fa:2:30:10 MINLEN:25"},{n:"Bowtie2",r:"Align",c:"bowtie2 --end-to-end --very-sensitive --no-mixed --no-discordant -I 10 -X 700"},{n:"MACS2 or SEACR",r:"Peak calling",c:"macs2 callpeak -f BAMPE -t cut_tag.bam --nomodel"}],notes:"Apply +4/−5 bp Tn5 offset as in ATAC-seq."},
132
+ bisulfite:{summary:"Maps DNA methylation at single-base resolution. Good conversion: < 5% unconverted cytosines.",tools:[{n:"Trim Galore",r:"Bisulfite-aware trim",c:"trim_galore --paired --cores 4 --clip_r1 10 --clip_r2 10 R1.fq.gz R2.fq.gz"},{n:"Bismark",r:"Align",c:"bismark --genome genome/ -1 R1_trimmed.fq.gz -2 R2_trimmed.fq.gz"},{n:"Bismark",r:"Dedup + extract",c:"deduplicate_bismark aligned.bam && bismark_methylation_extractor --paired-end --CX"},{n:"DSS",r:"Differential methylation",c:"callDML() → callDMR()"}],notes:"Verify conversion efficiency via lambda spike-in. Target 10–15× coverage."},
133
+ rna_seq:{summary:"Quantifies gene expression transcriptome-wide. nf-core/rnaseq provides a standardized workflow.",tools:[{n:"FastQC + MultiQC",r:"QC",c:"fastqc *.fastq.gz && multiqc ."},{n:"STAR",r:"Align",c:"STAR --genomeDir star_index/ --readFilesIn R1.fq.gz R2.fq.gz --readFilesCommand zcat --outSAMtype BAM SortedByCoordinate"},{n:"featureCounts",r:"Count",c:"featureCounts -a annotation.gtf -o counts.txt aligned.bam"},{n:"DESeq2",r:"Differential expression",c:"DESeqDataSetFromMatrix() → DESeq() → results()"}],notes:"Check strandedness with RSeQC infer_experiment.py."},
134
+ sc_rna_seq:{summary:"Profiles gene expression in individual cells. R1 = barcode + UMI, R2 = cDNA insert.",tools:[{n:"Cell Ranger",r:"Align + demux",c:"cellranger count --id=sample --transcriptome=refdata-gex-GRCh38 --fastqs=fastq_dir"},{n:"Seurat / Scanpy",r:"QC filter",c:"subset(nFeature_RNA > 200 & percent.mt < 20)"},{n:"Seurat / Scanpy",r:"Normalize",c:"NormalizeData() → FindVariableFeatures() → ScaleData()"},{n:"Seurat / Scanpy",r:"Cluster",c:"RunPCA() → RunUMAP(dims=1:30) → FindClusters()"}],notes:"Use SoupX or DecontX for ambient RNA correction."},
135
+ spatial:{summary:"Adds spatial coordinates to gene expression. Space Ranger maps barcodes to tissue spots.",tools:[{n:"Space Ranger",r:"Align + spatial map",c:"spaceranger count --id=sample --transcriptome=refdata-gex-GRCh38 --fastqs=fastq_dir --image=tissue.tif"},{n:"Seurat",r:"Normalize",c:"Load10X_Spatial('spaceranger_out/') → SCTransform()"},{n:"Seurat",r:"Spatial variable genes",c:"FindSpatiallyVariableFeatures(selection.method='moransi')"},{n:"RCTD",r:"Deconvolution",c:"create.RCTD() → run.RCTD()"}],notes:"Visium: 6.5 mm² area, ~5000 spots at 55 µm."},
136
+ wgs:{summary:"Uniform coverage across the genome. Follow GATK Best Practices for variant calling.",tools:[{n:"BWA-MEM2",r:"Align",c:"bwa-mem2 mem -t 32 genome.fa R1.fq.gz R2.fq.gz | samtools sort"},{n:"GATK MarkDuplicates",r:"Dedup",c:"gatk MarkDuplicates -I aligned.bam -O dedup.bam"},{n:"GATK BQSR",r:"Recalibrate",c:"gatk BaseRecalibrator && gatk ApplyBQSR"},{n:"GATK HaplotypeCaller",r:"Variant calling",c:"gatk HaplotypeCaller -R genome.fa -I recal.bam -O sample.g.vcf.gz -ERC GVCF"}],notes:"Target 30× germline, 60–100× somatic. nf-core/sarek recommended."},
137
+ wes:{summary:"Targets protein-coding regions using capture probes. Same GATK pipeline as WGS but restrict to capture intervals.",tools:[{n:"Trimmomatic",r:"Adapter trim",c:"trimmomatic PE R1.fq.gz R2.fq.gz ... ILLUMINACLIP:TruSeq3-PE.fa:2:30:10 MINLEN:36"},{n:"BWA-MEM2",r:"Align",c:"bwa-mem2 mem -t 16 genome.fa R1.fq.gz R2.fq.gz | samtools sort"},{n:"GATK HaplotypeCaller",r:"Variant calling",c:"gatk HaplotypeCaller -I recal.bam -O sample.g.vcf.gz -ERC GVCF -L capture_targets.bed"},{n:"GATK VQSR",r:"Filter",c:"VariantRecalibrator → ApplyVQSR"}],notes:"Use -L target_intervals.bed with +100 bp padding. Target ≥ 100× mean coverage."},
138
+ amplicon_16s:{summary:"Profiles microbial communities via 16S rRNA amplification. DADA2 is standard for exact ASV calling.",tools:[{n:"Cutadapt",r:"Primer removal",c:"cutadapt -g GTGYCAGCMGCCGCGGTAA -a ATTAGAWACCCBNGTAGTCC --discard-untrimmed"},{n:"DADA2",r:"Filter + denoise",c:"filterAndTrim() → learnErrors() → dada() → mergePairs()"},{n:"DADA2",r:"ASV table",c:"makeSequenceTable() → removeBimeraDenovo()"},{n:"phyloseq",r:"Diversity analysis",c:"estimate_richness() → ordinate() → plot_ordination()"}],notes:"Include positive (mock community) and negative (extraction blank) controls."},
139
+ };
140
+
141
+ let CTX=null;let chatHistory=[];
142
+
143
+ function showErr(msg){const e=document.getElementById('err');e.textContent=msg;e.style.display='block';}
144
+ function reset(){document.getElementById('upload-view').style.display='';document.getElementById('result-view').style.display='none';CTX=null;chatHistory=[];document.getElementById('err').style.display='none';}
145
+
146
+ const drop=document.getElementById('drop');
147
+ drop.addEventListener('dragover',e=>{e.preventDefault();drop.classList.add('drag');});
148
+ drop.addEventListener('dragleave',()=>drop.classList.remove('drag'));
149
+ drop.addEventListener('drop',e=>{e.preventDefault();drop.classList.remove('drag');if(e.dataTransfer.files[0])handleFile(e.dataTransfer.files[0]);});
150
+
151
+ async function handleFile(file){
152
+ if(!file)return;
153
+ if(!/\.(fastq|fq)(\.gz)?$/i.test(file.name)){showErr('Please upload a .fastq or .fastq.gz file');return;}
154
+ document.getElementById('upload-view').style.display='none';
155
+ document.getElementById('loading-view').style.display='';
156
+ document.getElementById('load-file').textContent=file.name;
157
+ document.getElementById('load-msg').textContent='Uploading and analyzing file…';
158
+ const fd=new FormData();fd.append('file',file);
159
+ try{
160
+ const r=await fetch('/classify',{method:'POST',body:fd});
161
+ if(!r.ok){const e=await r.json();throw new Error(e.detail||'Server error');}
162
+ const data=await r.json();
163
+ document.getElementById('loading-view').style.display='none';
164
+ renderResults(data);
165
+ }catch(e){document.getElementById('loading-view').style.display='none';document.getElementById('upload-view').style.display='';showErr(e.message);}
166
+ }
167
+
168
+ function renderResults(data){
169
+ const top=data.predictions[0];
170
+ CTX=data;
171
+ const col=COLORS[top.assay]||'#888';
172
+ const qcBg={good:'var(--greenbg)',warn:'var(--amberbg)',poor:'var(--redbg)'};
173
+ const qcCol={good:'var(--green)',warn:'var(--amber)',poor:'var(--red)'};
174
+
175
+ document.getElementById('top-card').innerHTML=`
176
+ <div style="display:flex;align-items:center;gap:7px;margin-bottom:10px">
177
+ <span class="dot" style="background:${col}"></span>
178
+ <span style="font-size:10px;color:var(--text3);text-transform:uppercase;letter-spacing:.1em">Top prediction</span>
179
+ </div>
180
+ <div class="top-label">${LABELS[top.assay]||top.assay}</div>
181
+ <div class="conf-big" style="color:${col}">${(top.confidence*100).toFixed(0)}%</div>
182
+ <p style="font-size:12px;color:var(--text2);margin-top:8px;line-height:1.55">${data.reasoning}</p>
183
+ <div style="font-size:10px;font-family:monospace;color:var(--text3);margin-top:10px;padding-top:8px;border-top:.5px solid var(--border);word-break:break-all">${data.filename}</div>
184
+ `;
185
+
186
+ document.getElementById('pred-card').innerHTML=`
187
+ <div style="font-size:10px;color:var(--text3);text-transform:uppercase;letter-spacing:.1em;margin-bottom:9px">All predictions</div>
188
+ ${data.predictions.map((p,i)=>`
189
+ <div class="bar-row" style="opacity:${p.confidence<0.005?0.35:1}">
190
+ <div style="width:72px;font-size:11px;font-family:monospace;color:${i===0?'var(--text)':'var(--text2)'};font-weight:${i===0?500:400};overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0">${(LABELS[p.assay]||p.assay).replace('Whole ','').replace(' seq','').replace('(WGBS)','').replace('transcriptomics','transcr.')}</div>
191
+ <div class="bar-track"><div class="bar-fill" style="width:${Math.max(p.confidence*100,.3)}%;background:${COLORS[p.assay]||'#888'}"></div></div>
192
+ <div style="width:32px;text-align:right;font-size:11px;font-family:monospace;color:${i===0?'var(--text)':'var(--text2)'};font-weight:${i===0?500:400};flex-shrink:0">${(p.confidence*100).toFixed(0)}%</div>
193
+ </div>`).join('')}
194
+ `;
195
+
196
+ const feats=data.features;
197
+ document.getElementById('feat-card').innerHTML=`
198
+ <div style="font-size:10px;color:var(--text3);text-transform:uppercase;letter-spacing:.1em;margin-bottom:9px">Extracted features</div>
199
+ ${[
200
+ ['Read length (mean)',`${feats.rl_mean.toFixed(1)} bp`],
201
+ ['Read length (std)',`±${feats.rl_std.toFixed(1)} bp`],
202
+ ['GC content',`${(feats.gc_mean*100).toFixed(1)}%`],
203
+ ['Raw C fraction',`${(feats.c_fraction*100).toFixed(1)}%`],
204
+ ['Shannon entropy',feats.entropy_mean.toFixed(3)],
205
+ ['Tn5/MNase AT bias',`${(feats.tn5_start_approx*100).toFixed(1)}%`],
206
+ ['Poly-A signal',`${(feats.polya_signal*100).toFixed(1)}%`],
207
+ ['Repeat k-mer',`${(feats.repeat_kmer_frac*100).toFixed(1)}%`],
208
+ ['GC < 30% reads',`${(feats.gc_tail_low*100).toFixed(1)}%`],
209
+ ['Reads analyzed',feats.n_reads.toLocaleString()],
210
+ ].map(([l,v])=>`<div class="frow"><span style="font-size:12px;color:var(--text2)">${l}</span><span class="mono" style="font-weight:500">${v}</span></div>`).join('')}
211
+ `;
212
+
213
+ // QC tab
214
+ const qcOverall=data.qc_overall||'good';
215
+ const qcLabel={good:'Good quality',warn:'Acceptable — review flagged metrics',poor:'Poor quality — inspect library preparation'};
216
+ document.getElementById('tab-quality').innerHTML=`
217
+ <div style="padding:9px 12px;border-radius:8px;background:${qcBg[qcOverall]};margin-bottom:14px;display:flex;align-items:center;gap:6px">
218
+ <span class="dot" style="background:${qcCol[qcOverall]}"></span>
219
+ <span style="font-size:13px;font-weight:500;color:${qcCol[qcOverall]}">${qcLabel[qcOverall]}</span>
220
+ </div>
221
+ ${(data.qc_checks||[]).map(c=>`
222
+ <div class="qc-row">
223
+ <div class="qc-top"><span style="font-size:13px;font-weight:500">${c.label}</span><span class="badge badge-${c.status}">${c.status==='good'?'Pass':c.status==='warn'?'Marginal':'Fail'}</span></div>
224
+ <div class="qc-bottom"><span style="font-size:12px;color:var(--text2);line-height:1.4">${c.desc}</span><span class="mono" style="color:var(--text3);flex-shrink:0">${c.key==='is_barcode_length'?(c.value===1?'yes':'no'):(c.value*100).toFixed(1)+'%'}</span></div>
225
+ </div>`).join('')}
226
+ <p style="font-size:12px;color:var(--text3);border-top:.5px solid var(--border);padding-top:10px;line-height:1.5">QC metrics are computed from the first 50,000 reads. For comprehensive QC, use FastQC and assay-specific tools.</p>
227
+ `;
228
+
229
+ // Pipeline tab
230
+ const pipe=PIPELINES[top.assay];
231
+ if(pipe){
232
+ document.getElementById('tab-pipeline').innerHTML=`
233
+ <p style="font-size:13px;color:var(--text2);margin-bottom:16px;line-height:1.6">${pipe.summary}</p>
234
+ ${pipe.tools.map((step,i)=>`
235
+ <div class="step">
236
+ <div><div class="step-num">${i+1}</div>${i<pipe.tools.length-1?`<div style="width:.5px;height:calc(100% - 24px);background:var(--border);margin:2px auto 0;width:1px"></div>`:''}</div>
237
+ <div class="step-body">
238
+ <div class="step-name">${step.n}<span class="step-role">${step.r}</span></div>
239
+ <div class="cmd">${step.c}</div>
240
+ </div>
241
+ </div>`).join('')}
242
+ ${pipe.notes?`<div style="padding:9px 11px;border-radius:6px;background:var(--bluebg);border:.5px solid rgba(29,111,164,.3);margin-top:4px"><p style="font-size:12px;color:#185FA5;margin:0;line-height:1.6">${pipe.notes}</p></div>`:''}
243
+ `;
244
+ }
245
+
246
+ // Chat tab
247
+ chatHistory=[{role:'assistant',content:`I've classified **${data.filename}** as **${LABELS[top.assay]||top.assay}** with ${(top.confidence*100).toFixed(0)}% confidence.\n\n${data.reasoning}\n\nAsk me anything about the result, quality, or how to process this library.`}];
248
+ renderChatHistory();
249
+
250
+ document.getElementById('result-view').style.display='';
251
+ }
252
+
253
+ function renderChatHistory(){
254
+ const wrap=document.getElementById('chat-messages');
255
+ if(!wrap)return;
256
+ wrap.innerHTML=chatHistory.map(m=>`<div class="chat-bubble ${m.role}">${m.content}</div>`).join('');
257
+ wrap.scrollTop=wrap.scrollHeight;
258
+ document.getElementById('tab-chat').innerHTML=`
259
+ <div class="chat-wrap" id="chat-messages">${chatHistory.map(m=>`<div class="chat-bubble ${m.role}">${m.content}</div>`).join('')}</div>
260
+ <div class="chat-input-row">
261
+ <input type="text" id="chat-in" placeholder="Ask about the results, quality, or next steps…" onkeydown="if(event.key==='Enter')sendChat()"/>
262
+ <button onclick="sendChat()" id="chat-btn">Send</button>
263
+ </div>
264
+ `;
265
+ const cw=document.getElementById('chat-messages');if(cw)cw.scrollTop=cw.scrollHeight;
266
+ }
267
+
268
+ async function sendChat(){
269
+ const inp=document.getElementById('chat-in');
270
+ const text=inp?.value.trim();
271
+ if(!text||!CTX)return;
272
+ inp.value='';
273
+ const btn=document.getElementById('chat-btn');if(btn)btn.disabled=true;
274
+ chatHistory.push({role:'user',content:text});
275
+ renderChatHistory();
276
+ try{
277
+ const top=CTX.predictions[0];
278
+ const sys=`You are SeqTypeAI Assistant. Classification context: File: ${CTX.filename}. Predicted: ${LABELS[top.assay]||top.assay} (${(top.confidence*100).toFixed(0)}% confidence). Quality: ${CTX.qc_overall}. Read length: ${CTX.features.rl_mean.toFixed(1)} bp, GC: ${(CTX.features.gc_mean*100).toFixed(1)}%, entropy: ${CTX.features.entropy_mean.toFixed(3)}. Reasoning: ${CTX.reasoning}. Be concise and practical.`;
279
+ const r=await fetch('https://api.anthropic.com/v1/messages',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({model:'claude-sonnet-4-20250514',max_tokens:800,system:sys,messages:chatHistory.map(m=>({role:m.role,content:m.content}))})});
280
+ const data=await r.json();
281
+ chatHistory.push({role:'assistant',content:data.content[0].text});
282
+ }catch{chatHistory.push({role:'assistant',content:'Sorry, I encountered an error. Please try again.'});}
283
+ renderChatHistory();
284
+ if(btn)btn.disabled=false;
285
+ }
286
+
287
+ function switchTab(id){
288
+ document.querySelectorAll('.tab').forEach(t=>t.classList.remove('active'));
289
+ document.querySelectorAll('.tab-panel').forEach(p=>p.classList.remove('active'));
290
+ event.target.classList.add('active');
291
+ document.getElementById('tab-'+id).classList.add('active');
292
+ }
293
+
294
+ fetch('/health').then(r=>r.json()).then(d=>{
295
+ const v=document.getElementById('ver');
296
+ if(v)v.textContent=`NGS library classifier · model v${d.model_version} · ${d.n_classes} classes · ${d.n_features} features`;
297
+ }).catch(()=>{});
298
+ </script>
299
+ </body>
300
+ </html>
static/logo.png ADDED