#!/usr/bin/env Rscript # ============================================================================= # run_virfinder.R # Score contigs for "virusness" with VirFinder and write a sorted TSV. # # Usage: Rscript run_virfinder.R # # VirFinder returns a score (0-1) and a p-value per contig. Treat it as ONE # line of evidence: confirm candidates with VirSorter2/geNomad + CheckV. # ============================================================================= args <- commandArgs(trailingOnly = TRUE) if (length(args) != 2) { stop("Usage: Rscript run_virfinder.R ") } contigs <- args[1] out_tsv <- args[2] suppressMessages(library(VirFinder)) pred <- VF.pred(contigs) # Lower p-value = stronger viral signal; sort so best candidates are on top. pred <- pred[order(pred$pvalue), ] dir.create(dirname(out_tsv), showWarnings = FALSE, recursive = TRUE) write.table(pred, file = out_tsv, sep = "\t", quote = FALSE, row.names = FALSE) cat("Wrote", nrow(pred), "scored contigs to", out_tsv, "\n")