Package: dyspyosis
DyspyosisPython package that can be used to compute dysbiosis scores. The package leverages autoencoders based
anomaly detection. Further details on this method are availablehere.InstallationBefore installing dyspyosis, ensure you have the CUDA toolkit v11.x and matching cuDNN installed, these are required for Tensorflow. Which version you need
depends on your hardware, e.g. for a GTX 10XX you'll needCUDA Toolkit 11.2and the matchingcuDNN (8.1.1), for
more recent cards you can get more recent versions.Next, install dyspyosis using the command below.pip install dyspyosisUsageBelow you can find an example how to use the dyspyosis package. Note that this is for testing purposes and parameters
have been set to complete the script quickly. For real data you'll want to increase therarefication_count(the
number of times samples will be rarefied) to a large number (the number of samples x rarefication_count should be > 10k)
and increase the number ofepochsto 4000.Note: Depending on your system, you might need to set an environmental variableCUDA_VISIBLE_DEVICESto "0" before
loading dyspyosis to use the GPU. Try this in case CUDA is installed, but you get an error that no CUDA device was found.Note: The neural network dyspyosis is based on is relatively small, depending on the complexity of your dataset and
size of the latent space, running dyspyosis on CPU might outperform the GPU (see benchmarks)! To do so, setCUDA_VISIBLE_DEVICESto "-1" andCUDA_DEVICE_ORDERto "PCI_BUS_ID" in your environment before launching
dyspyosis.importpandasaspdfromdyspyosisimportDyspyosisif__name__=="__main__":df=pd.read_table("./data/test.tsv",index_col=0)dyspyosis=Dyspyosis(df.values,labels=df.index.tolist(),rarefication_depth=5000,rarefication_count=10,)dyspyosis.run_training(epochs=5)loss=dyspyosis.compute_loss()loss.to_csv("./data/loss_out.tsv",sep=",",index=None)BenchmarksThere are two benchmark scripts included in the repository:benchmark_cpu.pyandbenchmark_gpu.py. When
running the CPU benchmark it is important to set two environmental variables before running the code,CUDA_VISIBLE_DEVICESneeds to be "-1"
andCUDA_DEVICE_ORDERneeds to be "PCI_BUS_ID". This ensures that the CPU benchmark actually runs on the CPU in case a GPU is available.Here are some results running dyspyosis on hardware we have access to.TypeHardwareEpochsTime (s)CPUIntel i5-7500 @ 3.4Ghz100185.0017CPUAMD Ryzen 7 3700X100115.1882GPUNVIDIA GeForce GTX 1060 6GB100691.4091GPUNVIDIA GeForce RTX 4080 16GB100340.6128For developersClone the repository, create a virtual environment and install all requirements first. Additionally, ensure you have
the CUDA toolkit v11.x and matching cuDNN installed, these are required for Tensorflow. Which version you need
depends on your hardware, e.g. for a GTX 10XX you'll needCUDA Toolkit 11.2and the matchingcuDNN (8.1.1), for
more recent cards you can get more recent versions.git clone https://github.com/raeslab/dyspyosis
cd dyspyosis
python -m venv venv
source venv/activate
pip install -r requirements.txtTo run tests, use the command below. There are a number of Deprecation Warnings (due to tensorflow) that can be
suppressed by--disable-warnings.pytest tests/ --disable-warnings --cov=dyspyosis --cov-report=term-missing --cov-report=xmlContributingAny contributions you make aregreatly appreciated.Found a bug or have some suggestions? Open anissue.Pull requests are welcome! Though open anissuefirst to discuss which features/changes you wish to implement.Contact and Licensedyspyosis was developed bySebastian Proostat theRaesLab(part ofVIBandKULeuven). dyspyosis is available under theCreative Commons Attribution-NonCommercial-ShareAlike 4.0 Internationallicense.For commercial access inquiries, please contactJeroen Raes.