{ "cells": [ { "cell_type": "markdown", "id": "c41951cc-868a-4399-99c0-b0f674ec67c7", "metadata": {}, "source": [ "# Null models\n", "Null models are powerful tools for investigating community assembly mechanisms by comparing observed patterns to those expected under random processes.\n", "In qdiv, several widely used indices are implemented:\n", "- Raup–Crick index for assessing beta diversity deviations from randomness\n", "- Net Relatedness Index (NRI) and Nearest Taxon Index (NTI) for both alpha and beta diversity, which evaluate phylogenetic clustering or dispersion\n", "\n", "*What's special with qdiv?* These indices can be calculated for any diversity order (q), allowing you to incorporate abundance sensitivity into null model analyses!" ] }, { "cell_type": "markdown", "id": "a842f143-d51f-4f73-abc9-dc4d7bcc3636", "metadata": {}, "source": [ "Let's load some example data and try:" ] }, { "cell_type": "code", "execution_count": 1, "id": "91ee1540-fd5d-47e4-8818-724e6c74b59b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import qdiv\n", "obj = qdiv.MicrobiomeData.load_example(\"Saheb-Alam_DADA2\") #First we load example data\n", "obj.rename_features(inplace=True, name_type=\"ASV\") #This is the name the features ASV1, ASV2\n", "obj.tax_prefix(add=True, inplace=True) #This is to add prefix to the taxonomic classified, i.e., d__ for domain, p__ for phylum, etc." ] }, { "cell_type": "markdown", "id": "6c2eca19-6164-4268-95fc-baf8b2a0bc85", "metadata": {}, "source": [ "First, we'll calculate the Raup-Crick index using the **model.rcq** function." ] }, { "cell_type": "code", "execution_count": 3, "id": "a739944e-feb5-4965-8db6-c7366f54f193", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3fb503c2736b4eb1ac946d5b790ccc94", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Randomizing tables: 0%| | 0/1000 [00:00