orphan |
---|
true |
This repository hosts all tutorials for pertpy. They are automatically run on pull requests against pertpy.
Please refer to the pertpy documentation for rendered versions.
License: Apache License 2.0
Since the full CINEMA-OT dataset (containing all three stimulations) is now available via a dataloader (or will be as soon as the PR is merged), I would suggest adding a section on synergy
in the tutorial. The example provided in the documentation demonstrates the general usage but doesn't illustrate how to downstream process the result of the synergy method.
The following code can be used for the tutorial:
adata = pt.dt.cinemaot_full()
sc.pp.pca(adata)
model = pt.tl.Cinemaot()
combo = model.synergy(adata,pert_key='perturbation',base='No stimulation',A='IFNb',B='IFNg',AB='IFNb+ IFNg',thres=0.5,smoothness=1e-5,eps=1e-3,solver='Sinkhorn')
sc.pp.pca(combo)
sc.pp.neighbors(combo)
sc.tl.umap(combo)
synergyscore = np.linalg.norm(combo.X[:,np.abs(np.mean(combo.X,axis=0))>0.15],axis=1)
sc.pl.umap(combo,color=['cell_type0528'],wspace=0.5,size=0.3*synergyscore**2)
Hello pertpy developer,
Thank you for developing this great package and its associated tutorials scgen_perturbation_prediction.ipynb
. I run the model.train
but meet the following errors. Do you know how to address them? Look forward to learning from your insights. Many thanks in advance!
model.train(max_epochs=100, batch_size=32, early_stopping=True, early_stopping_patience=25)
Traceback (most recent call last):
File "", line 1, in
File "/Users/soopo/.pyenv/versions/3.9.10/lib/python3.9/site-packages/scvi/model/base/_training_mixin.py", line 78, in train
runner = self._train_runner_cls(
File "/Users/soopo/.pyenv/versions/3.9.10/lib/python3.9/site-packages/scvi/train/_trainrunner.py", line 85, in init
self.trainer = self._trainer_cls(
File "/Users/soopo/.pyenv/versions/3.9.10/lib/python3.9/site-packages/scvi/train/_trainer.py", line 139, in init
super().init(
File "/Users/soopo/.pyenv/versions/3.9.10/lib/python3.9/site-packages/lightning/pytorch/utilities/argparse.py", line 70, in insert_env_defaults
return fn(self, **kwargs)
File "/Users/soopo/.pyenv/versions/3.9.10/lib/python3.9/site-packages/lightning/pytorch/trainer/trainer.py", line 399, in init
self._accelerator_connector = _AcceleratorConnector(
File "/Users/soopo/.pyenv/versions/3.9.10/lib/python3.9/site-packages/lightning/pytorch/trainer/connectors/accelerator_connector.py", line 157, in init
self._set_parallel_devices_and_init_accelerator()
File "/Users/soopo/.pyenv/versions/3.9.10/lib/python3.9/site-packages/lightning/pytorch/trainer/connectors/accelerator_connector.py", line 390, in _set_parallel_devices_and_init_accelerator
self._devices_flag = accelerator_cls.parse_devices(self._devices_flag)
File "/Users/soopo/.pyenv/versions/3.9.10/lib/python3.9/site-packages/lightning/pytorch/accelerators/cpu.py", line 48, in parse_devices
return _parse_cpu_cores(devices)
File "/Users/soopo/.pyenv/versions/3.9.10/lib/python3.9/site-packages/lightning/fabric/accelerators/cpu.py", line 85, in _parse_cpu_cores
raise TypeError("devices
selected with CPUAccelerator
should be an int > 0.")
TypeError: devices
selected with CPUAccelerator
should be an int > 0.
Tutorial on expression prediction evaluation
https://github.com/theislab/pertpy/blob/hackathon-metrics/pertpy/expression_prediction_evaluation.ipynb
Comments from Lukas:
It defaults to the value that we're changing in the notebook
In it's current version, the Distance metrics tutorial throws several errors. Most of them can be easily fixed by implementing the following things:
verbose
as a parameter from pairwise
method whenever it's used in the tutorialobsm_key
parameter when initializing a Distance object (obsm_key='X_pca'
)pseudobulk
was renamed and is now called euclidean
?All those things are easily fixed, I just need conformation on the distance that is supposed to be used in the Pseudobulk section.
Since my data had four timepoints-treated conditions, I tried to use 'random_forest_regressor ' estimator which was described for continuous data in the tutorial:
augur = pt.tl.Augur("random_forest_regressor")
treat_augur=augur.load(treat,label_col='group',cell_type_col='celltype')
treat_augur, treat_augur_results = augur.predict(treat_augur, random_state=None, n_threads=4)
However, I got an error in the predicting step:
AttributeError: RandomForestRegressor has none of the following attributes: predict_proba.
What should I do?
First, the summary shows an overview over the model properties: * Number of samples/cell types * The reference cell type. * The formula used
Currently on pertpy version 0.6.0.
train.obs["condition"]
raises KeyError: 'condition'
. You actually want train.obs["label"] == "stim")
RuntimeError: Backend 'cuda' failed to initialize: module 'jaxlib.xla_extension' has no attribute 'GpuAllocatorConfig'. Available backends are ['cpu']
accelerator='cpu'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.