Expanding support for python modules - #18
Conversation
|
Every immLynx wrapper now accepts a This also fixes two CI failures in the symdel and basilisk spec tests. Why the change was smallTwo things were already in place.
Only the input guards and the write-back paths were actually broken. New shared accessors in
|
| Helper | Purpose |
|---|---|
.isSCObject() |
TRUE for SingleCellExperiment or Seurat |
.assertSCObject() |
Shared guard, names both accepted classes in the error |
.writeCellColumn() |
Per-cell column to colData or meta.data |
.writeReduction() |
Reduction to reducedDim or a DimReduc |
.writeObjMetadata() |
Summary to metadata() or @misc |
.writeReduction() is the only genuinely new logic. Seurat validates reduction keys, requiring them to start with a letter, contain only alphanumerics, and end in an underscore. The helper sanitizes the key rather than letting CreateDimReducObject() throw on something like tcr_esm.
Changes per function
Seven guards replaced with .assertSCObject(): runClustTCR, runOLGA, runEmbeddings, runTCRdist, runSoNNia, runSymdelNeighbors, runDeepTCR.
runMetaclonotypist had a subtler bug. It tested is(input, "SingleCellExperiment") and fell through to a data.frame branch otherwise, so a Seurat object failed with a misleading Input data.frame must contain 'barcode' and 'cdr3_aa' columns. It now uses .isSCObject().
Four write-back sites assumed SingleCellExperiment:
runEmbeddingswrotereducedDim()andcolData()directlyrunDeepTCRwrotereducedDim()directlyrunSymdelNeighborswrotecolData()directlyrunTCRdistwroteS4Vectors::metadata()directly, and now reports the correct location per class (metadata(obj)$tcrdistorobj@misc$tcrdist)
One behavior change to be aware of
runClustTCR and runOLGA already branched on class internally, but their local .add_metadata helpers left names on the vector stored in colData while the Seurat path did not. A parity test caught the mismatch. Both now delegate to the shared writer, so columns from those two functions no longer carry names. Values are unchanged.
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Summary
Adds three Python tool integrations to immLynx and fixes a basilisk environment bug that was silently dropping a version constraint.
runScXpand()andlistScXpandModels()for clonal expansion prediction from gene expressionrunSymdelNeighbors()for near-neighbor CDR3 search (closes Build XT-neighbor Support #6)runDeepTCR()for unsupervised VAE featurization (closes DeepTCR Integration - Dependency Conflict #8)anndata>=0.8being mangled by an unquoted shell inscanpyExportEnvCloses #6 without a GPU dependency
XT-neighbor is CUDA C++, not a Python package. It requires an NVIDIA GPU and CUDA 11.0+ on Linux, has no PyPI release, and must be compiled with
nvcc. Bioconductor builders have no NVIDIA GPUs, so it cannot be built or tested there.Two things settle the direction. The upstream readme redirects users to SymScan for actual use. And the underlying algorithm, symmetric deletion lookup, already ships inside
pyrepseq, which immLynx already installs. Same research group authored both.runSymdelNeighbors()wrapspyrepseq.nn.symdelin the existingimmLynxEnv. No new environment, no new dependency. Measured single core:It searches over unique sequences and maps results back to cells.
return_object = FALSEreturns a neighbor edge list,TRUEadds a per-cellsymdel_degreecolumn tocolData.Closes #8, the blocker was resolved upstream
Issue #8 describes DeepTCR 2.1.1. Upstream is now 2.1.29 and every pin the issue names has moved:
numpy==1.18.0numpy==1.23.5matplotlib==3.3.3matplotlib==3.7.2h5py==2.10.0h5py==3.8.0llvmlite==0.36.0,numba==0.53.1numba>=0.60.0The reported
NameError: name 'CCompiler' is not definedcame from numpy 1.18.0 failing against modern setuptools. That cause is gone.runDeepTCR()trainsDeepTCR_Uon unique sequences and writes features to a dimensional reduction, mirroringrunEmbeddings(). DeepTCR'sLoad_Datadoes not merge identical amino acid sequences, so training on unique sequences avoids weighting the loss toward expanded clones.Environment notes
The obvious
python=3.11pluspip = c("DeepTCR==2.1.29")does not work. Three failures surfaced while building it, each fixed and re-verified by training a real VAE:biopython==1.76, which ships no wheel past cp38 and none for macOS arm64, so it compiles from source. Its C extension assigns toPy_TYPE(), which CPython 3.11 made a hard error.tensorflow-metal==0.8.0, built against TF 2.11. Under TF 2.12 the process dies withAbort trap: 6andplatform is already registered with name: "METAL". Sourcing TensorFlow from conda-forge avoids the plugin.Bio.Alphabet. DeepTCR still imports it, so biopython stays on pip.--no-depsapplies to the whole pip step since conda satisfies every dependency. It also keeps DeepTCR's jupyterlab and notebook requirements out of the environment, which it declares but never imports.Fixes a silent version-constraint drop
scanpyExportEnvdeclaredanndata>=0.8.basilisk::setupBasiliskEnv()passes thepipvector tosystem2(), which pastes arguments into one string and runs it through/bin/shwithout quoting. The shell parsedanndata>=0.8as the wordanndata, a>redirect, and the target=0.8:Two failures at once. The version floor was silently dropped, and pip's stdout was written to a file named
=0.8in the working directory. Now pinned toanndata==0.11.4, the version pip already resolved to.tests/testthat/test-zz-basilisk-specs.Rguards against recurrence. It enumeratesBasiliskEnvironmentobjects from the namespace by class, so new environments are covered automatically.pipspecs must contain no shell metacharacter. conda specs get a looser rule that permits version bounds likepytorch-cpu>=2.5, since reticulate quotes those arguments, but rejects whitespace and command characters.Warning cleanup
Seurat::as.SingleCellExperiment()warns once per empty layer when converting a counts-only object..coerceToSCE()now muffles only messages matching^Layer '.*' is emptyand lets everything else through.Testing
devtools::test(): 0 failures, 0 warningsR CMD check: 0 errors, 0 warningsBiocCheck: 0 errors, 0 warningsspelling::spell_check_package(): cleanRemaining
R CMD checknotes areNon-staged installation, whichStagedInstall: norequires for basilisk, and a.gitnote that only appears when checking a worktree source directory.Both vignettes updated. The symdel section executes at build time. The DeepTCR section is
eval=FALSEwith the reason stated, since building a TensorFlow environment during a Bioconductor vignette build would be hostile.