Delete README.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291---title: Bulamarwa Metagenomics Suiteemoji: π§¬colorFrom: indigocolorTo: greensdk: dockerapp_port: 7860suggested_hardware: cpu-upgradepinned: falselicense: mit---
# Bulamarwa Metagenomics Suite v1.0
Bulamarwa Metagenomics Suite v1.0 is a Docker based Hugging Face Space for modular shotgun metagenomics analysis. It is designed to take raw FASTQ data through quality control, optional host removal, taxonomic profiling, assembly, genome binning, MAG quality assessment and taxonomy, gene prediction, functional annotation, antimicrobial resistance analysis, virus and plasmid analysis, ecological summaries, and exploratory machine learning.
The application follows the project design in which shotgun metagenomics is the core workflow and analysis can be selected as Basic, Comprehensive, Genome resolved, or Complete. The workflow records parameters, software versions, input SHA256 checksums, database paths, a machine readable run manifest, a methods record, and a complete pipeline log.
## Important deployment note
A full metagenomics workflow is much heavier than a normal web application. Large Kraken2, GTDB Tk, CheckM2, eggNOG and geNomad databases should not be committed to the Space Git repository. Mount them from persistent storage or a dataset volume and provide their paths using Space Variables.
The app can start without these databases. Database dependent modules are then shown as unavailable and are skipped with an explicit message in the run log. This allows the same repository to serve as a small demonstration Space and as a full research instance on upgraded hardware.
## Main workflow
```textFASTQ βInput and metadata validation βfastp + FastQC + MultiQC βOptional Bowtie2 host removal βKraken2 + Bracken read based taxonomy βMEGAHIT assembly + QUAST βBowtie2/SAMtools mapping + MetaBAT2 binning βCheckM2 MAG quality + GTDB Tk taxonomy βProdigal gene prediction + eggNOG mapper βAMRFinderPlus resistome/selected virulence determinants βgeNomad viruses and plasmids βAlpha diversity including Chao1 only from validated counts βBray Curtis / Jaccard / Aitchison PCoA βPermutation PERMANOVA + permutation PERMDISP βExploratory CLR differential analysis with BH FDR βOut of fold Random Forest + held out permutation importance + post hoc SHAP βMethods + manifests + publication graphics + ZIP results```
## Files in this repository
```textapp.py Gradio application and workflow orchestratorrequirements.txt Python application dependenciesDockerfile Bioinformatics Docker environmentREADME.md Hugging Face Space configuration and documentationexample_metadata.csv Example multi sample metadata sheet.dockerignore Prevents sequencing/results files entering Docker builds```
## Input data
For one sample, upload one single end FASTQ or a paired R1/R2 set. For multiple samples, upload all FASTQ files plus a metadata CSV or TSV.
The metadata must contain:
```textSample_IDRead_1```
For paired end reads add:
```textRead_2```
Recommended experimental fields are:
```textGroupConditionLocationTime_pointReplicateSequencing_platformLibrary_type```
The file names listed in `Read_1` and `Read_2` must exactly match uploaded FASTQ file names.
## Analysis modes
### Basic
Quality control, optional decontamination, Kraken2/Bracken taxonomy, diversity and comparative summaries.
### Comprehensive
Basic analysis plus MEGAHIT assembly, QUAST, gene prediction, functional annotation, AMRFinderPlus, geNomad, and statistical summaries.
### Genome resolved
Quality control, assembly, read mapping, MetaBAT2 binning, CheckM2, GTDB Tk, gene prediction, and genome linked analyses.
### Complete
Runs all applicable modules. A module is skipped rather than silently substituted when a required executable or database is unavailable.
## External databases
Configure the following Hugging Face Space Variables. The values must be paths visible inside the container.
| Variable | Purpose | Example mounted path ||---|---|---|| `KRAKEN2_DB` | Kraken2 and Bracken database | `/data/kraken2` || `CHECKM2DB` | CheckM2 DIAMOND database file/path | `/data/checkm2/uniref100.KO.1.dmnd` || `GTDBTK_DATA_PATH` | GTDB Tk reference package | `/data/gtdbtk` || `EGGNOG_DATA_DIR` | eggNOG mapper data directory | `/data/eggnog` || `GENOMAD_DB` | geNomad database directory | `/data/genomad_db` |
Optional application variables:
| Variable | Default | Meaning ||---|---:|---|| `APP_TITLE` | Bulamarwa Metagenomics Suite | Space title shown in the interface || `WORK_ROOT` | `/tmp/metagenome_runs` | Temporary analysis directory || `MAX_UPLOAD_GB` | `20` | Maximum total uploaded FASTQ size accepted by one run || `DEFAULT_THREADS` | `4` | Default thread count shown in the interface || `PORT` | `7860` | Web server port |
## Hugging Face deployment
1. Create a new Hugging Face Space and select **Docker** as the SDK.2. Upload `app.py`, `requirements.txt`, `Dockerfile`, `README.md`, `example_metadata.csv`, and `.dockerignore` to the root of the Space repository.3. Commit the files. Hugging Face will build the Docker image automatically.4. Open **Settings** and select hardware appropriate for the dataset. `cpu-upgrade` is suggested for demonstration and small analyses. Real assembly and MAG recovery usually require substantially more CPU, memory and disk.5. Attach persistent storage or dataset volumes containing the large databases.6. Add the database paths above under **Settings β Variables and secrets**.7. Restart the Space after changing mounted data or database path variables.8. Open the **System and database status** tab and verify the required modules before starting a scientific run.
## Persistent storage
The default Space filesystem is not suitable for long term storage of large metagenomic databases or results. Mount persistent storage under a path such as `/data`, put external databases there, and point the corresponding Variables to those paths.
Do not store sensitive human sequencing data in a public Space. For human metagenomics, use an access controlled deployment and ensure that institutional ethics, consent, data governance, and applicable privacy requirements allow the data to be processed in that environment.
## Scientific parameters
The interface exposes the following core parameters:
* Minimum fastp base quality. Default `Q20`.* Minimum retained read length. Default `50 bp`.* Maximum ambiguous N bases per read. Default `5`. This is an absolute count because fastp `--n_base_limit` is not a proportion.* Optional poly G trimming.* Kraken2 confidence. Default `0.10`.* Bracken taxonomic rank. Default species `S`.* Minimum Bracken supporting reads. Default `10`.* Minimum assembly contig length. Default `1000 bp`.* Beta diversity metric: Bray Curtis, Jaccard, or Aitchison.* PERMANOVA and PERMDISP permutation count. Default `999`.* Taxon prevalence and mean relative abundance filters.* Benjamini Hochberg FDR threshold. Default `0.05`.* Random seed. Default `42`.
These defaults are starting points and are not universal acceptance thresholds. They should be justified for the sequencing technology, environment, research question, and benchmark results.
## Advanced statistics mode
Use the **Advanced statistics / imported abundance** tab when heavy classification or annotation has already been performed on an HPC cluster, cloud instance, nf core workflow, or another metagenomics pipeline. The tab can analyse Kraken2/Bracken taxonomic counts, MetaPhlAn abundance tables after suitable reshaping, functional abundance matrices, pathway abundance, ARG abundance, MAG abundance, or comparable nonnegative feature matrices.
Select whether the table contains **Counts** or **Relative abundance**. Do not label normalized percentages or proportions as counts. If counts are selected, the app validates that every value is integer like before permitting Chao1. The complete statistical output, including distance matrices, PCoA coordinates, PERMANOVA/PERMDISP tables, differential results, figures, machine learning metrics, feature importance and statistical notes, is returned as a downloadable ZIP.
## Output
Every run produces a ZIP archive containing a structure similar to:
```textrun_<timestamp>_<id>/βββ 00_Input/βββ 01_QC/βββ 02_Host_Removal/βββ 03_Taxonomy/βββ 04_Assembly/βββ 05_Assembly_QC/βββ 06_MAGs/βββ 07_Genes_Function/βββ 08_Resistome_Virulome/βββ 09_Viruses_Plasmids/βββ 10_Statistics/βββ 11_Machine_Learning/βββ run_manifest.jsonβββ parameters.yamlβββ software_versions.tsvβββ database_versions.tsvβββ samplesheet_resolved.csvβββ methods.txtβββ analysis_summary.jsonβββ pipeline.log```
`run_manifest.json` contains input checksums and analysis parameters. `software_versions.tsv` records detected software versions. `database_versions.tsv` records configured reference paths. `methods.txt` provides a reproducibility oriented methods record, which should be checked and edited before inclusion in a manuscript.
## Statistical interpretation
The merged package contains a dedicated **Advanced statistics / imported abundance** tab in addition to the raw FASTQ workflow. It accepts count or relative abundance tables in either taxa by samples or samples by taxa orientation. Metadata are matched by `Sample_ID`.
Alpha diversity includes observed richness, Shannon and Simpson indices. **Chao1 is calculated only when the user explicitly declares count data and all entries are validated as nonnegative integers.** Chao1 is reported as missing for relative abundance data rather than being incorrectly estimated from proportions. Group comparisons use Mann Whitney U for two groups or Kruskal Wallis for more than two groups, with Benjamini Hochberg adjustment across the alpha metrics tested.
Beta diversity supports Bray Curtis, Jaccard and Aitchison distances. PCoA axis percentages are calculated relative to all positive eigenvalues. PERMANOVA uses label permutations and a pseudo F statistic. PERMDISP is also permutation based: distances to group centroids are recomputed after each label permutation, so the reported p value is genuinely permutation derived rather than a parametric ANOVA p value described as a permutation result. A significant PERMDISP result should be considered when interpreting PERMANOVA.
The differential abundance module remains explicitly exploratory. Taxa are filtered by configurable prevalence and mean relative abundance, transformed with CLR, compared between two groups with a two sided Mann Whitney U test, and corrected using Benjamini Hochberg FDR. The volcano plot uses `-log10(adjusted p value)` on the vertical axis and the same adjusted p value threshold used to define significant points. This keeps the visual threshold and statistical decision consistent. For covariate adjustment, repeated measures, longitudinal designs, or confirmatory microbiome inference, use a dedicated method such as ANCOM BC2 or MaAsLin2 outside this exploratory module.
The Random Forest module uses CLR transformed taxonomic features and stratified cross validation. Accuracy, balanced accuracy, precision, sensitivity, specificity, F1, MCC, ROC AUC, PR AUC and Brier score are calculated exclusively from out of fold predictions. Primary feature ranking uses permutation importance calculated on held out folds and averaged across cross validation folds. SHAP is retained as an optional post hoc explanation of the final model fit, but is explicitly labelled as descriptive and is not used as evidence of independent predictive validation. An independent external cohort is still required for strong biomarker or clinical prediction claims.
## MAG quality reporting
CheckM2 results should be interpreted together with assembly properties and other genome quality evidence. Do not classify MAG quality solely from completeness. For formal genome resolved publication, apply the MIMAG criteria appropriate to the study and report completeness, contamination, assembly statistics, rRNA/tRNA recovery where required, and the GTDB reference release.
## Database provenance
For publication, record the exact release or build date of each database, not only its directory path. Database contents can change independently of the application code. Before freezing a manuscript analysis, archive or otherwise preserve the exact reference versions permitted by the relevant database licenses.
## Local Docker test
Build:
```bashdocker build -t bulamarwa-metagenomics-suite .```
Run without databases:
```bashdocker run --rm -p 7860:7860 bulamarwa-metagenomics-suite```
Run with databases mounted read only:
```bashdocker run --rm -p 7860:7860 \ -v /path/to/databases:/data:ro \ -e KRAKEN2_DB=/data/kraken2 \ -e CHECKM2DB=/data/checkm2/uniref100.KO.1.dmnd \ -e GTDBTK_DATA_PATH=/data/gtdbtk \ -e EGGNOG_DATA_DIR=/data/eggnog \ -e GENOMAD_DB=/data/genomad_db \ bulamarwa-metagenomics-suite```
## Dry run
Select **Dry run** in the interface to validate inputs and write intended command lines to `pipeline.log` without running the large analysis steps. This is useful when checking a new Space build or demonstrating the workflow on limited hardware.
## Reproducibility and publication quality
For a final research analysis, retain the run ZIP, raw data accession numbers, database releases, container revision, Space Git commit, experimental metadata, and any downstream statistical scripts. Benchmark taxonomic classification, assembly and MAG recovery with synthetic or mock community datasets before presenting the software as a validated analytical platform.
## Current implementation boundaries
This release executes MetaBAT2 as the automated binner. Multi binner consensus refinement with MetaBAT2, MaxBin2, CONCOCT and DAS Tool should be added as a separate validated module if consensus MAG recovery is required.
AMRFinderPlus `--plus` detects AMR genes and selected additional genes, but it is not a complete universal virulence database. If a study makes broad virulome claims, integrate and validate a dedicated virulence resource and report its version and thresholds.
The app does not automatically download large databases at runtime. This is intentional because reference databases can be very large, Space disks may be ephemeral, and database release provenance must be controlled for reproducibility.
## Recommended validation before publication
Validate the application with synthetic ground truth datasets, mock microbial communities, and independent public metagenomic datasets. Report taxonomic precision, recall and F1 at multiple ranks, abundance error, assembly metrics, MAG completeness and contamination, genome recovery, runtime, RAM, disk consumption, and scaling behaviour. Compare key results against established workflows rather than relying only on successful execution.
## License
The application code can be released under the MIT License. The bioinformatics tools and external databases retain their own licenses and citation requirements. Review those terms before redistribution or commercial deployment.
## Citation
If this application becomes part of a publication, replace this section with the final software citation, DOI, version, repository commit and manuscript reference. Also cite the individual analytical tools and databases actually used in each analysis.README.mdDeleted-291