SKILL.md
Version Compatibility
Reference examples tested with: AMRFinderPlus 3.12+, pandas 2.2+
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.
AMR Surveillance
"Screen my isolates for resistance genes and track AMR trends" → Detect antimicrobial resistance determinants in bacterial genomes and monitor resistance patterns over time for surveillance programs.
- CLI:
amrfinder -n assembly.fasta --plus --organism Klebsiella
AMRFinderPlus
# Install AMRFinderPlus
conda install -c bioconda ncbi-amrfinderplus
# Update database
amrfinder -u
# Basic AMR detection from genome
amrfinder -n genome.fasta -o results.tsv
# With protein input (faster, more sensitive)
amrfinder -p proteins.faa -o results.tsv
# Specify organism for point mutations
amrfinder -n genome.fasta --organism Salmonella -o results.tsv
# Available organisms: Acinetobacter_baumannii, Campylobacter,
# Clostridioides_difficile, Enterococcus_faecalis, Enterococcus_faecium,
# Escherichia, Klebsiella, Neisseria, Pseudomonas_aeruginosa,
# Salmonella, Staphylococcus_aureus, Staphylococcus_pseudintermedius,
# Streptococcus_agalactiae, Streptococcus_pneumoniae, Streptococcus_pyogenes,
# Vibrio_cholerae
Parse AMRFinder Results
import pandas as pd
def parse_amrfinder(results_file):
'''Parse AMRFinderPlus output
Key columns:
- Gene symbol: AMR gene name
- Sequence name: Contig/protein where found
- Element type: AMR, STRESS, VIRULENCE
- Element subtype: AMR mechanism
- Class: Drug class affected
- Subclass: Specific drug affected
- % Coverage: Alignment coverage (>90% typical cutoff)
- % Identity: Sequence identity (>90% typical cutoff)
'''
df = pd.read_csv(results_file, sep='\t')
# Filter high-confidence hits
df = df[(df['% Coverage of reference sequence'] >= 90) &
(df['% Identity to reference sequence'] >= 90)]
return df
def summarize_amr_profile(results_df):
'''Summarize AMR profile by drug class'''
amr_only = results_df[results_df['Element type'] == 'AMR']
summary = {
'total_genes': len(amr_only),
'drug_classes': amr_only['Class'].nunique(),
'by_class': amr_only.groupby('Class')['Gene symbol'].apply(list).to_dict()
}
return summary
