Skip to content

Commit 3f1255d

Browse files
author
vsc20958
committed
.
1 parent b284960 commit 3f1255d

3 files changed

Lines changed: 24 additions & 9 deletions

File tree

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RecMpox is a command-line tool that **flags potential recombination events** in
99
1. **References are required**: RecMpox compares your genomes against two reference sequences (for example, Clade Ia vs. Ib, or Ib vs. IIb), because recombination can only occur between two distinct lineages.
1010
2. **Alignment and diagnostic SNPs**: The two reference genomes are aligned using [Squirrel](https://github.com/aineniamh/squirrel), so that the same genomic positions correspond across all sequences. RecMpox then identifies positions where the two references differ at the same coordinates. These positions are defined as diagnostic SNPs, because they distinguish between the reference lineages. Positions where the references are identical are ignored, as they do not provide information for detecting recombination.
1111
3. **Consensus genome classification**: Your consensus genomes are aligned to the same references. At each diagnostic SNP, the base is classified as matching reference 1, reference 2, or other (e.g., gaps or ambiguous bases).
12-
4. **Flagging potential recombinants**: If both references contribute at least 5% of the diagnostic positions in a genome, RecMpox flags it as a potential recombinant, since no single lineage clearly dominates.
12+
4. **Flagging potential recombinants**: If both references contribute at least 10% of the diagnostic positions in a genome, RecMpox flags it as a potential recombinant, since no single lineage clearly dominates.
1313
5. **Recombination tracts and breakpoints**: By examining the pattern of reference matches along the genome, RecMpox infers recombination tracts and identifies their breakpoints (start and end positions). To reduce false positives, runs of fewer than 2 consecutive diagnostic SNPs are ignored.
1414
6 **Outputs**:
1515
- TSV file: or each genome, reports the number and proportion of diagnostic SNPs matching each reference, the resulting recombinant flag, and summary statistics used for tract inference.
@@ -98,6 +98,7 @@ recmpox -i accessions.txt -o output -ref Ia,Ib # one accession per line or com
9898
- `-ref1_g`, `-ref2_g`: Genotype labels for TSV/HTML (default from `-ref` or accession)
9999
- `-include-indels`: Include diagnostic indels (default: SNPs only)
100100
- `-min-indel-size`: Min indel length (bp) when using `-include-indels` (default: 100)
101+
- `-m, --minor-ref-pct`: Minor reference % threshold for calling "potential recombinant" (default: 10). Increase to be more conservative (e.g. 15, 20).
101102
- `-t, --threads`: Number of threads
102103
- `-q, --quiet`: Log to file only
103104

@@ -126,8 +127,8 @@ Intermediate files (e.g. diagnostic_snps.txt, Squirrel outputs) are written unde
126127

127128
## Interpretation
128129

129-
- **No recombinant**: One ref dominates (minor ref < 5% of diagnostic sites).
130-
- **Potential recombinant**: Both refs contribute ≥5% (minor ref % ≥ 5%). The HTML report shows recombination tracts (beginning/end of each tract) and breakpoints between tracts. A single tract means the genome is entirely one clade (no recombination).
130+
- **No recombinant**: One ref dominates (minor ref < 10% of diagnostic sites).
131+
- **Potential recombinant**: Both refs contribute ≥10% (minor ref % ≥ 10%). The HTML report shows recombination tracts (beginning/end of each tract) and breakpoints between tracts. A single tract means the genome is entirely one clade (no recombination).
131132
- **High pct_other**: Many Ns, gaps, or non-ref bases at diagnostic sites (poor coverage or alignment).
132133

133134
## HTML Output example

conda-recipes/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ about:
5151
It does not confirm recombination; it flags genomes that may be recombinant for further investigation.
5252
RecMpox takes two references (e.g. Clade Ia vs Ib, or IIa vs IIb), aligns them with Squirrel,
5353
finds diagnostic SNP positions where the references differ, then classifies each consensus genome
54-
at those positions. Genomes where both refs contribute at least 5% are flagged as potential
54+
at those positions. Genomes where both refs contribute at least 10% are flagged as potential
5555
recombinants. Recombination tracts and breakpoints are inferred along the genome.
5656
doc_url: https://github.com/DaanJansen94/RecMpox/blob/main/README.md
5757
dev_url: https://github.com/DaanJansen94/RecMpox

recmpox/recmpox.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def resolve_ref(spec: str, work_dir: Path, label: str) -> Optional[Path]:
9393

9494

9595
# Minor ref % = smaller of pct_ref1, pct_ref2 over ALL diagnostic sites. When >= threshold, flag as potential recombinant.
96-
# Recombinant threshold: 5% for all (intra- and inter-clade)
97-
MINOR_REF_PCT_THRESHOLD = 5.0
96+
# Default recombinant threshold: 10% for all (intra- and inter-clade)
97+
MINOR_REF_PCT_THRESHOLD = 10.0
9898

9999
# Default NCBI accessions per clade/subclade (used when -ref X,Y is given)
100100
REF_DEFAULTS = {
@@ -1220,6 +1220,15 @@ def main() -> None:
12201220
optional = parser.add_argument_group("optional arguments")
12211221
parser.add_argument("-h", "-help", "--help", action="help", help="show this help message and exit")
12221222
optional.add_argument("--version", action="version", version=f"RecMpox v{__version__}")
1223+
optional.add_argument(
1224+
"-m",
1225+
"--minor-ref-pct",
1226+
dest="minor_ref_pct",
1227+
type=float,
1228+
default=MINOR_REF_PCT_THRESHOLD,
1229+
metavar="",
1230+
help=f"Minor reference %% threshold for calling 'potential recombinant' (default: {MINOR_REF_PCT_THRESHOLD:g}).",
1231+
)
12231232
required.add_argument("-i", "-input", dest="input", type=Path, default=None, metavar="", help="FASTA file, directory of .fa/.fasta/.fna, .txt file of accessions (one per line or comma-separated), NCBI accession, or comma-separated accessions (e.g. -i ACC1,ACC2 or -i accessions.txt)")
12241233
required.add_argument("-ref", dest="ref", type=str, default=None, metavar="", help="Reference pair: two comma-separated labels among Ia, Ib, IIa, IIb (e.g. Ia,Ib or Ib,IIb). Uses built-in defaults. Either -ref or both -ref1 and -ref2 are required.")
12251234
required.add_argument("-ref1", type=str, default=None, metavar="", help="First reference: FASTA path or NCBI accession; overrides ref1 when using -ref. Required if -ref is not used.")
@@ -1239,6 +1248,11 @@ def main() -> None:
12391248

12401249
args = parser.parse_args()
12411250

1251+
if getattr(args, "minor_ref_pct", None) is None:
1252+
args.minor_ref_pct = MINOR_REF_PCT_THRESHOLD
1253+
if args.minor_ref_pct < 0 or args.minor_ref_pct > 100:
1254+
parser.error("--minor-ref-pct must be between 0 and 100")
1255+
12421256
if args.input is None:
12431257
parser.error("-i/-input is required")
12441258

@@ -1294,7 +1308,7 @@ def _normalize_ref_label(s: str) -> str:
12941308
if squirrel_clade is None:
12951309
squirrel_clade = _infer_squirrel_clade(ref1_label, ref2_label)
12961310
is_intra_clade = squirrel_clade is not None
1297-
minor_threshold = MINOR_REF_PCT_THRESHOLD
1311+
minor_threshold = float(getattr(args, "minor_ref_pct", MINOR_REF_PCT_THRESHOLD))
12981312
if squirrel_clade == "cladei":
12991313
logger.info("Inferred Squirrel --clade cladei from ref1_g/ref2_g (Clade I)")
13001314
elif squirrel_clade == "cladeii":
@@ -1526,8 +1540,8 @@ def row(r: Dict[str, Any]) -> str:
15261540
logger.info("Wrote %s (%d potential recombinant samples)", out_sites_tsv, len(rec_samples))
15271541

15281542
recombinant_threshold_note = (
1529-
"A 5% threshold is used for all recombinant calls: "
1530-
"when minor ref % ≥ 5%, the sample is flagged as potential recombinant."
1543+
f"A {minor_threshold:g}% threshold is used for all recombinant calls: "
1544+
f"when minor ref % ≥ {minor_threshold:g}%, the sample is flagged as potential recombinant."
15311545
)
15321546
other_explanation = (
15331547
"%% other = diagnostic sites where the query neither matched %s nor %s (different base; at SNPs, gap/N count as other)."

0 commit comments

Comments
 (0)