The sra2lab package sets up and documents the conda environments used to find and download sequence data from the NCBI Sequence Read Archive (SRA) and to profile it. It also retrieves run-level SRA and BioSample metadata for a BioProject, and sketches SRA runs with sourmash (smash_runs()), profiles their taxa with sylph (sylph_runs()), or profiles their KEGG Orthology (KO) content with fmh-funprofiler (funprofiler_runs()), or finds their antibiotic resistance genes with the CARD Resistance Gene Identifier (rgi_runs()), one run at a time, so a whole BioProject can be processed without storing all of its reads locally. smash_stream(), sylph_stream(), funprofiler_stream() and rgi_stream() do the same without storing any reads at all, by streaming each run straight into the tool. smash_local(), sylph_local(), funprofiler_local() and rgi_local() do the same for paired-end reads you already have on disk, found by specimen ID, and multiprocess_runs() and multiprocess_local() run several of these pathways on each run or read pair in one pass.
| Tool | Setup | Document | Default env |
|---|---|---|---|
| SRA Toolkit + EDirect | setup_conda_sra() |
document_conda_sra() |
sra_env |
| sylph | setup_conda_sylph() |
document_conda_sylph() |
sylph_env |
| sourmash | setup_conda_sourmash() |
document_conda_sourmash() |
smash_env |
| fmh-funprofiler | setup_conda_funprofiler() |
document_conda_funprofiler() |
funprofiler_env |
| RGI (CARD Resistance Gene Identifier) | setup_conda_rgi() |
document_conda_rgi() |
rgi_env |
Installation
# install.packages("devtools")
devtools::install_github("bjklab/sra2lab", build_vignettes = TRUE)Vignettes
Four vignettes walk through complete workflows on a public BioProject (PRJNA1556220, skin and gut swab metagenomes), from setting up an analysis directory and conda environments to combining and plotting the results:
vignette("sylph-workflow", package = "sra2lab") # taxonomic profiling
vignette("funprofiler-workflow", package = "sra2lab") # functional profiling
vignette("rgi-workflow", package = "sra2lab") # antibiotic resistance genes
vignette("multiprocess-workflow", package = "sra2lab") # all three in one passA shorter vignette shows how to process local reads several specimens at a time, by running the *_local() functions on groups of specimens in parallel R sessions with furrr:
vignette("parallel-local", package = "sra2lab")They are built only if you install with build_vignettes = TRUE.
Requirements
sra2lab runs its tools through conda and downloads data from NCBI, so a few things must be in place outside R.
conda (all functions)
Every function needs conda, for example Miniconda. By default the package uses ~/miniconda3/bin/conda; if conda is installed elsewhere, point the package at it:
options(sra2lab.conda = "/path/to/conda")If conda can’t be found (via this option, ~/miniconda3/bin/conda, the CONDA_EXE environment variable or the PATH), the functions stop with an error saying so. conda_bin() shows which conda will be used.
conda environments (per function)
Each function runs its tools in a conda environment, which the matching setup_conda_*() function creates (see step 1):
Creating the environments downloads the tools from the conda-forge and bioconda channels; setup_conda_funprofiler() also installs fmh-funprofiler from GitHub with pip. The functions stop with an error naming the setup_conda_*() call to run if an environment is missing.
Reference databases (sylph, funprofiler and RGI)
sylph_runs(), funprofiler_runs() and rgi_runs() (and their *_local() versions) each need a reference database, which must be downloaded separately. None is installed by the package. Each function stops with an error before downloading any reads if its database isn’t found.
-
sylph_runs(): a sylph database. Pre-built databases (GTDB for bacteria and archaea, and others) are listed at https://sylph-docs.github.io/pre%E2%80%90built-databases/. The default,database = "../gtdb-r232-c200-dbv2.syl2db", expects the GTDB r232 two-stage database in the directory above your working directory. This file is several gigabytes; check that the download finished before using it, as sylph rejects an incomplete.syl2dbfile.Other useful GTDB files are on the GTDB downloads page, https://gtdb.ecogenomic.org/downloads. These include the bacterial and archaeal metadata tables, which give each genome’s GTDB taxonomy, quality and other details, and the bacterial and archaeal tree files. The metadata can be joined to sylph profiles by genome accession to add taxonomy: the accession is part of the
Genome_filecolumn (e.g.GCA_000437855.1), and appears in the metadata’saccessioncolumn with anRS_orGB_prefix (e.g.GB_GCA_000437855.1). The trees can be used for phylogenetic analyses of the profiles. Use the files from the same GTDB release as your sylph database (r232 for the default). funprofiler_runs(): a KEGG Orthology (KO) sketch. Pre-built KO sketches are at https://zenodo.org/records/10045253. The default,database = "../KOs_sketched_scaled_1000.sig.zip"(about 100 MB), expectsKOs_sketched_scaled_1000.sig.zipin the directory above your working directory; it has protein k = 7, 11 and 15 at scaled = 1000. Sketches at other scaled values are at https://zenodo.org/records/10981414.funprofiler_runs()checks that the database has each requestedkand thatscaledis not smaller than the database’s.rgi_runs(): CARD reference data, loaded with RGI. RGI needs CARD’s data annotated and loaded into alocalDBdirectory. The default,card_db = "../localDB", expects it in the directory above your working directory; see Antibiotic resistance genes with RGI for how to make it.rgi_runs()checks that it holds the data the chosen options need.
To use a database somewhere else, or a different one, pass its path as database (or card_db for RGI).
Network access and disk space
-
get_bioproject_runs()queries NCBI with EDirect, andsmash_runs(),sylph_runs()andfunprofiler_runs()download each run from the SRA withprefetchand extract its reads withfasterq-dump, so all of them need internet access. The*_local()functions work offline. See Notes for NCBI API keys. - Only one run’s reads are stored at a time, as
working_data.fastq.gzin the working directory, but while they are extracted there must be room for the largest run’s download, its reads, and the temporary filesfasterq-dumpwrites (several times the size of the download), all in aworking_data_srafolder next to it that is deleted afterwards. The signatures and profiles that are kept are small. -
working_file = "working_data.fastq"(no.gz) skips compressing the reads, which is faster if there is disk space for several times as much. With.gz, the reads are compressed withpigzonthreadsthreads (orgzipif pigz isn’t insra_env). On WSL2, work in the Linux file system (under~), not on a Windows drive under/mnt/, which is much slower. - The
*_stream()functions store no reads at all, but need a steady connection for as long as each run is processed; see Streaming instead of downloading.
Example Workflow
This example sketches the smallest runs of a public human gut metagenome BioProject, PRJNA1566796 (53 paired-end Illumina runs of about 20–820 MB each). Run it from your project directory: the environment files go to methods/, the sourmash signatures to data/smash/, the sylph profiles to data/sylph/ and the KO profiles to data/funprofiler/.
1. Set up the conda environments
library(sra2lab)
# SRA Toolkit (prefetch, fasterq-dump) + EDirect (esearch, efetch) + pigz, in sra_env
setup_conda_sra(yes = TRUE)
# sourmash, in smash_env
setup_conda_sourmash(yes = TRUE)
# sylph, in sylph_env (only needed for step 6)
setup_conda_sylph(yes = TRUE)
# fmh-funprofiler, in funprofiler_env (only needed for step 7)
setup_conda_funprofiler(yes = TRUE)yes = TRUE lets conda install without asking for confirmation. If an environment already exists, these calls stop with an error and leave it untouched; use overwrite = TRUE to remove and recreate it.
2. Document the environments
# print each environment's specification and save it for your methods:
# writes methods/sra_env.yml, methods/smash_env.yml, methods/sylph_env.yml
# and methods/funprofiler_env.yml
document_conda_sra(write_yml = TRUE)
document_conda_sourmash(write_yml = TRUE)
document_conda_sylph(write_yml = TRUE)
document_conda_funprofiler(write_yml = TRUE)Why document the environments? The document_conda_*() functions make the processing reproducible. setup_conda_*() installs the newest versions of the tools available on the day it runs, so the same setup code run later can give different versions of sourmash, sylph or their dependencies, and results can change with them. Each YAML file records the exact conditions an analysis ran under: the conda channels and every package in the environment, with its exact version and build. Saving these files with your project (and in version control, alongside your code and outputs) lets you:
- report the exact tool versions in a methods section;
- recreate the same environment later, or on another computer, with
conda env create -f methods/sra_env.yml; - check whether an environment has changed since an analysis was run, by documenting it again and comparing the files.
Document the environments when you set them up, and again whenever you update or recreate them (overwrite = TRUE), so the saved files always match the outputs they produced. The exported builds are specific to the operating system they were made on, so recreating an environment on a different system (e.g. macOS to Linux) may need some packages adjusted. Use dir to save the files somewhere other than methods/.
3. Get the run metadata for a BioProject
runs <- get_bioproject_runs("PRJNA1566796")
runs
#> # A tibble: 53 × 32
#> # ℹ 32 variables: run_accession <chr>, run_alias <chr>, spots <dbl>, ...
# run, experiment, library and sample columns, then one column per BioSample
# attribute given at submission (e.g. collection_date, host, geo_loc_name)
names(runs)
# keep the metadata alongside the signatures
dir.create("data", showWarnings = FALSE)
write.csv(runs, "data/PRJNA1566796_runs.csv", row.names = FALSE)get_bioproject_runs() runs esearch -db sra -query <bioproject> | efetch -format xml inside sra_env and returns one row per SRA run (SRR ID). Which BioSample attribute columns appear depends on what the submitters provided; for submissions made with lv2sra they include sample_name, sample_title, host, isolation_source, collection_date, geo_loc_name, lat_lon and host_subject_id.
4. Sketch the runs with sourmash
# pick the runs to sketch, e.g. shotgun metagenomes, smallest first
wgs <- runs[runs$library_strategy == "WGS", ]
wgs <- wgs[order(wgs$size), ]
to_sketch <- head(wgs, 2)
res <- smash_runs(to_sketch, k = 31, scaled = 1000, method = "abund", seed = 42)
#> [1/2] SRR41944128: downloading (prefetch) ...
#> [1/2] SRR41944128: extracting and compressing reads (fasterq-dump) ...
#> [1/2] SRR41944128: sketching ...
#> [1/2] SRR41944128: wrote data/smash/SRR41944128_k31_scale1000_seed42_abund.sig
#> [2/2] SRR41944112: downloading (prefetch) ...
#> [2/2] SRR41944112: extracting and compressing reads (fasterq-dump) ...
#> [2/2] SRR41944112: sketching ...
#> [2/2] SRR41944112: wrote data/smash/SRR41944112_k31_scale1000_seed42_abund.sig
#> Done: 2 sketched, 0 skipped, 0 failed.
res
#> # A tibble: 2 × 7
#> run_accession k scaled method signature status message
#> <chr> <dbl> <dbl> <chr> <chr> <chr> <chr>
#> 1 SRR41944128 31 1000 abund data/smash/SRR41944128_k31_scale1000_seed42_abund.sig sketched <NA>
#> 2 SRR41944112 31 1000 abund data/smash/SRR41944112_k31_scale1000_seed42_abund.sig sketched <NA>For each run in turn, smash_runs() downloads the run with prefetch, extracts its reads with fasterq-dump --split-spot (both mates of a pair in one file) into working_data.fastq.gz, sketches them with sourmash sketch dna -p k=31,scaled=1000,abund,seed=42, and writes data/smash/<SRR>_k31_scale1000_seed42_abund.sig, with the signature named after the run. The file name records the sketch parameters, so sketches of the same runs with other settings (e.g. method = "noabund") can be kept alongside. Only one run’s reads are on disk at a time, and working_data.fastq.gz is deleted at the end. The download and fasterq-dump’s temporary files also need space while the reads are extracted.
k, scaled and method each accept several values, and every combination gets its own signature file (and its own row in the result). For example,
smash_runs(to_sketch, k = c(21, 31), scaled = c(1000, 100),
method = c("abund", "noabund"))writes 2 × 2 × 2 = 8 files per run, from <SRR>_k21_scale1000_seed42_abund.sig to <SRR>_k31_scale100_seed42_noabund.sig. The reads are still downloaded and sketched once per run, and the sketches are then split into their files. seed takes a single value.
5. Check the results
# any runs that failed, and why
res[res$status == "failed", c("run_accession", "message")]
# join the signature paths back onto the metadata (runs sketched now, or
# skipped because their signature already existed)
sketched <- merge(runs, res[!is.na(res$signature), ], by = "run_accession")To sketch the rest of the BioProject, run smash_runs(wgs). Runs whose signature files already exist are skipped, so an interrupted job can be restarted with the same call (overwrite = TRUE sketches them again). Only finished files are skipped: an output left half-written by an interrupted, killed or crashed R session is made again (each function marks the outputs it is making with a hidden .<file>.incomplete file until they are written). A run that fails to download or sketch is reported with a warning, and the remaining runs still go ahead.
prefetch, fasterq-dump and sourmash print a lot of progress output; smash_runs(..., quiet = TRUE) hides it (the default is quiet = FALSE). If a step fails, the end of its output is kept in the result’s message column.
Streaming instead of downloading
Each *_runs() function that downloads reads has a *_stream() twin that never saves them: smash_stream(), sylph_stream(), funprofiler_stream() and rgi_stream() stream each run from the SRA with fastq-dump -Z --split-spot --skip-technical straight into the tool. They take the same arguments as their *_runs() twins (apart from working_file), write the same output files, and skip each other’s outputs. smash_stream() pipes the reads into sourmash sketch dna; the others pass them to the tool through a named pipe (FIFO), which it reads as if it were a reads file.
res <- smash_stream(data.frame(run_accession = "SRR41520878"),
k = c(21, 31), quiet = TRUE)
#> [1/1] SRR41520878: streaming and sketching ...
#> [1/1] SRR41520878: wrote data/smash/SRR41520878_k21_scale1000_seed42_abund.sig, data/smash/SRR41520878_k31_scale1000_seed42_abund.sig
#> Done: 2 sketched, 0 skipped, 0 failed.They need no space for reads, which helps when disk space is short, and their results match the *_runs() functions’. For this run (a 378 MB perirectal swab metagenome from PRJNA1556220), smash_stream() and smash_runs() gave the same hashes and abundances at k = 21 and k = 31. Streaming the same run took about 6 minutes with smash_stream(), 8.5 with sylph_stream(), 7 with funprofiler_stream() and 6.5 with rgi_stream(). sylph_stream() and funprofiler_stream() gave profiles identical to sylph_runs()’s and funprofiler_runs()’s. rgi_stream() found the same 133 genes as rgi_runs(), with the same total read count and the same completely mapped reads for every gene, but 39 genes had 1–3 more reads with flanking sequence. That is ordinary run-to-run variation in rgi bwt, not streaming: mapping the same file several times gives the same small differences in that column.
Streaming needs a steady internet connection. The reads are downloaded while the tool runs, so the *_stream() functions are more likely to fail than the *_runs() functions if the connection is slow, drops out or is unreliable, or if NCBI is busy. A run whose stream is cut off fails, rather than being processed from part of its reads, and is recorded as "failed"; run the same call again to retry it. On an unreliable connection, use the *_runs() functions, which finish each download before processing it. Also, fastq-dump is single-threaded, so for large runs on a fast connection the *_runs() functions can be quicker, and a stream can only be read once, so with several k and scaled combinations (funprofiler_stream()) or aligners (rgi_stream()), each run is streamed once per combination.
6. Profile the runs with sylph
sylph_runs() works the same way as smash_runs(), but profiles each run against a sylph database, such as one of the pre-built databases (see Reference databases). By default it looks for ../gtdb-r232-c200-dbv2.syl2db, one directory above the working directory.
prof <- sylph_runs(to_sketch, database = "../gtdb-r232-c200-dbv2.syl2db",
threads = 6)
#> [1/2] SRR41944128: downloading (prefetch) ...
#> [1/2] SRR41944128: extracting and compressing reads (fasterq-dump) ...
#> [1/2] SRR41944128: profiling ...
#> [1/2] SRR41944128: wrote data/sylph/SRR41944128_profiling.tsv
#> [2/2] SRR41944112: downloading (prefetch) ...
#> [2/2] SRR41944112: extracting and compressing reads (fasterq-dump) ...
#> [2/2] SRR41944112: profiling ...
#> [2/2] SRR41944112: wrote data/sylph/SRR41944112_profiling.tsv
#> Done: 2 profiled, 0 skipped, 0 failed.
# one table with every run's profile; Sample_file holds the run accession
profiles <- do.call(rbind, lapply(prof$profile[!is.na(prof$profile)],
read.delim))For each run in turn, sylph_runs() downloads the reads into working_data.fastq.gz as above, sketches them with sylph sketch -r working_data.fastq.gz -S <SRR>, profiles the sketch with sylph profile -d <database>, and writes data/sylph/<SRR>_profiling.tsv. The reads and the sample sketch are deleted afterwards. Runs whose profile already exists are skipped (unless overwrite = TRUE), failed runs are reported and the rest still go ahead, and quiet = TRUE hides the tools’ output, just as for smash_runs().
7. Profile KEGG Orthologs with fmh-funprofiler
funprofiler_runs() works the same way again, but gives each run a functional profile: the KEGG Orthology groups (KOs) found in its reads, with their relative abundances. It needs a KO reference sketch, such as KOs_sketched_scaled_1000.sig.zip from Zenodo (see Reference databases); by default it looks for ../KOs_sketched_scaled_1000.sig.zip.
ko <- funprofiler_runs(to_sketch, database = "../KOs_sketched_scaled_1000.sig.zip",
k = 11, scaled = 1000)
#> [1/2] SRR41944128: downloading (prefetch) ...
#> [1/2] SRR41944128: extracting and compressing reads (fasterq-dump) ...
#> [1/2] SRR41944128: profiling (k=11, scaled=1000) ...
#> [1/2] SRR41944128: wrote data/funprofiler/SRR41944128_k11_scale1000_ko_profiles.csv
#> ...
#> Done: 2 profiled, 0 skipped, 0 failed.
# one table with every run's KO profile
kos <- do.call(rbind, lapply(seq_len(nrow(ko)), function(i) {
p <- read.csv(ko$profile[i])
if (nrow(p)) cbind(run_accession = ko$run_accession[i], p)
}))For each run, funprofiler_runs() downloads the reads into working_data.fastq.gz as above and runs funcprofiler working_data.fastq.gz <database> <k> <scaled> <output>, which translates and sketches the reads with sourmash and compares them with the KO sketches. Each profile, a CSV file with columns ko_id and abundance, is written to data/funprofiler/<SRR>_k<k>_scale<scaled>_ko_profiles.csv. k is the protein k-mer size (7, 11 or 15 for the pre-built sketches), and several values of k or scaled give one profile per combination. threshold_bp (default 1000) sets the minimum overlap for a KO to be reported. The intermediate sketch and sourmash prefetch files are deleted after each run. Before downloading anything, funprofiler_runs() checks that the database has protein sketches for each k and that no scaled is smaller than the database’s, and stops with an error if not (funcprofiler itself would just write empty or mis-scaled profiles).
Local reads
smash_local(), sylph_local() and funprofiler_local() work like their *_runs() counterparts, but on paired-end reads already on disk. They take a table with a specimen_id column and the directory holding the FASTQ files, find each specimen’s R1 and R2 files, and write the same outputs with the specimen ID in place of the SRR ID:
specimens <- tibble::tibble(specimen_id = c("S-240926-01587", "S-240926-01588"))
# data/smash/S-240926-01587_k31_scale1000_seed42_abund.sig, ...
sigs <- smash_local(specimens, local_files = "fastq")
#> Specimen matches with fastq:
#> specimens with files found: 2 of 2 (100.0%)
#> file stems matching a specimen: 2 of 2 (100.0%)
#> [1/2] S-240926-01587: reading S-240926-01587_S294_R1_001.fastq.gz + S-240926-01587_S294_R2_001.fastq.gz
#> [1/2] S-240926-01587: sketching ...
#> ...
# data/sylph/S-240926-01587_profiling.tsv, ...
prof <- sylph_local(specimens, local_files = "fastq")
# data/funprofiler/S-240926-01587_k11_scale1000_ko_profiles.csv, ...
ko <- funprofiler_local(specimens, local_files = "fastq")Read files are matched to specimens as in lv2sra. They are recognized by their _R1/_R2 designator (optionally followed by _001, then .fastq or .fq, optionally gzipped), and a file belongs to a specimen when the text before _R1/_R2 is the specimen ID, alone or followed by _ and anything else. So S-240926-01587_S294_R1_001.fastq.gz belongs to S-240926-01587, but S-10_R1.fastq.gz does not belong to S-1. Matching is case-sensitive, and - and _ are not interchangeable.
Downstream, smash_local() sketches R1 and R2 together into one signature named after the specimen; sylph_local() sketches them as a read pair (sylph sketch -1 R1 -2 R2); and funprofiler_local() joins them into working_data.fastq.gz (deleted afterwards) because funcprofiler takes one reads file. Specimens without both read files are reported and recorded as "failed"; the rest still go ahead. The local read files are never changed.
Several pathways at once
multiprocess_runs() and multiprocess_local() run any combination of the sourmash, sylph, funprofiler and RGI pathways on each sample, so each SRA run is downloaded (or each local read pair found) only once:
# sourmash signatures and sylph profiles from one download per run
res <- multiprocess_runs(to_sketch, process_path = c("smash", "sylph"))
#> [1/2] SRR41944128: downloading (prefetch) ...
#> [1/2] SRR41944128: extracting and compressing reads (fasterq-dump) ...
#> [1/2] SRR41944128: sketching ...
#> [1/2] SRR41944128: profiling ...
#> [1/2] SRR41944128: wrote data/smash/SRR41944128_k31_scale1000_seed42_abund.sig, data/sylph/SRR41944128_profiling.tsv
#> ...
#> Done: 2 sketched, 2 profiled, 0 skipped, 0 failed.
# the default three, for local read pairs
res <- multiprocess_local(specimens, local_files = "fastq",
process_path = c("smash", "sylph", "funprofiler"))
# all four, including antibiotic resistance genes with RGI
res <- multiprocess_runs(
to_sketch, process_path = c("smash", "sylph", "funprofiler", "rgi")
)The pathways run in the order given in process_path, and write exactly the same files as smash_runs(), sylph_runs(), funprofiler_runs() and rgi_runs() (or the *_local() functions), so outputs made one way are skipped the other. The default process_path is the first three; add "rgi" to map reads to CARD as well (which needs CARD’s data loaded, see Antibiotic resistance genes with RGI). Arguments that differ between tools carry the pathway’s name: smash_k, smash_scaled, smash_method and seed for sourmash; sylph_database for sylph; funprofiler_database, funprofiler_k, funprofiler_scaled and threshold_bp for funprofiler; rgi_card_db, rgi_aligner, rgi_include_wildcard, rgi_include_other_models and rgi_keep_bam for RGI; and smash_outdir, sylph_outdir, funprofiler_outdir and rgi_outdir. The result has one row per sample and output file, with a process column naming the pathway. If one pathway fails for a sample, the others still run; if the download fails, all of that sample’s outputs fail.
Antibiotic resistance genes with RGI
rgi_runs() and rgi_local() find antibiotic resistance genes in reads by mapping them to the Comprehensive Antibiotic Resistance Database (CARD) with RGI’s read-mapping command, rgi bwt.
First set up the environment and load CARD’s data. RGI looks for its data in a localDB directory, so load it once, in the directory above your analysis directories (next to the sylph and KO databases):
cd .. # the directory above the analysis
wget https://card.mcmaster.ca/latest/data
tar -xvf data ./card.json
conda run -n rgi_env rgi card_annotation -i card.json
conda run -n rgi_env rgi load -i card.json --local \
--card_annotation card_database_v4.0.2.fasta \
--card_annotation_all_models card_database_v4.0.2_all.fasta(rgi card_annotation names its files after the CARD version, here 4.0.2.) Then, from the analysis directory:
setup_conda_rgi(yes = TRUE) # once
document_conda_rgi(write_yml = TRUE) # methods/rgi_env.yml
res <- rgi_runs(to_sketch) # card_db = "../localDB"
#> [1/2] SRR41944128: downloading (prefetch) ...
#> [1/2] SRR41944128: extracting and compressing reads (fasterq-dump) ...
#> [1/2] SRR41944128: mapping reads to CARD (kma) ...
#> [1/2] SRR41944128: wrote data/rgi/SRR41944128_kma.gene_mapping_data.txt
#> ...
genes <- read.delim(res$gene_mapping[1], check.names = FALSE)For each run, rgi_runs() writes rgi bwt’s results to data/rgi/, named <SRR>_<aligner>[_wildcard][_other_models].<output>. The main result is gene_mapping_data.txt (reads mapped to each resistance gene), alongside allele-level results and mapping statistics. The options are those of rgi bwt: aligner ("kma", RGI’s recommendation, or "bowtie2" or "bwa"), include_wildcard (also map to CARD’s Resistomes & Variants data, which must be loaded too) and include_other_models (also map to CARD’s variant, rRNA, knockout and overexpression models). The read alignments (BAM) are deleted unless keep_bam = TRUE; RGI suggests them for normalized abundance, since rgi bwt reports raw read counts.
RGI’s Perfect/Strict/Loose criteria, the nudge of Loose hits to Strict, and the sequence quality setting (the options of RGI’s web portal) belong to rgi main, which analyses assembled contigs or proteins rather than reads, so they don’t apply here.
Notes
-
sra_envenvironments created before EDirect was added can be rebuilt withsetup_conda_sra(overwrite = TRUE). - NCBI limits requests without an API key to 3 per second. EDirect uses the key in the
NCBI_API_KEYenvironment variable when it is set, and sends the address inEMAIL(otherwise<username>@<hostname>) with each request. Both can be set in~/.Renviron. - EDirect may print
curl ... unexpected eofmessages when NCBI drops a connection; it retries on its own, so these can usually be ignored.
Citing the tools
If you use sra2lab to sketch or profile reads, please cite the tools it runs:
-
sourmash (
smash_runs()andsmash_local(); fmh-funprofiler also uses sourmash to sketch and compare reads):- Pierce NT, Irber L, Reiter T, Brooks P, Brown CT. Large-scale sequence comparisons with sourmash. F1000Research. 2019;8:1006. https://doi.org/10.12688/f1000research.19675.1
- Irber L, Pierce-Ward NT, Abuelanin M, et al. sourmash v4: A multitool to quickly search, compare, and analyze genomic and metagenomic data sets. Journal of Open Source Software. 2024;9(98):6830. https://doi.org/10.21105/joss.06830
-
sylph (
sylph_runs(),sylph_local()):- Shaw J, Yu YW. Rapid species-level metagenome profiling and containment estimation with sylph. Nature Biotechnology. 2025;43(8):1348–1359. https://doi.org/10.1038/s41587-024-02412-y
-
fmh-funprofiler (
funprofiler_runs(),funprofiler_local()):- Hera MR, Liu S, Wei W, Rodriguez JS, Ma C, Koslicki D. Metagenomic functional profiling: to sketch or not to sketch? Bioinformatics. 2024;40(Suppl 2):ii165–ii173. https://doi.org/10.1093/bioinformatics/btae397
-
RGI and CARD (
rgi_runs(),rgi_local()):- Alcock BP, Huynh W, Chalil R, et al. CARD 2023: expanded curation, support for machine learning, and resistome prediction at the Comprehensive Antibiotic Resistance Database. Nucleic Acids Research. 2023;51(D1):D690–D699. https://doi.org/10.1093/nar/gkac920
multiprocess_runs() and multiprocess_local() use the tools above that are named in process_path.