CroCoClean: decontamination of species abundance profiles from metagenomic samples affected by cross-sample contamination
Introduction
What is CroCoClean?
CroCoClean is a bioinformatics tool for decontaminating species abundance profiles from metagenomic samples affected by cross-sample contamination.
What CroCoClean is not
CroCoClean should not be confused with CroCoDeEL, which is designed to detect and estimate cross-sample contamination.
CroCoClean is designed to operate on species abundance profiles generated from shotgun metagenomic sequencing data. It is not designed for amplicon-based profiles, such as 16S rRNA gene sequencing abundance tables.
CroCoClean is not designed to remove sequencing reads originating from the contamination source; it operates directly on species abundance profiles.
CroCoClean is not designed to remove external or reagent-derived contamination, which can be addressed by tools such as decontam and SCRuB.
How CroCoClean works
For each contamination event, CroCoClean uses the species abundance profile of the contamination source and the estimated contamination rate to subtract the expected contribution of the contaminating sample from the target sample. Abundances falling below the minimum non-zero abundance observed in the original target profile are set to zero. Species identified by CroCoDeEL as being specifically introduced by the contamination event are also set to zero. The corrected profile is then renormalized so that its abundances sum to one.
Installation
CroCoClean is available on conda:
conda create --name crococlean_env -c conda-forge fplazaonate::crococlean
conda activate crococlean_env
Alternatively, you can use pip with Python ≥ 3.12:
pip install crococlean
Test the installation
After installation, you can run the built-in self-test to verify that CroCoClean is correctly installed:
crococlean test
Quick start
Input
CroCoClean requires two input files:
- a species abundance table containing the abundance profile of each species in each sample
- a CroCoDeEL output file containing the detected cross-sample contamination events and their estimated contamination rates.
Species abundance table
The species abundance table must be provided in TSV format. The first column should contain species names, and each subsequent column should correspond to a sample.
For example:
| species_name | sample1 | sample2 | sample3 | ... |
|---|---|---|---|---|
| species 1 | 0.00 | 0.05 | 0.07 | ... |
| species 2 | 0.10 | 0.01 | 0.00 | ... |
| ... | ... | ... | ... | ... |
CroCoClean operates on relative abundances. The input table is automatically normalized so that the abundances in each sample sum to one. Consequently, the input values do not necessarily need to be normalized beforehand.
CroCoClean was developed and optimized using species abundance profiles generated by Meteor, and is therefore expected to perform best with Meteor-derived profiles. It can also be used with profiles generated by other shotgun metagenomic profilers, such as Sylph or MetaPhlAn4, although performance may vary depending on the profiling method and the characteristics of the resulting abundance profiles.
An example abundance table is available here.
CroCoDeEL output file
CroCoClean also requires the TSV output file generated by CroCoDeEL. This file must contain the contamination events detected by CroCoDeEL, including the source and target samples and their corresponding estimated contamination rates.
An example is available here.
The abundance table and the CroCoDeEL output file must refer to the same samples and species.
Manual curation of the CroCoDeEL results is strongly recommended before running CroCoClean. CroCoDeEL may produce false-positive contamination events, and CroCoClean will perform decontamination for every event provided in the input file.
The CroCoDeEL Interpreter can be used to facilitate the manual inspection and curation of CroCoDeEL contamination events.
Run CroCoClean
CroCoClean uses the run subcommand to perform decontamination:
crococlean run \
-s species_abundance.tsv \
-c crococlean_output.tsv \
-o species_abundance_decontaminated.tsv
By default, CroCoClean uses a single process. The number of processes can be increased using the --nproc option:
crococlean run \
-s species_abundance.tsv \
-c crocodeel_output.tsv \
-o species_abundance_decontaminated.tsv \
--nproc 8
The optional --filter-low-ab parameter filters out low-abundance species that may be inaccurately quantified. The value should be the same as the --filter-low-ab parameter used when running CroCoDeEL.
A value of 20 is recommended for MetaPhlAn 4.
For example:
crococlean run \
-s species_abundance.tsv \
-c crocodeel_output.tsv \
-o species_abundance_decontaminated.tsv \
--filter-low-ab 20
Output
The original abundance profiles are retained in the output together with the decontaminated profiles generated for each contamination event.
Decontaminated profiles are named using the following convention:
<target>_deconta_<source>
where <target> is the contaminated sample and <source> is the sample identified as the contamination source.
For example, if sample2 was contaminated by sample1, the corresponding decontaminated profile will be named:
sample2_deconta_sample1
When a sample has multiple contamination sources, a separate decontaminated profile is generated independently for each contamination event. For example:
sample2_deconta_sample1
sample2_deconta_sample3
Current limitations
CroCoClean is an early release and has not yet been extensively tested across a broad range of datasets and contamination scenarios. Its results should therefore be interpreted with caution and independently validated before being used for downstream analyses. Use at your own risk.
CroCoClean is currently subject to the following limitations:
-
Independent decontamination of multiple contamination events: When a target sample is affected by multiple contamination sources, each contamination event is decontaminated independently. CroCoClean therefore generates a separate corrected profile for each source rather than simultaneously removing all detected contamination sources from a single profile.
-
Reduced accuracy at high contamination levels: When the estimated contamination rate is high, decontamination may be less accurate. In particular, some species introduced by the contamination may not be identified as contamination-specific and therefore may not be set to zero.
-
Complex contamination scenarios: CroCoClean may produce inaccurate results in complex contamination scenarios. This includes cases where a contamination source is itself contaminated by another sample, as well as cases of reciprocal contamination where two samples contaminate each other.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crococlean-0.1.2.tar.gz.
File metadata
- Download URL: crococlean-0.1.2.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dc2dc78cc57f2c0faf6619ce398d5bfcce81ce403566e1a6453d23b9d999dcd
|
|
| MD5 |
b44d6612d00310f60ae81a06515f33fa
|
|
| BLAKE2b-256 |
a6d78b5154942dda3cc70c9a94179e19445fb42ce82021282db8650d9e37f771
|
Provenance
The following attestation bundles were made for crococlean-0.1.2.tar.gz:
Publisher:
publish_crococlean.yml on metagenopolis/CroCoClean
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crococlean-0.1.2.tar.gz -
Subject digest:
2dc2dc78cc57f2c0faf6619ce398d5bfcce81ce403566e1a6453d23b9d999dcd - Sigstore transparency entry: 2451416977
- Sigstore integration time:
-
Permalink:
metagenopolis/CroCoClean@46739664fe57ae83deac5a891e668d6de4f9de0c -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/metagenopolis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_crococlean.yml@46739664fe57ae83deac5a891e668d6de4f9de0c -
Trigger Event:
release
-
Statement type:
File details
Details for the file crococlean-0.1.2-py3-none-any.whl.
File metadata
- Download URL: crococlean-0.1.2-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcdf2bb7bd142ad3e9a2470986ba0c9bc4bbf64d2bc5494d2333971f41c0a2f7
|
|
| MD5 |
5da71a269b2610cf12a49d51cbfe0a97
|
|
| BLAKE2b-256 |
a9ba80318d2874c05e4d1474acecb1b34678de57991297e1fdc9d0bb5e1c4983
|
Provenance
The following attestation bundles were made for crococlean-0.1.2-py3-none-any.whl:
Publisher:
publish_crococlean.yml on metagenopolis/CroCoClean
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crococlean-0.1.2-py3-none-any.whl -
Subject digest:
dcdf2bb7bd142ad3e9a2470986ba0c9bc4bbf64d2bc5494d2333971f41c0a2f7 - Sigstore transparency entry: 2451417173
- Sigstore integration time:
-
Permalink:
metagenopolis/CroCoClean@46739664fe57ae83deac5a891e668d6de4f9de0c -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/metagenopolis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_crococlean.yml@46739664fe57ae83deac5a891e668d6de4f9de0c -
Trigger Event:
release
-
Statement type: