| scan_motifs {GCModeller} | R Documentation |
Scans given upstream sequences against a motif Position Weight Matrix (PWM) database in parallel. The function processes motif families independently, performs motif matching with customizable statistical thresholds, and aggregates the results into a single dataframe.
scan_motifs(db, seqs,
pval.cutoff = 0.05,
minW = 0.85,
top = 3,
scan.reverse = TRUE,
workdir = './',
n.threads = 8);
The function executes in two main stages: \enumerate{ \item \strong{Parallel Search}: It first reads the motif families from the database. Using a parallel backend (via \code{snowFall}), it distributes the search tasks across \code{n_threads}. Each thread scans the upstream sequences for a specific motif family and writes the intermediate results to individual CSV files in \code{<workdir>/results/}. \item \strong{Aggregation}: After all parallel tasks complete, the function reads all generated CSV files from the results directory and row-binds them into a single unified dataframe using \code{dplyr::bind_rows}. }
A consolidated \code{data.frame} (or \code{tibble}) containing the motif site match results from all motif families. The exact columns depend on the output generated by the underlying \code{TRN.builder::motif_search} function.
#\dontrun{
# Define paths to your database and sequence file
motif_db <- "path/to/motif_database"
upstream_fasta <- "path/to/upstream_sequences.fasta"
# Run the parallel motif scanning
results <- scan_motifs(
db = motif_db,
seqs = upstream_fasta,
identities_cutoff = 0.85,
minW = 0.9,
top = 5,
permutation = 5000,
workdir = "./motif_scan_workspace",
n_threads = 16
)
head(results)
#}