SKILL.md
Version Compatibility
Reference examples tested with: mlst 2.23+, numpy 1.26+, pandas 2.2+, scanpy 1.10+, scipy 1.12+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures - CLI:
<tool> --versionthen<tool> --helpto confirm flags
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Pathogen Typing
"Type my bacterial isolates by MLST" → Assign multi-locus sequence types to bacterial genomes for isolate characterization, outbreak clone identification, and strain tracking.
- CLI:
mlst assembly.fastafor 7-gene MLST typing - CLI:
chewBBACA.py AlleleCallfor core genome MLST (cgMLST)
MLST with mlst Tool
# Install mlst
conda install -c bioconda mlst
# Basic MLST typing
mlst genome.fasta
# Output: genome.fasta ecoli ST131 adk(53) fumC(40) gyrB(47) ...
# Batch typing
mlst *.fasta > typing_results.tsv
# Specify scheme
mlst --scheme senterica genome.fasta
# List available schemes
mlst --list
# Include allele sequences in output
mlst --csv genome.fasta > results.csv
Parse MLST Results
import pandas as pd
import subprocess
def run_mlst(fasta_files, scheme=None):
'''Run MLST on multiple genomes
Returns DataFrame with:
- Sample name
- Scheme (auto-detected or specified)
- Sequence type (ST)
- Allele profiles
ST interpretation:
- Known ST: Matches existing type in database
- Novel allele: New allele combination, may be unreported ST
- Failed: Unable to determine (poor assembly or wrong scheme)
'''
cmd = ['mlst'] + fasta_files
if scheme:
cmd.extend(['--scheme', scheme])
result = subprocess.run(cmd, capture_output=True, text=True)
lines = result.stdout.strip().split('\n')
data = [line.split('\t') for line in lines]
return pd.DataFrame(data, columns=['file', 'scheme', 'ST'] +
[f'locus{i}' for i in range(1, len(data[0])-2)])
