{"library":"pydeseq2","title":"PyDESeq2","description":"PyDESeq2 is a Python implementation of the DESeq2 method for differential expression analysis (DEA) with bulk RNA-seq data. It enables researchers to perform single-factor and multi-factor designs, Wald tests with multiple testing correction, and optional LFC shrinkage. The library is actively maintained, with version 0.5.4 being the latest stable release, and it is part of the scverse ecosystem, integrating with AnnData for data handling.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install pydeseq2"],"cli":null},"imports":["from pydeseq2.dds import DeseqDataSet","from pydeseq2.ds import DeseqStats","from pydeseq2.utils import load_example_data"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pandas as pd\nfrom pydeseq2.dds import DeseqDataSet\nfrom pydeseq2.ds import DeseqStats\n\n# 1. Create dummy count data (genes x samples) and metadata\n# In a real scenario, load with pd.read_csv('counts.csv', index_col=0).T\n# and pd.read_csv('metadata.csv', index_col=0)\ncounts_df = pd.DataFrame(\n    {\n        'sample1': [100, 50, 200, 10, 5, 150],\n        'sample2': [120, 60, 210, 12, 6, 160],\n        'sample3': [10, 5, 20, 100, 50, 15],\n        'sample4': [15, 7, 25, 110, 55, 18]\n    },\n    index=['geneA', 'geneB', 'geneC', 'geneD', 'geneE', 'geneF']\n).T # Transpose to samples x genes\n\nmetadata = pd.DataFrame(\n    {\n        'condition': ['treated', 'treated', 'control', 'control'],\n        'batch': ['batch1', 'batch2', 'batch1', 'batch2']\n    },\n    index=['sample1', 'sample2', 'sample3', 'sample4']\n)\n\n# Ensure counts_df index (samples) matches metadata index (samples)\nassert counts_df.index.equals(metadata.index)\n\n# 2. Filter low-count genes (optional, but good practice)\ngenes_to_keep = counts_df.columns[counts_df.sum(axis=0) >= 10]\ncounts_df = counts_df[genes_to_keep]\n\n# 3. Initialize DeseqDataSet with a formulaic design\ndds = DeseqDataSet(\n    counts=counts_df,\n    metadata=metadata,\n    design='~condition'\n)\n\n# 4. Run the DESeq2 pipeline (normalization, dispersion, LFC estimation)\ndds.deseq2()\n\n# 5. Perform statistical testing\ndeseq_stats = DeseqStats(dds, contrast=['condition', 'treated', 'control'])\ndeseq_stats.wald_test()\n\n# 6. Apply LFC shrinkage (optional)\ndeseq_stats.lfc_shrink(coeff='condition_treated_vs_control')\n\n# 7. Access results\nresults = deseq_stats.results_df\nprint(results.head())\n\n# You can also access attributes directly from dds, e.g., normalized counts\n# print(dds.layers['normed_counts'].head())","lang":"python","description":"This quickstart demonstrates a typical PyDESeq2 workflow for differential expression analysis. It covers loading data, initializing a `DeseqDataSet` with a `formulaic` design string, running the DESeq2 pipeline, performing Wald tests, and applying LFC shrinkage. Results are accessible via the `DeseqStats` object's `results_df` attribute.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"0.4.12","pypi_latest":"0.5.4","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":50,"avg_install_s":19.6,"avg_import_s":6.46,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pydeseq2","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pydeseq2","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":19.1,"import_time_s":4.11,"mem_mb":90.9,"disk_size":"451M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pydeseq2","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pydeseq2","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":19.7,"import_time_s":8.03,"mem_mb":113.3,"disk_size":"533M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pydeseq2","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pydeseq2","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":19.2,"import_time_s":8.34,"mem_mb":111.4,"disk_size":"512M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pydeseq2","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pydeseq2","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":19.6,"import_time_s":7.33,"mem_mb":112.8,"disk_size":"510M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pydeseq2","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pydeseq2","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":20.4,"import_time_s":4.51,"mem_mb":82.6,"disk_size":"453M"}]}}