| Title: | Preprocessing Public HT-SELEX Sequencing Data |
|---|---|
| Description: | Provides reproducible preprocessing for high-throughput SELEX sequencing data. Supports primer inference, extraction of random regions, sparse sequence counting across rounds, quality control, and provenance manifests. Public-study discovery and checksum-aware ENA FASTQ download planning are included for reproducible data acquisition. |
| Authors: | Marco Rotanegroni [aut, cre] |
| Maintainer: | Marco Rotanegroni <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.99.3 |
| Built: | 2026-07-12 15:44:18 UTC |
| Source: | https://github.com/BiocStaging/selexprepR |
Builds a versioned selexprep_manifest_v2 object. The reader also accepts
the historical Python selexprep_manifest_v1 schema, so existing analysis
records remain inspectable. Hashes are computed for every supplied existing
path and are keyed relative to input_root or output_root when supplied.
build_selexprep_manifest( library_report, input_paths = character(), output_paths = character(), accession = NULL, bioproject_id = NULL, runs = character(), parameters = character(), runtime_seconds_per_stage = numeric(), flags = character(), input_root = NULL, output_root = NULL )build_selexprep_manifest( library_report, input_paths = character(), output_paths = character(), accession = NULL, bioproject_id = NULL, runs = character(), parameters = character(), runtime_seconds_per_stage = numeric(), flags = character(), input_root = NULL, output_root = NULL )
library_report |
A |
input_paths |
Existing input file paths to hash. |
output_paths |
Existing output file paths to hash. |
accession |
Optional public accession. |
bioproject_id |
Optional BioProject accession. |
runs |
Run accessions. |
parameters |
Named character parameters used for the run. |
runtime_seconds_per_stage |
Named numeric stage durations. |
flags |
Character QC flag names. |
input_root |
Optional root used to make input hash keys relative. |
output_root |
Optional root used to make output hash keys relative. |
A validated selexprep_manifest.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) build_selexprep_manifest(report)p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) build_selexprep_manifest(report)
Creates a deterministic, checksum-aware download plan from an existing
inspection or an accession. By default no bytes are transferred; set
dry_run = FALSE to download to outdir. Each completed file is checked
against ENA's MD5 value when one is supplied.
fetch_selexprep_reads( accession_or_inspection, outdir, dry_run = TRUE, overwrite = FALSE, timeout_seconds = 30, require_assigned_rounds = TRUE, overrides = numeric() )fetch_selexprep_reads( accession_or_inspection, outdir, dry_run = TRUE, overwrite = FALSE, timeout_seconds = 30, require_assigned_rounds = TRUE, overrides = numeric() )
accession_or_inspection |
A character accession or a
|
outdir |
Destination directory for downloaded FASTQ files. |
dry_run |
Whether to return the plan without downloading. |
overwrite |
Whether an existing destination file may be replaced. |
timeout_seconds |
Positive timeout for metadata and FASTQ requests. |
require_assigned_rounds |
Whether to refuse ambiguous or missing round assignments before creating a download plan. |
overrides |
Optional named integer mapping of run accessions to manually curated round numbers. |
A selexprep_fetch_result list containing the run-level $plan,
$downloaded_files, and $dry_run.
inspection <- inspect_selexprep_accession('PRJDB19098') fetch_selexprep_reads(inspection, 'raw/PRJDB19098')inspection <- inspect_selexprep_accession('PRJDB19098') fetch_selexprep_reads(inspection, 'raw/PRJDB19098')
Applies a conservative, ordered metadata cascade: structured sample attributes, sample title, library name, experiment title, and design description. A run remains unsafe when no round is found or when one field contains conflicting candidates. The function records evidence rather than using enrichment signals to repair metadata.
infer_selexprep_rounds(runs, overrides = numeric())infer_selexprep_rounds(runs, overrides = numeric())
runs |
A data frame or |
overrides |
Optional named integer vector mapping run accessions to manually curated round numbers. |
A S4Vectors::DataFrame with one conservative round assignment per
run. round_candidates is a list-column and preserves ambiguity.
runs <- data.frame( run_accession = c('SRR1', 'SRR2'), sample_title = c('Thrombin Round 1', 'Thrombin Round 2') ) infer_selexprep_rounds(runs)runs <- data.frame( run_accession = c('SRR1', 'SRR2'), sample_title = c('Thrombin Round 1', 'Thrombin Round 2') ) infer_selexprep_rounds(runs)
Queries ENA's read-run filereport endpoint without downloading sequence data.
The returned selexprep_inspection retains verbatim library strategy/source
metadata and one row per run with its FASTQ URLs, sizes, and MD5 checksums.
inspect_selexprep_accession(accession, timeout_seconds = 30)inspect_selexprep_accession(accession, timeout_seconds = 30)
accession |
Study- or run-level ENA/INSDC accession. |
timeout_seconds |
Positive network timeout in seconds. |
A selexprep_inspection list with a run-level
S4Vectors::DataFrame in $runs.
inspection <- inspect_selexprep_accession('PRJDB19098') inspection$runsinspection <- inspect_selexprep_accession('PRJDB19098') inspection$runs
Renders an R-native diagnostic surface corresponding to the four QC
artifacts produced by the original Python workflow. Read retention and its
primer-match proxy use extraction provenance from y. Sequence lengths are
shown as read-weighted, per-round fractions so rounds with different depths
remain comparable. The diversity view contains unique counts, Shannon
entropy, and top-100 coverage.
## S3 method for class 'selexprep_qc' plot( x, y = NULL, which = c("retention", "primer_match", "length", "diversity"), ... )## S3 method for class 'selexprep_qc' plot( x, y = NULL, which = c("retention", "primer_match", "length", "diversity"), ... )
x |
A |
y |
Optional |
which |
One or more diagnostic groups: |
... |
Named graphical parameters passed to |
When y is omitted, summaries already retained in x are still plotted.
Panels that require raw counts or extraction provenance state that the data
are unavailable instead of reconstructing them from incomplete summaries.
x, invisibly.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' pools <- list(round_00 = rep(paste0(p5, 'ACGTACGT', p3), 500)) result <- run_selexprep(pools, low_total_reads = 0) plot(S4Vectors::metadata(result)$qc, result, which = 'diversity')p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' pools <- list(round_00 = rep(paste0(p5, 'ACGTACGT', p3), 500)) result <- run_selexprep(pools, low_total_reads = 0) plot(S4Vectors::metadata(result)$qc, result, which = 'diversity')
Read a LibraryReport JSON file
read_library_report(path)read_library_report(path)
path |
Path to a JSON file written by |
A validated selexprep_library_report.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) path <- tempfile(fileext = '.json') write_library_report(report, path) read_library_report(path)p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) path <- tempfile(fileext = '.json') write_library_report(report, path) read_library_report(path)
Reads the stable four-column count contract (sequence, reads, rank,
rpm) from TSV, CSV, RDS, or Parquet. Parquet support is optional and
requires arrow; TSV is the portable default for R-native workflows.
read_selexprep_counts(path)read_selexprep_counts(path)
path |
Path to a |
A validated S4Vectors::DataFrame with a
Biostrings::BStringSet sequence column.
path <- tempfile(fileext = '.tsv') write_selexprep_counts(selexprep_count(c('ACGT', 'ACGT', 'GGGG')), path) read_selexprep_counts(path)path <- tempfile(fileext = '.tsv') write_selexprep_counts(selexprep_count(c('ACGT', 'ACGT', 'GGGG')), path) read_selexprep_counts(path)
Reads a plain or gzip-compressed FASTQ file into a Biostrings::BStringSet.
BStringSet deliberately preserves both DNA and RNA alphabets, avoiding the
loss of uracil that would occur when every input is coerced to DNA.
read_selexprep_fastq(path, max_reads = NULL)read_selexprep_fastq(path, max_reads = NULL)
path |
Path to a FASTQ or FASTQ.gz file. |
max_reads |
Optional positive maximum number of records to retain. |
A Biostrings::BStringSet of read sequences.
path <- tempfile(fileext = '.fastq') writeLines(c('@read_1', 'ACGU', '+', 'IIII'), path) read_selexprep_fastq(path)path <- tempfile(fileext = '.fastq') writeLines(c('@read_1', 'ACGU', '+', 'IIII'), path) read_selexprep_fastq(path)
Converts local FASTQ paths or a completed ENA fetch result into the R-native
inputs used by run_selexprep(). Files belonging to the same round and mate
are concatenated in input-table order. Plain and gzip-compressed FASTQ files
are supported through read_selexprep_fastq().
read_selexprep_inputs(x, round = NULL, mate = NULL, max_reads_per_file = NULL)read_selexprep_inputs(x, round = NULL, mate = NULL, max_reads_per_file = NULL)
x |
A character vector of FASTQ paths, a data frame-like object with
|
round |
Optional vector of non-negative round numbers. It is required for character paths unless their vector names end in round numbers. |
mate |
Optional vector containing |
max_reads_per_file |
Optional positive maximum number of records read from each FASTQ file. |
Mate labels are inferred conservatively from conventional _R1, _R2,
_1, and _2 filename suffixes. Files without a mate suffix are treated as
single-end only when no R2 file is present. Paired inputs must have both
mates, with equal loaded read counts, in every round.
A selexprep_read_inputs list with sequences_by_round, optional
paired_mate_streams, read_source, and a file-level DataFrame named
files. The first three elements can be passed directly to
run_selexprep(), or use run_selexprep_files().
path <- tempfile(fileext = '.fastq') writeLines(c('@read_1', 'ACGT', '+', 'IIII'), path) inputs <- read_selexprep_inputs(path, round = 0) inputs$sequences_by_roundpath <- tempfile(fileext = '.fastq') writeLines(c('@read_1', 'ACGT', '+', 'IIII'), path) inputs <- read_selexprep_inputs(path, round = 0) inputs$sequences_by_round
Reads and validates both the portable Python selexprep_manifest_v1 format
and the R-native selexprep_manifest_v2 format.
read_selexprep_manifest(path)read_selexprep_manifest(path)
path |
Path to a selexprep manifest JSON file. |
A validated selexprep_manifest.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) path <- tempfile(fileext = '.json') write_selexprep_manifest(build_selexprep_manifest(report), path) read_selexprep_manifest(path)p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) path <- tempfile(fileext = '.json') write_selexprep_manifest(build_selexprep_manifest(report), path) read_selexprep_manifest(path)
This function reproduces the sequence-counting behavior of the Python
implementation. It accepts DNA or RNA bases, keeps input case, maps U/u to
A/a, and preserves ambiguous bases such as N/n. It is vectorized over
sequence.
reverse_complement(sequence)reverse_complement(sequence)
sequence |
A character vector of nucleotide sequences without missing values. |
A character vector of reverse-complemented sequences.
reverse_complement(c('ACGT', 'ACGU', 'ANNT'))reverse_complement(c('ACGT', 'ACGU', 'ANNT'))
Composes primer detection, extraction, sequence counting and quality control
into a single Bioconductor result. The primary output is a
SummarizedExperiment with one column per round and a sparse counts
assay. The LibraryReport, extraction result and QC report are retained in
metadata() for reproducibility and inspection.
run_selexprep( sequences_by_round, read_source = c("R1", "R2", "R1_AND_R2", "INTERLEAVED", "UNKNOWN"), paired_mate_streams = NULL, accession = NULL, sampling_seed = 42L, max_reads_per_round = NULL, low_total_reads = 10000L, primer_5p = NULL, primer_3p = NULL, extraction_mode = NULL )run_selexprep( sequences_by_round, read_source = c("R1", "R2", "R1_AND_R2", "INTERLEAVED", "UNKNOWN"), paired_mate_streams = NULL, accession = NULL, sampling_seed = 42L, max_reads_per_round = NULL, low_total_reads = 10000L, primer_5p = NULL, primer_3p = NULL, extraction_mode = NULL )
sequences_by_round |
A named list of R1 pools, as accepted by
|
read_source |
Input read layout. |
paired_mate_streams |
Optional named R2 pools. |
accession |
Optional public-study accession stored in metadata. |
sampling_seed |
Seed forwarded to |
max_reads_per_round |
Optional detection subsampling cap. |
low_total_reads |
QC threshold for per-round read depth. |
primer_5p |
Optional manually reviewed 5-prime primer override. |
primer_3p |
Optional manually reviewed 3-prime primer override. |
extraction_mode |
Optional manually reviewed extraction-mode override. |
Split-primer paired-end inputs return a valid zero-row experiment because
full inserts cannot be counted without read merging. Their separate trimmed
sides remain available in metadata(result)$extraction.
A SummarizedExperiment with the LibraryReport, extraction and QC
result in its metadata.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' pools <- list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500)) run_selexprep(pools, low_total_reads = 0)p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' pools <- list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500)) run_selexprep(pools, low_total_reads = 0)
Convenience bridge combining read_selexprep_inputs() and
run_selexprep(). File-level provenance is attached to
metadata(result)$input_files.
run_selexprep_files( x, round = NULL, mate = NULL, max_reads_per_file = NULL, ... )run_selexprep_files( x, round = NULL, mate = NULL, max_reads_per_file = NULL, ... )
x |
A character vector of FASTQ paths, a data frame-like object with
|
round |
Optional vector of non-negative round numbers. It is required for character paths unless their vector names end in round numbers. |
mate |
Optional vector containing |
max_reads_per_file |
Optional positive maximum number of records read from each FASTQ file. |
... |
Named arguments forwarded to |
A SummarizedExperiment as returned by run_selexprep().
experiment <- run_selexprep_files( c(round_00 = 'round_00.fastq.gz', round_01 = 'round_01.fastq.gz') )experiment <- run_selexprep_files( c(round_00 = 'round_00.fastq.gz', round_01 = 'round_01.fastq.gz') )
Returns the curated catalog snapshot distributed with the package. The optional text query is matched case-insensitively against the BioProject ID, study title, and target, making it useful for discovery while leaving raw metadata values intact.
selexprep_catalog(query = NULL)selexprep_catalog(query = NULL)
query |
Optional non-empty search string. |
An S4Vectors::DataFrame of curated study metadata.
selexprep_catalog('FGF-9')selexprep_catalog('FGF-9')
Counts the observed sequences in one primer-stripped SELEX round. The
result is a S4Vectors::DataFrame compatible with the stable Python output
schema: sequence, reads, rank, and rpm. The sequence column is a
Biostrings::BStringSet so that both DNA and RNA alphabets can be carried
without lossy coercion.
selexprep_count(sequences)selexprep_count(sequences)
sequences |
A character vector or a |
Ties in abundance are ordered lexicographically by sequence. The original Python implementation does not define a tie-breaker; making it explicit in R provides reproducible ranks across platforms.
A S4Vectors::DataFrame with sequence, reads, rank, and rpm
columns, ordered by decreasing read count.
selexprep_count(c('ACGT', 'ACGT', 'GGGG'))selexprep_count(c('ACGT', 'ACGT', 'GGGG'))
Assigns reads to selection rounds from an equal-length barcode at the R1 5-prime end. Barcode sequences are supplied explicitly; they are never inferred. R2 mates follow their R1 assignment and remain untrimmed.
selexprep_demultiplex( sequences, barcodes, paired_mates = NULL, max_mismatches = 1L, trim_barcode = TRUE )selexprep_demultiplex( sequences, barcodes, paired_mates = NULL, max_mismatches = 1L, trim_barcode = TRUE )
sequences |
R1 sequences as a character vector or
|
barcodes |
Named integer vector mapping barcode sequences to
non-negative round numbers, for example |
paired_mates |
Optional R2 sequences in the same order as |
max_mismatches |
Maximum Hamming distance allowed from a barcode. |
trim_barcode |
Whether to remove the matched barcode from assigned R1 sequences. |
Barcodes must have pairwise Hamming distance of at least
2 * max_mismatches + 1, preventing ambiguous assignments. RNA U and DNA
T are treated as equivalent during matching.
A selexprep_demultiplex object. Its first four fields follow the
selexprep_read_inputs contract and can be supplied directly to
run_selexprep(). Additional fields contain unassigned reads, a summary,
and the validated barcode map.
reads <- c("AAAAACCCCC", "AAAATGGGGG", "TTTTTACGTA", "GGGGGAAAAA") demultiplexed <- selexprep_demultiplex( reads, c(AAAAA = 0L, TTTTT = 1L) ) demultiplexed$summaryreads <- c("AAAAACCCCC", "AAAATGGGGG", "TTTTTACGTA", "GGGGGAAAAA") demultiplexed <- selexprep_demultiplex( reads, c(AAAAA = 0L, TTTTT = 1L) ) demultiplexed$summary
Detects 5' and 3' constant regions in the earliest supplied SELEX round, then verifies the call across rounds. The returned LibraryReport separates inferred biology, input layout, and required downstream action. When primer evidence is insufficient, it returns an explicit safe-failure report rather than guessing.
selexprep_detect( sequences_by_round, read_source = c("R1", "R2", "R1_AND_R2", "INTERLEAVED", "UNKNOWN"), paired_mate_streams = NULL, sampling_seed = 42L, max_reads_per_round = NULL )selexprep_detect( sequences_by_round, read_source = c("R1", "R2", "R1_AND_R2", "INTERLEAVED", "UNKNOWN"), paired_mate_streams = NULL, sampling_seed = 42L, max_reads_per_round = NULL )
sequences_by_round |
A named list of character vectors or
|
read_source |
One of |
paired_mate_streams |
Optional named list containing the corresponding R2 sequences. Required only to detect split-primer paired-end layouts. |
sampling_seed |
Integer seed used when |
max_reads_per_round |
Optional positive cap on reads used per round. |
A selexprep_library_report.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500)))p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500)))
Uses a selexprep_library_report to remove the inferred constant regions.
The implementation operates directly on R sequence objects and preserves the
explicit safe-failure behavior of the original pipeline: reports marked as
unable to extract stop with an error unless the caller supplies a corrected
report. In split-primer paired-end mode, the two trimmed sides remain
separate; they are never silently merged.
selexprep_extract( sequences_by_round, library_report, paired_mate_streams = NULL, primer_5p = NULL, primer_3p = NULL, extraction_mode = NULL )selexprep_extract( sequences_by_round, library_report, paired_mate_streams = NULL, primer_5p = NULL, primer_3p = NULL, extraction_mode = NULL )
sequences_by_round |
A named list of character vectors or
|
library_report |
A |
paired_mate_streams |
Optional named R2 sequence pools, required for
|
primer_5p |
Optional manually reviewed 5-prime primer override. |
primer_3p |
Optional manually reviewed 3-prime primer override. |
extraction_mode |
Optional manually reviewed extraction-mode override. |
Full-primer matching follows the cutadapt defaults used by the Python
pipeline: adapters may occur away from the read boundary, substitutions
and indels are allowed up to a 10 percent error rate, and RNA U is
matched as DNA T. The returned insert retains the alphabet and case of
the input read.
A selexprep_extraction. Full and single-primer modes store one
Biostrings::BStringSet per round; paired split mode stores an r1 and
r2 BStringSet for every round.
primer_5p <- 'GGTAATACGACTCACTATAGGG' primer_3p <- 'CCATGCATGCATGCATGCAT' bases <- c('A', 'C', 'G', 'T') random_regions <- vapply(0:499, function(i) { paste0(bases[(i * 7 + 0:15 * 13) %% 4 + 1], collapse = '') }, character(1)) reads <- paste0(primer_5p, random_regions, primer_3p) report <- selexprep_detect(list(round_00 = reads)) selexprep_extract(list(round_00 = reads[seq_len(3L)]), report)primer_5p <- 'GGTAATACGACTCACTATAGGG' primer_3p <- 'CCATGCATGCATGCATGCAT' bases <- c('A', 'C', 'G', 'T') random_regions <- vapply(0:499, function(i) { paste0(bases[(i * 7 + 0:15 * 13) %% 4 + 1], collapse = '') }, character(1)) reads <- paste0(primer_5p, random_regions, primer_3p) report <- selexprep_detect(list(round_00 = reads)) selexprep_extract(list(round_00 = reads[seq_len(3L)]), report)
A frozen, offline snapshot of 240 public HT-SELEX deposits. Eight
experimental fields were extracted independently by two language models,
reconciled, and retained with a per-field curation status. The flat dataset
intentionally omits evidence quotations; immutable links to the canonical
provenance-rich JSON and its generation materials are stored in
S4Vectors::metadata(selexprep_public_catalog).
data(selexprep_public_catalog)data(selexprep_public_catalog)
An S4Vectors::DataFrame with 240 rows and 19 columns:
bioproject_idENA BioProject accession or a platform-prefixed Figshare or Zenodo deposit identifier.
sourceena, or the platform-prefixed Figshare or Zenodo
deposit identifier used as the source key.
study_titleTitle recorded for the public study or deposit.
study_type, study_type_curation
Curated experiment type and its reconciliation status.
target, target_curation
Selection target and its reconciliation status.
target_class, target_class_curation
Target class and its reconciliation status.
chemistry, chemistry_curation
DNA or RNA library chemistry and its reconciliation status.
n_random, n_random_curation
Reported random-region length and its reconciliation status.
n_rounds, n_rounds_curation
Reported selection-round count and its reconciliation status.
selection_format, selection_format_curation
Reported selection format and its reconciliation status.
counter_selection, counter_selection_curation
Reported counter-selection conditions and their reconciliation status.
Curation statuses are concordant, discordant, not_stated, verified,
single_source:claude, or single_source:codex.
Missing values mean that a field was not stated in the curated sources. A
discordant status means that both extracted values are retained in the
corresponding value column, separated by ' || '.
The snapshot was migrated without modification from the original
selexprep catalog at commit
b6792637ec9bed78f131e8f63e12e155f733e9ae. See the object metadata and
inst/CATALOG_PROVENANCE.md for immutable source links and terms.
Calculates depth, diversity, enrichment and sequence-length summaries for
each round of a SummarizedExperiment returned by run_selexprep(). It
also returns actionable flags for low depth, unstable random-region length,
weak primer evidence and paired-end libraries that need read merging.
selexprep_qc( experiment, library_report = NULL, low_total_reads = 10000L, rarefaction_depth = 10000L, rarefaction_seed = 42L, kmer_size = 6L, kmer_top_sequences = 10000L )selexprep_qc( experiment, library_report = NULL, low_total_reads = 10000L, rarefaction_depth = 10000L, rarefaction_seed = 42L, kmer_size = 6L, kmer_top_sequences = 10000L )
experiment |
A |
library_report |
Optional |
low_total_reads |
Minimum number of reads expected in every round. |
rarefaction_depth |
Maximum common depth used when comparing observed diversity across rounds. |
rarefaction_seed |
Integer seed for deterministic rarefaction. |
kmer_size |
Length of canonical k-mers used for between-round consistency diagnostics. |
kmer_top_sequences |
Maximum number of abundant sequences considered from each round for k-mer diagnostics. |
A selexprep_qc list with per_round, round_similarity, and
flags DataFrames plus the applied settings.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' pools <- list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500)) result <- run_selexprep(pools, low_total_reads = 0) selexprep_qc(result)p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' pools <- list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500)) result <- run_selexprep(pools, low_total_reads = 0) selexprep_qc(result)
The package uses lightweight S3 lists for decision records and reports, while
sequence abundance data use the standard Bioconductor SummarizedExperiment
container. These lists are deliberately explicit and serializable: they can
be written to the versioned JSON contracts without loss of meaning.
The list elements are stable public contracts:
selexprep_library_report stores primer_5p, primer_3p, their variant
evidence (variants_5p, variants_3p), known_adapter_hits,
extraction_mode, full_insert_recovered, read_source,
required_action, orientation, random-region length summaries
(n_length_mode, n_length_distribution, n_length_confidence), primer
match and position-consistency rates, the inference fraction and seed,
overall confidence, status, and an optional failure_reason.
selexprep_extraction stores extraction_mode,
full_insert_recovered, primer-stripped sequences_by_round, named
input_reads and output_reads counts, and the pre-trim
forward/reverse/ambiguous strand_distribution for each round.
selexprep_qc stores a per_round metrics DataFrame, a pairwise
round_similarity DataFrame, a flags DataFrame whose evidence
column contains structured lists, and the applied settings.
selexprep_manifest stores the schema and package/runtime versions,
accession and run identifiers, input/output SHA-256 maps, the embedded
library report and its classification, parameters, stage durations, QC
flags, and sampling seed. Readers accept portable Python v1 and R-native
v2 schemas.
selexprep_inspection stores the requested accession, BioProject ID,
study title, library strategy/source, and a run-level runs DataFrame
containing accessions, titles, sizes, FASTQ URLs, and checksums.
selexprep_fetch_result stores the resolved run-level download plan,
downloaded_files, and the dry_run status.
selexprep_read_inputs stores round-aware R1 pools, optional R2 pools,
the inferred read_source, and a file-level provenance DataFrame.
selexprep_demultiplex extends selexprep_read_inputs with unassigned
reads, per-round assignment summaries, and the validated barcode map.
S3 lists are used for these small decision and provenance records because
their named elements map losslessly to the versioned JSON contracts. The
high-dimensional assay remains a standard SummarizedExperiment with a
sparse Matrix assay.
A description of the result classes and their stable list elements.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) class(report)p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) class(report)
Write a LibraryReport as deterministic JSON
write_library_report(report, path)write_library_report(report, path)
report |
A |
path |
Output JSON path. |
The SHA-256 digest of the emitted UTF-8 JSON, invisibly.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) path <- tempfile(fileext = '.json') write_library_report(report, path)p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) path <- tempfile(fileext = '.json') write_library_report(report, path)
Writes the stable four-column count contract. Use TSV for a dependency-free,
portable exchange format; Parquet is available when the optional arrow
package is installed.
write_selexprep_counts(counts, path)write_selexprep_counts(counts, path)
counts |
A count table returned by |
path |
Output path ending in |
path, invisibly.
counts <- selexprep_count(c('ACGT', 'ACGT', 'GGGG')) path <- tempfile(fileext = '.tsv') write_selexprep_counts(counts, path)counts <- selexprep_count(c('ACGT', 'ACGT', 'GGGG')) path <- tempfile(fileext = '.tsv') write_selexprep_counts(counts, path)
Write a selexprep manifest as deterministic JSON
write_selexprep_manifest(manifest, path)write_selexprep_manifest(manifest, path)
manifest |
A |
path |
Output JSON path. |
The SHA-256 digest of the emitted UTF-8 JSON, invisibly.
p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) path <- tempfile(fileext = '.json') write_selexprep_manifest(build_selexprep_manifest(report), path)p5 <- 'GGTAATACGACTCACTATAGGG' p3 <- 'CCATGCATGCATGCATGCAT' report <- selexprep_detect(list(round_00 = rep(paste0(p5, 'ACGTACGTACGTACGT', p3), 500))) path <- tempfile(fileext = '.json') write_selexprep_manifest(build_selexprep_manifest(report), path)