SCCmecExtractor
A Python toolkit for extracting and typing SCCmec and non-mec SCC elements from Staphylococcus and Mammaliicoccus whole genome sequences. The tool identifies attachment (att) sites, extracts complete SCC elements and performs gene-level typing of mec and ccr gene complexes.
Note: extraction requires both att sites to be on the same contig as rlmH. This is a same-contig requirement with assembly fragmentation being the main source of extraction failure, particularly in non-aureus species.
Overview
SCCmecExtractor provides six CLI commands that work together to identify, extract and type SCCmec and non-mec SCC elements:
| Command | Description |
|---|---|
sccmec-pipeline |
Master pipeline orchestrating all steps (recommended) |
sccmec-locate-att |
Locate attachment (att) sites in genomic sequences |
sccmec-extract |
Extract SCC elements bounded by att site pairs |
sccmec-type |
Type SCC elements by mec complex class (A-E), ccr complex type (1-22) and SCCmec type (I-XV) |
sccmec-hybrid |
Determine if extracted SCC element are hybrids of SCCmec types (I-XV) |
sccmec-report |
Merge extraction and typing results into a unified report |
Each CLI command produces specific outputs, that users can review:
• sccmec-locate-att: att_sites/ – a directory containing per-genome att site information • sccmec-extract: sccmec/ – a directory with extracted element FASTA files • sccmec-extract: ambiguous_att_sites.tsv – Detailed att site information for non-extracted genomes • sccmec-extract: extraction_report.tsv – extraction report (standalone mode; merged into unified report when using the pipeline) containing comprehensive metadata associated with extraction success or failure • sccmec-type: typing.tsv – if used standalone, produces a summary SCCmec typing output • sccmec-hybrid: hybrid_summary.tsv – Reference comparison results for extracted elements, used to detect hybrid elements • sccmec-hybrid: hybrid_detail/ – (optional with -d flag) Detailed reference comparison results for extracted elements, one per genome • sccmec-report: sccmec_summary.tsv – Start here. One row per genome with key results. • sccmec-report: sccmec_unified_report.tsv – Full diagnostic detail for all genomes (all columns).
Key Capabilities
- FASTA-only mode — no GFF annotation required; rlmH detected via BLAST against a 70-species reference database
- Non-mec SCC detection — extracts SCC elements that carry ccr genes but lack mec genes
- Composite element detection — identifies tandem/nested SCC elements with multiple att site pairs
- SCCmec typing — assigns mec complex class (A-E), ccr complex type (1-22 per IWG-SCC) and SCCmec type (I-XV) via BLAST-based gene detection, including IS element proximity and orientation analysis
- Cross-genus support — validated on Staphylococcus (64 species) and Mammaliicoccus (6 species)
Table of Contents
- Installation
- Requirements
- Usage
- Complete Workflow Examples
- How It Works
- Output Format
- Troubleshooting
- Citation
- License
- Contributing
- Contact
Installation
Using Conda/Mamba (Recommended)
# Create a new environment
conda create -n sccmecextractor python=3.11
conda activate sccmecextractor
# Install dependencies
conda install -c conda-forge -c bioconda biopython blast
# Install Bakta only if you need GFF-based workflow
conda install -c conda-forge -c bioconda bakta
# Install SCCmecExtractor
pip install sccmecextractor
# Test that commands are available
sccmec-pipeline --help
sccmec-locate-att --help
sccmec-extract --help
sccmec-type --help
sccmec-report --help
If commands do not run, make sure the environment's bin/ directory is in your PATH:
export PATH="$CONDA_PREFIX/bin:$PATH"
Using pip
Note: installation with pip does not provide BLAST+ or Bakta. BLAST+ is required for ccr gene checks, typing and FASTA-only mode.
# Install SCCmecExtractor
pip install sccmecextractor
# Test that commands are available
sccmec-pipeline --help
Using Docker
Docker provides a containerised environment with all dependencies pre-installed, including BLAST+ and Bakta.
# Pull the pre-built image
docker pull alisonmacfadyen/sccmecextractor:latest
# Or build from source
git clone https://github.com/AlisonMacFadyen/SCCmecExtractor.git
cd SCCmecExtractor
docker build -t sccmecextractor:latest -f containers/Dockerfile .
Quick Start with Docker:
# FASTA-only mode (no Bakta database needed)
docker run --rm \
-v $PWD:/work \
alisonmacfadyen/sccmecextractor:latest \
sccmec-pipeline --fna-dir genomes/ -o results/
# With GFF annotation
docker run --rm \
-v $PWD:/work \
alisonmacfadyen/sccmecextractor:latest \
sccmec-pipeline -f genome.fna -g genome.gff3 -o results/
See CONTAINER_GUIDE.md for detailed Docker usage instructions.
Using Singularity
Singularity/Apptainer is ideal for HPC environments where Docker is not available.
# Pull from Docker Hub
singularity pull docker://alisonmacfadyen/sccmecextractor:latest
# Or build from definition file
singularity build sccmecextractor.sif containers/sccmecextractor.def
Quick Start with Singularity:
# FASTA-only mode
singularity exec \
--bind $PWD:/work \
sccmecextractor.sif \
sccmec-pipeline --fna-dir genomes/ -o results/
# With GFF annotation
singularity exec \
--bind $PWD:/work \
sccmecextractor.sif \
sccmec-pipeline -f genome.fna -g genome.gff3 -o results/
See CONTAINER_GUIDE.md for detailed Singularity usage instructions.
Requirements
Dependencies
- Python 3.9+
- Biopython
- BLAST+ (bundled in containers)
- Bakta (optional, only needed for GFF-based workflow) and automatically included in containers
Input Files
- Genome sequence:
.fastaor.fnafile containing the assembled genome
When using GFF mode:
- Gene annotations:
.gff3file with gene annotations (we recommend Bakta for annotation)
When using FASTA-only mode (--blast-rlmh): No annotation file is needed rlmH is detected via BLAST against a bundled 70-species reference database
Bakta Database
Only required if using Bakta for GFF annotation:
# Light database (faster, smaller)
bakta_db download --output bakta_db --type light
# Full database
bakta_db download --output bakta_db
Usage
FASTA-only Mode (Recommended)
The simplest way to run SCCmecExtractor. No GFF annotation or Bakta database is required — rlmH is detected via BLAST. If using a novel species, recommended to supply rlmH gene reference.
# Single genome
sccmec-pipeline -f genome.fna -o results/
# Multiple genomes
sccmec-pipeline -f genome1.fna genome2.fna genome3.fna -o results/
# Directory of genomes
sccmec-pipeline --fna-dir genomes/ -o results/
# With composite element detection and multithreading
sccmec-pipeline --fna-dir genomes/ --composite -o results/ -t 4
GFF Mode
If you have pre-computed GFF3 annotations (e.g. from Bakta), you can provide them. GFF files are matched to FASTA files by stem name.
# Single genome with GFF
sccmec-pipeline -f genome.fna -g genome.gff3 -o results/
# Directories of genomes and GFFs
sccmec-pipeline --fna-dir genomes/ --gff-dir annotations/ -o results/
Command Reference
sccmec-pipeline
Master pipeline that runs all steps: att site location, extraction, typing and report generation.
sccmec-pipeline [-h] (-f FNA [FNA ...] | --fna-dir FNA_DIR)
[-g GFF [GFF ...] | --gff-dir GFF_DIR] [--blast-rlmh]
[--rlmh-ref RLMH_REF] [--composite] -o OUTDIR [-t THREADS]
[--mec-ref MEC_REF] [--ccr-ref CCR_REF]
| Argument | Description |
|---|---|
-f, --fna |
One or more FASTA/FNA genome files |
--fna-dir |
Directory of FASTA/FNA genome files |
-g, --gff |
One or more GFF3 annotation files (matched by stem name) |
--gff-dir |
Directory of GFF3 files (matched by stem name) |
--blast-rlmh |
Use BLAST for rlmH detection (auto-enabled when no GFF provided) |
--rlmh-ref |
Custom rlmH reference FASTA for BLAST detection |
--composite |
Extract to outermost boundary for composite elements |
-o, --outdir |
Output directory for all results |
-t, --threads |
Number of parallel threads (default: 1) |
--mec-ref |
Custom mec gene reference FASTA for gene content detection (see sccmec-type) |
--ccr-ref |
Custom ccr gene reference FASTA for gene content detection (see sccmec-type) |
sccmec-locate-att
Identifies attachment sites in genomic sequences.
sccmec-locate-att [-h] -f FNA [-g GFF] -o OUTFILE [--blast-rlmh] [--rlmh-ref RLMH_REF]
| Argument | Description |
|---|---|
-f, --fna |
Input genome file (.fasta or .fna) |
-g, --gff |
Gene annotation file (.gff3 format, optional) |
-o, --outfile |
Output TSV file containing att site locations |
--blast-rlmh |
Use BLAST for rlmH detection (auto-enabled when no GFF provided) |
--rlmh-ref |
Custom rlmH reference FASTA |
sccmec-extract
Extracts SCC elements bounded by att site pairs.
sccmec-extract [-h] -f FNA [-g GFF] -a ATT -s SCCMEC [--composite] [-r REPORT]
[--blast-rlmh] [--rlmh-ref RLMH_REF]
| Argument | Description |
|---|---|
-f, --fna |
Input genome file (.fasta or .fna) |
-g, --gff |
Gene annotation file (.gff3 format, optional) |
-a, --att |
TSV file from sccmec-locate-att with att site locations |
-s, --sccmec |
Output directory for extracted SCC sequences |
--composite |
Extract to outermost boundary for composite elements |
-r, --report |
Output TSV file for extraction report (appends for batch) |
--blast-rlmh |
Use BLAST for rlmH detection (auto-enabled when no GFF provided) |
--rlmh-ref |
Custom rlmH reference FASTA |
sccmec-type
Types SCC elements (or whole genomes) by mec complex class (A-E), ccr complex type (1-22) and SCCmec type (I-XV). Classification is based on BLAST detection of mec genes, ccr allotypes and mec complex structural genes (IS431, IS1272, mecI, mecR1), with IS element proximity and orientation analysis for mec class determination.
sccmec-type [-h] -f FASTA [FASTA ...] -o OUTFILE [--mec-ref MEC_REF] [--ccr-ref CCR_REF]
| Argument | Description |
|---|---|
-f, --fasta |
Input FASTA file(s) or directory of extracted SCC elements |
-o, --outfile |
Output TSV file for typing results |
--mec-ref |
Custom mec gene reference FASTA for gene content detection. When provided, mec genes are detected using this reference; mec complex class and SCCmec type will not be assigned. ccr typing still uses the bundled reference |
--ccr-ref |
Custom ccr gene reference FASTA for gene content detection. When provided, ccr genes are detected using this reference; ccr complex type and SCCmec type will not be assigned. mec typing still uses the bundled reference |
sccmec-report
Merges extraction and typing results into a unified report.
sccmec-report [-h] -e EXTRACTION_REPORT -t TYPING_RESULTS -o OUTFILE
| Argument | Description |
|---|---|
-e, --extraction-report |
TSV from sccmec-extract --report |
-t, --typing-results |
TSV from sccmec-type |
-o, --outfile |
Output unified report TSV |
Complete Workflow Examples
FASTA-only Mode (Recommended)
# One-liner for a directory of genomes
sccmec-pipeline --fna-dir genomes/ -o results/ -t 4
GFF Mode with Bakta Annotation
# 1. Annotate your genome with Bakta
bakta --db bakta_db genome.fna --output bakta_output
# 2. Run the pipeline with GFF
sccmec-pipeline -f genome.fna -g bakta_output/genome.gff3 -o results/
Step-by-Step (Individual Commands)
# 1. Locate att sites
sccmec-locate-att -f genome.fna -o att_sites/att_sites.tsv
# 2. Extract SCC elements
sccmec-extract -f genome.fna -a att_sites/att_sites.tsv -s sccmec/ -r extraction_report.tsv
# 3. Type extracted elements and whole genome
sccmec-type -f sccmec/ genome.fna -o typing_results.tsv
# 4. Generate unified report
sccmec-report -e extraction_report.tsv -t typing_results.tsv -o unified_report.tsv
Docker
# FASTA-only mode (simplest)
docker run --rm \
-v $PWD:/work \
alisonmacfadyen/sccmecextractor:latest \
sccmec-pipeline --fna-dir genomes/ -o results/
# With Bakta annotation
docker run --rm \
-v $PWD:/work \
-v ~/bakta_db:/data/bakta_db \
alisonmacfadyen/sccmecextractor:latest \
bash -c "
bakta --db /data/bakta_db genome.fna --output bakta_output --prefix genome && \
sccmec-pipeline -f genome.fna -g bakta_output/genome.gff3 -o results/
"
Singularity
# FASTA-only mode (simplest)
singularity exec \
--bind $PWD:/work \
sccmecextractor.sif \
sccmec-pipeline --fna-dir genomes/ -o results/
# With Bakta annotation
singularity exec \
--bind $PWD:/work \
--bind ~/bakta_db:/data/bakta_db \
sccmecextractor.sif \
bash -c "
bakta --db /data/bakta_db genome.fna --output bakta_output --prefix genome && \
sccmec-pipeline -f genome.fna -g bakta_output/genome.gff3 -o results/
"
How It Works
Attachment Site Detection
The tool searches for 24 DNA motif patterns (8 attR/cattR + 16 attL/cattL) representing the attachment sites that flank SCC elements. These patterns use regex with degeneracy to account for sequence variation across species. attR sites are anchored within the rlmH gene, which serves as the chromosomal integration site.
- attR/cattR: Right attachment sites (within rlmH), including CcrC-associated attR2/cattR2 and attR3/cattR3 variants
- attL/cattL: Left attachment sites, including multiple bridge-length variants (attL2-attL8) covering diverse ccr-mediated recombination products
Extraction Logic
- rlmH Detection: Locates the rlmH gene via GFF annotation or BLAST against a 70-species reference database
- Site Validation: attR sites must fall within or near rlmH (within 100 bp)
- Pair Selection: Identifies the closest attR-attL pair on the same contig
- ccr Validation: Verifies ccr genes are present between the att sites. Elements without ccr are classified as
no_ccr_element(not extracted) - Size Filtering: Rejects artefacts < 1,000 bp (pattern overlaps) and spurious matches > 200,000 bp
- Composite Detection: Identifies tandem/nested elements with multiple att site pairs (with
--composite) - Origin-Spanning Detection: Flags elements where chromosome linearisation splits the SCC across contig ends
- Fallback Extraction: When standard extraction fails, but attL is identified, fallback extraction is utilised using the location of rlmH as a proxy for attR
- Strand Awareness: Automatically handles reverse complement extraction when necessary
SCCmec Typing
sccmec-type performs three-tier classification via BLAST:
- mec complex class (A, B, C1, C2, D, E) — determined by mecA/mecC allotype, presence/absence of mecI, IS1272, IS431 and mecR1, and IS431 orientation. IS elements are only counted when within 10 kbp of mecA on the same contig
- ccr complex type (1-22) — determined by ccrA/ccrB pair and ccrC allotype combinations, incorporating IWG-SCC types 1-9 and Huang et al. 2024 types 10-22
- SCCmec type (I-XV) — assigned by combining mec class and ccr complex type. Unrecognised combinations are reported as
novel_combination
Output Format
Pipeline Output Directory Structure
results/
├── ambiguous_att_sites.tsv # Collates extraction-limited genomes that may be of interest
├── att_sites/ # att site locations (one TSV per genome)
│ └── *.tsv
├── sccmec/ # Extracted SCC element FASTAs
│ └── *_SCCmec.fasta
├── sccmec_unified_report.tsv # Full diagnostic report (extraction + typing merged)
└── sccmec_summary.tsv # Concise one-line-per-genome summary
Unified Report
The unified report (sccmec_unified_report.tsv) includes per-genome columns for extraction status, att site coordinates, element size, mec/ccr gene content, allotype classifications, mec complex class, ccr complex type, SCCmec type, mec context (location of mec genes relative to the extracted element) and typing source (sccmec or wgs).
A concise summary report (sccmec_summary.tsv) is also generated for quick screening of large datasets.
Troubleshooting
Common Issues
No att sites found:
May be genuine due to non-matching patterns, however:
- Verify that the input FASTA file is properly formatted
- If using GFF mode, ensure the GFF3 file corresponds to the same genome assembly
No rlmH gene found:
- In FASTA-only mode, rlmH is detected via BLAST. If your species has a highly divergent rlmH, provide a custom reference with
--rlmh-ref - In GFF mode, verify that gene annotation was performed correctly and rlmH is annotated as such
- The tool expects either the gene annotated as rlmH or the product is named "Ribosomal RNA large subunit methyltransferase H" (case-insenstive)
- rlmH is a conserved housekeeping gene — its absence may indicate an assembly issue
Missing attR-attL pairs (cross_contig):
- Caused by assembly fragmentation, the att sites are on different contigs
- Check the att site TSV output to see which sites were detected and on which contigs
- Long-read sequencing or hybrid assembly can improve extraction rates
Missing attR-attL pairs (right_only):
- Missing att pairs will most commonly occur due to a missing attL, therefore SCC elements cannot be extracted.
- This is a current limitation of the tool
BLAST+ not found:
- BLAST+ is required for FASTA-only mode (
--blast-rlmh), typing and ccr location checks - Install via conda:
conda install -c bioconda blast - BLAST+ is pre-installed in Docker and Singularity containers
Container-specific issues:
- See CONTAINER_GUIDE.md for troubleshooting Docker and Singularity problems
Warning Messages
The tools provide informative warning messages to help diagnose issues:
- Missing gene annotations
- Incomplete att site pairs
- File processing errors
Citation
If you use SCCmecExtractor in your research, please cite the bioRxiv Preprint::
MacFadyen, A.C. SCCmecExtractor: A tool for extracting Staphylococcal Cassette Chromosome elements from Whole Genome Sequences. bioRxiv 2026.03.31.715619; doi: https://doi.org/10.64898/2026.03.31.715619
License
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Contact
Email: alison.macfadyen86@gmail.com
Acknowledgments
Metadata
Release files for sccmecextractor 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sccmecextractor-1.6.0.tar.gz | 391.4 kB | With provenance | Details for sccmecextractor-1.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sccmecextractor-1.6.0-py3-none-any.whl | Python 3 | none | any | Details for sccmecextractor-1.6.0-py3-none-any.whl |
Total release size: 778.4 kB
Release files / sccmecextractor-1.6.0.tar.gz
| Download URL | sccmecextractor-1.6.0.tar.gz |
|---|---|
| Size | 391.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
277c24ec26e95637ee87b225ec6de559d58a28a8d7a2e1c1240e6a45d6411f87
|
|
BLAKE2b-256 checksum How to use checksums |
87085c81ffa51879eb4c137936f0aa65f997d50315794219e655b192a2239234
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logRelease files / sccmecextractor-1.6.0-py3-none-any.whl
| Download URL | sccmecextractor-1.6.0-py3-none-any.whl |
|---|---|
| Size | 387.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4608aaefa170118e79d6557ff73696e1f8a1f978e454e712e5ed2b444c29e568
|
|
BLAKE2b-256 checksum How to use checksums |
5ca9b310fed6356e9627709ba8a646166002cf92635a5da19c4b310659ec1906
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logSecurity for sccmecextractor 1.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sccmecextractor-1.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.