SciFlow lab notebook · Shared read-only

16S Amplicon — Human Body-Site Microbiome (SciFlow)

Which microbes live at four human body sites, and how distinct are those communities?

16Sampliconmicrobiomegutsoil

Overview Methods & provenance Results Raw artifacts

Run date

2026-06-01 → 2026-07-17

Stages

3 3 completed

Pipeline

rdp → python → community_analysis

Software

not recorded

Outputs

50 files 109.3 MB

Overview

Which microbes live at four human body sites, and how distinct are those communities? This demo runs the real QIIME 2 Moving Pictures 16S dataset (Caporaso et al. 2011, 34 samples across gut, tongue, left palm, and right palm) through denoising, taxonomy assignment, and community analysis.

Key results from this run: PERMANOVA on body_site R²=0.563, p=0.001 — body site explains 56% of community variance and the separation is highly significant. PCoA (Bray–Curtis) captures 50.3% + 21.6% of variance on the first two axes. 42 indicator species identified after BH correction. The gut community separates strongly from oral and skin sites; left and right palm are not distinct from each other, reflecting a shared skin microenvironment.

Note on the ordination: NMDS collapses to a near-zero stress solution on this dataset because the body-site groups are so well-separated — the PCoA is the more informative ordination here.

Pipeline: DADA2 denoising → QIIME 2 taxonomy (Silva 138) → alpha/beta diversity → PERMANOVA → indicator species (IndVal).

Built for microbiome labs who want a defensible, end-to-end 16S profiling and diversity workflow on real, well-characterised human data.

Methods & per-stage provenance

3 stages, 3 completed. Each stage below lists the parameters it ran with, the software the run recorded, and the files it produced.

Not recorded by this run
  • Software: no stage in this run recorded the container image it executed
00 RDP Classification (16S) rdp 1 min completed

Classify the mock 16S rRNA community to genus level with the Ribosomal Database Project naive-Bayes classifier (bootstrap confidence >= 0.8). Directly answers 'what microbes are in this sample'.

gene: 16srrnaconfidence: 0.8

Verbatim command / script not recorded in this run's stage record.

Container image: not recorded in this stage's run metadata Image digest: not recorded in this stage's run metadata
  • input_data_summary.htmlreport · 171 KB
  • mock_16s_community.rdpRDP · 42 KB
  • moving_pictures_16s.rdpRDP · 5.1 MB
  • rdp_report.htmlreport · 9 KB
  • summary.jsondata · 2 KB
01 Build Abundance Matrix python 1.0 h completed

Pivot the RDP fixrank output into a taxa x samples relative-abundance matrix (mock_abundance.csv) and carry env.csv (sample biome metadata) through for between-group comparison.

# Pivot RDP fixrank output -> taxa x samples abundance matrix (INTEGER COUNTS)
# Output named exactly abundance.csv + env.csv (community_analysis.R hardcodes these)
# FIX(C1 2026-05-31): was dividing by sample_tot to emit relative proportions
# (0.0-1.0), causing detect_data_type() to classify as plant_community and
# skip rarefaction + collapse NMDS to stress=0. Now emits raw integer read counts.
import os, csv, glob, shutil
from collections import defaultdict

INPUT_DIR = os.environ.get("INPUT_DIR", "/work/input")
OUTPUT_DIR = os.environ.get("OUTPUT_DIR", "/work/output")
os.makedirs(OUTPUT_DIR, exist_ok=True)
CONF = 0.8

def sample_of(seqid):
    return seqid.split("_", 1)[0]

def parse_fixrank(path, counts):
    with open(path) as fh:
        for line in fh:
            line = line.rstrip("\n")
            if not line:
                continue
            parts = line.split("\t")
            if len(parts) < 5:
                continue
            sample = sample_of(parts[0])
            best = None
            i = 2
            while i + 2 < len(parts):
                taxon = parts[i].strip().strip('"')
                try:
                    conf = float(parts[i + 2])
                except ValueError:
                    i += 3; continue
                if conf >= CONF and taxon and taxon.lower() != "root":
                    best = taxon
                i += 3
            if best:
                counts[(sample, best)] += 1

counts = defaultdict(int)
rdp_files = glob.glob(os.path.join(INPUT_DIR, "*.rdp"))
print("RDP files found:", rdp_files)
for p in rdp_files:
    parse_fixrank(p, counts)

samples = sorted({s for (s, _t) in counts})
taxa = sorted({t for (_s, t) in counts})
print(f"Parsed {len(taxa)} taxa across {len(samples)} samples")

total_reads = sum(counts.values())
print(f"Total read assignments: {total_reads} (integer counts, rarefaction-ready)")

# Write taxa-as-rows, samples-as-columns (community_analysis.R auto-transposes via
# env-overlap detection or dimension heuristic to get samples-as-rows for analysis)
out = os.path.join(OUTPUT_DIR, "abundance.csv")
with open(out, "w", newline="") as fh:
    w = csv.writer(fh)
    w.writerow(["taxon"] + samples)
    for t in taxa:
        row = [t] + [counts.get((s, t), 0) for s in samples]
        w.writerow(row)
print("Wrote", out)

src_env = os.path.join(INPUT_DIR, "env.csv")
if os.path.exists(src_env):
    shutil.copy2(src_env, os.path.join(OUTPUT_DIR, "env.csv"))
    print("Carried env.csv through")
else:
    print("No env.csv in input dir")
Container image: not recorded in this stage's run metadata Image digest: not recorded in this stage's run metadata
  • abundance.csvtable · 48 KB
  • env.csvtable · 904 B
02 Community Analysis community_analysis 9 s completed

Alpha diversity (Shannon/Simpson/observed), beta diversity (Bray-Curtis), and ordination (PCoA/NMDS) across the 6 samples, tested between gut and soil biomes. Produces the interactive community report.

abundance file id: ca14c6ee-50bc-42ae-9afb-f3a204ef5365env file id: 3ba905a4-dbe9-4e2e-854d-645312affbd9abundance file: abundance.csvenv file: env.csvdata type: auto_detectgroup column: body_site

Verbatim command / script not recorded in this run's stage record.

Container image: not recorded in this stage's run metadata Image digest: not recorded in this stage's run metadata
  • alpha_diversity.csvtable · 3 KB
  • alpha_diversity.htmlreport · 3.6 MB
  • alpha_diversity_plot.htmlreport · 3.6 MB
  • alpha_diversity_subject.htmlreport · 3.6 MB
  • alpha_kruskal_wallis.csvtable · 235 B
  • betadisper.htmlreport · 3.6 MB
  • ca.htmlreport · 3.6 MB
  • cca.htmlreport · 3.7 MB
  • community_analysis.RR · 20 KB
  • core_microbiome.htmlreport · 395 KB
  • dbrda.htmlreport · 3.7 MB
  • dca.htmlreport · 3.6 MB
  • heatmap.htmlreport · 3.7 MB
  • hierarchical_clustering.htmlreport · 3.6 MB
  • hill_numbers.htmlreport · 3.6 MB
  • indicator_species.htmlreport · 446 KB
  • indicator_species_chart.htmlreport · 3.6 MB
  • nestedness.htmlreport · 3.6 MB
  • nmds.htmlreport · 3.6 MB
  • not_applicable.htmlreport · 2 KB
  • pairwise_permanova.htmlreport · 382 KB
  • pcoa.htmlreport · 3.6 MB
  • pcoa_plot.htmlreport · 3.6 MB
  • permanova_heatmap_body_site.htmlreport · 3.6 MB

+ 19 more output file(s) — see Raw artifacts.

Results

Figures

rarefaction_curves.png
rarefaction_curves.png

Raw artifacts

50 output files produced across all stages (109.3 MB total). This report is self-contained; structures and trajectories are listed below for reference.