This repository contains notebooks, scripts and other helper files used in the work published at https://www.nature.com/articles/s41467-025-65102-6
Please note many paths are still hardcoded. I am slowly fixing this to point mainly to database file (see below) or otherwise indicate how to (re)generate the original file for analysis. Please open an issue if you have any inquiries.
Data generated in this work is available as a DuckDB database, or as parquet files, and is available at the IMG website or in Zenodo.
The database has the following tables:
duckdb soil_plasmids -c "SHOW TABLES"
- contig_qc → QC results for the metaG/metaT contigs
- taxon_metadata → various metadata associated with a taxon_oid, for instance ecosystem, Lat/Lon, number of plasmids, soil classification, soil attributes, etc.
- genomad_results_unfiltered → plasmids detected via geNomad before any kind of filtering described in the paper.
- genomad_results → filtered geNomad results as described in the paper.
- ptu_derep → plasmids dereplicated and clustered into pOTUs, with additional ecosystem and origin (Meta vs Isolate) information.
- hmm_outputs → plasmid protein annotations using HMMs from different databases (PFam, KEGG, NCBIFam, TIGRFam).
- host → plasmids with detected host, the host taxonomy and prediction method.
- iphop_blast_sources → for hosts predicted via iphop-BLAST, where is the source genome located (IMG, GTDB, etc).
- plasmid_num_genes → for each plasmid, how many genes were found and how many had prediction/annotations.
- conj_types → predicted conjugation machinery using CONJScan.
- plasmid_cripr → CRISPR detected in plasmids with cctyper.
- crispr_hits → Consolidated results based on BLAST hits of plasmid CRISPR spacers against GSPR plasmids and viruses.
- crispr_hits_assemblies → Consolidated results based on BLAST hits of soil contig spacers against GSPR plasmids and viruses.
- eggnog → annotations using EggNOG.
- amr → Antimicrobial Resistance Genes predicted with AMRFinderPlus
- bgc → Biosynthetic Gene Clusters predicted via AntiSMASH and consolidated with BiG-SCAPE.
- cog → COG categories and COG genes extracted from EggNOG results.
- cazy → Cazymes in plasmids, predicted via dbCAN.
- amp → Antimicrobial Peptides (AMPs) in plasmids, predicted via Macrel.
- *read_mapping → Read mapping results of 1623 metagenomes against all plasmids.
Analysis was done in several notebooks
- amp → Analysis of the Antimicrobial peptides results.
- amr_results → Analysis of the Antimicrobial resistance results.
- bgc → Analysis of the BGC results.
- cluster_analysis → Analysis of the pOTU clustering.
- cog → Analysis of the COG results.
- complete_size_host → Analysis of the correlations between host origin (Meta or Isolate), host size, plasmid origin and plasmid sizes.
- conjscan → Analysis of the CONJScan results (conjugation machinery).
- consolidate_metadata → Notebook that consolidates metadata from IMG/PR, MGnify, PLSDB and Refsoil, which results in the
taxon_metadatatable in the db. - contig_qc → Analysis of the Contig QC step, with exploratory analysis to select thresholds for some contig filters (such as
avg_kmerandconcatemer) as described in the manuscript. - dbcan → Analysis of the Cazymes results.
- eggnog → Analysis of the EggNOG results.
- filter_soil_rhizo_IMG → Notebook demonstrating the filters used to keep soil and rhizosphere samples from IMG metadata
- filter_soil_rhizo_MGnify → Same as above, but for MGnify.
- gtdb_plasmid_intersection → Analysis of soil species intersection between GTDB soil taxa and GSPR hosts.
- hosts → Analysis of the GSPR predicted hosts.
- hosts_environment → Analysis of which soil habitats GSPR predicted hosts are found, and comparison with which habitats the pOTUs are found.
- lengths → Analysis of plasmids sizes.
- meta_spacers → Analysis of CRISPRs in plasmids, their targets, CRISPRs in metaG contigs, etc.
- meta_spacers → Analysis of CRISPRs in plasmids, their targets, CRISPRs in metaG contigs, etc.
- phylo → Notebook to prune GTDB tree and prepare annotation files for decorating it.
- plasmid_annotation → Analysis of how many genes in plasmids had any annotation.
- plasmid_env → General analysis, such as which environments the pOTUs are found, enrichment analysis, PCA preparations, etc.
- plasmid_env_odds-fisher → Calculation of log-odds for plasmid functions.
- ptu_num_samples → Notebook to check the number of different samples (taxon_oids) per pOTU.
- select_soil_rhizo_samples_IMG_MGnify → Notebook to filter the exclusion terms out of the IMG and MGnify tables, and consolidate them.
Some figures and analysis was done in R, such as the PCA biplot, the map with the samples lat/lon, the rarefaction analysis and the GSEA. this folder contains the scripts for these analyses as well as the tables need to reproduce them. These tables were generated in the notebooks described above.
Contains the yml files to recreate the mamba environments used in this work