From 58067bdf01d1cd64e10297ef654948a0133d3485 Mon Sep 17 00:00:00 2001 From: John Lees Date: Tue, 3 Feb 2026 15:36:39 +0000 Subject: [PATCH] Pass freq param to ska Also improve instructions for dates Closes #26 --- README.md | 19 +++++++++++++++---- Snakefile | 6 +++--- config.yml | 4 ++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cbad0eb..c0b230d 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,20 @@ In addition to the above, for each strain: - Use [bactdating](https://github.com/xavierdidelot/BactDating) to make timed trees. - Use [transphylo](https://github.com/xavierdidelot/TransPhylo) to infer transmission events on these timed trees. -This requires a `transmission_metadata.csv` file containing sampling times, see the PopPIPE configuration section below for a description of its format. +This requires a `transmission_metadata.csv` file containing sampling times, this file should look like this: +``` +Name,Date +001334,2001 +279388,2001 +5Z52R,2007 +``` +Where the sample names match the PopPUNK analysis, followed by a date. + +Please note that bactDating parses the dates using: +```r +tryFormats = c("%Y-%m-%d", "%Y/%m/%d", "%Y") +``` +So your dates should be in a compatible format, usually at the same resolution (e.g. all just years) For an example of this analysis, please find data at [10.6084/m9.figshare.28495571](https://dx.doi.org/10.6084/m9.figshare.28495571). Input files and config file are in `input/` and the pipeline output after running `snakemake transmission --cores 4` is @@ -122,9 +135,7 @@ in `config.yml` which lists the sampling dates. The run the transmission target: snakemake transmission ``` -## Usage example - -TODO +Ensure dates are formatted consistently (see above). ## Config file diff --git a/Snakefile b/Snakefile index 3192f40..b958ab4 100644 --- a/Snakefile +++ b/Snakefile @@ -137,9 +137,10 @@ rule ska_align: log: "logs/ska_align_{strain}.log" params: - prefix="output/strains/{strain}/align" + prefix="output/strains/{strain}/align", + min_freq=config['ska']['freq_filter'] shell: - "ska align -v --filter no-const --no-gap-only-sites {input.skf} > {output.alignment} 2> {log}" + "ska align -v --min-freq {params.min_freq} --filter no-const --no-gap-only-sites {input.skf} > {output.alignment} 2> {log}" # ska for mapping (needed for gubbins) rule ska_map: @@ -174,7 +175,6 @@ rule iq_tree: mode=config['iqtree']['mode'], model=config['iqtree']['model'], prefix="output/strains/{strain}/besttree.unrooted" - threads: 4 script: diff --git a/config.yml b/config.yml index 4b9a0c0..85efd1d 100644 --- a/config.yml +++ b/config.yml @@ -16,7 +16,7 @@ ska: fastq_cov: 4 kmer: 31 single_strand: false - freq_filter: 0.9 + freq_filter: 0.9 # only used in ska align step # IQ-TREE options iqtree: @@ -37,7 +37,7 @@ mandrake: # Microreact title, and your contact details microreact: - name: Listeria PopPIPE + name: PopPIPE run website: https://www.poppunk.net email: poppunk@poppunk.net api_token: a1b2c3d4 ## see https://docs.microreact.org/api/access-tokens