`sylph_stream()` is [sylph_runs()] without the download: instead of saving each run's reads to a file, it streams them from NCBI with `fastq-dump -Z –split-spot –skip-technical` (in `sra_env`) straight into `sylph sketch` (in `sylph_env`), and then profiles the sketch with `sylph profile`, so no reads are ever written to disk. It takes the same arguments as [sylph_runs()] (apart from `working_file`), writes the same profile files (`<outdir>/<run_accession>_profiling.tsv`), and returns the same result, and each skips profiles the other has made.
Usage
sylph_stream(
runs,
database = "../gtdb-r232-c200-dbv2.syl2db",
outdir = file.path("data", "sylph"),
threads = 6,
quiet = FALSE,
overwrite = FALSE,
sra_env = "sra_env",
sylph_env = "sylph_env"
)Arguments
- runs
A data frame with a `run_accession` column (SRR, ERR or DRR accessions), such as the output of [get_bioproject_runs()].
- database
Path to a sylph database (`.syldb`, or a two-stage `.syl2db`), passed to `sylph profile` with `-d`. Defaults to `"../gtdb-r232-c200-dbv2.syl2db"`. Pre-built databases are listed at <https://sylph-docs.github.io/pre%E2%80%90built-databases/>.
- outdir
Directory for the profile files. Created if needed.
- threads
Number of threads for `sylph`.
- quiet
If `TRUE`, hide the console output of `fastq-dump` and `sylph`. Defaults to `FALSE`.
- overwrite
If `TRUE`, profile runs whose profile file already exists again. If `FALSE` (the default), skip them.
- sra_env
Conda environment with the SRA Toolkit (see [setup_conda_sra()]).
- sylph_env
Conda environment with sylph (see [setup_conda_sylph()]).
Details
The reads reach sylph through a named pipe (FIFO) in a temporary directory, which sylph reads as if it were a reads file. See [smash_stream()] for when streaming helps.
Internet connection
The reads are downloaded while the tool runs, so a `*_stream()` function needs a steady internet connection for as long as each run is being processed, and is more likely than the `*_runs()` functions to fail if the connection is slow, drops out or is unreliable, or if NCBI is busy. A run whose stream is cut off fails (`fastq-dump`'s exit status fails the step) rather than being sketched, profiled or mapped from part of its reads; it is reported with a warning and recorded as `"failed"`, and the remaining runs still go ahead. Run the same call again to retry the failed runs; on an unreliable connection, the `*_runs()` functions, which finish each download before processing it, may be the better choice.
See also
[sylph_runs()], which downloads each run with `fasterq-dump` before profiling it, and [smash_stream()], [funprofiler_stream()] and [rgi_stream()].
Examples
if (FALSE) { # \dontrun{
runs <- get_bioproject_runs("PRJNA123456")
sylph_stream(runs, database = "../gtdb-r232-c200-dbv2.syl2db")
} # }