This workflow executes barcode cleaning and anchored alignment using Cutadapt, sums per sample barcodes, maps back to metadata, calculates molecular equivalence, models viral titration curves, determines percent neutralization, and visualizes 4 parameter logistic neutralization plots. Designed to work on the JHU RockFish HPC system.
This repository is organized so that code, configuration, metadata, raw data, processed outputs, and cluster execution settings are kept separate. The workflow is written in Snakemake and is designed to run on RockFish with SLURM using a Conda environment located inside the pipeline directory.
At a high level, the pipeline does the following:
- Cleans and normalizes the barcode reference file.
- Creates a 5′-anchored barcode FASTA for Cutadapt.
- Runs Cutadapt per sample to count barcode matches at the 5′ end.
- Builds per-sample QC tables and an all-sample QC summary.
- Aggregates barcode counts across samples.
- Merges counts back into the annotation sheet.
- Computes molecular equivalence values using the configured spike-in columns.
- Fits virus titration line models plate-wise and generates PDF summaries.
- Computes percent neutralization values from the line fits.
- Fits 4PL curves and generates final CSV and PDF outputs for
pmAbandserumanalyses.
The layout of the InFlux database looks like this:
/data/hlarman1/InfluxDB/
├── Influx_pipeline/
│ ├── workflow/
│ │ └── Snakefile
│ ├── config/
│ │ └── config_rockfish.yaml
│ ├── envs/
│ │ ├── analysis.yaml
│ │ └── cutadapt.yaml
│ ├── profiles/
│ │ └── rockfish/
│ │ └── config.yaml
│ ├── logs/
│ ├── benchmarks/
│ ├── containers/
│ ├── .conda/
│ │ └── influx_env/
│ └── run_Influx_pipeline.sh
├── Metadata/
│ ├── 073025_influxv2-54plex.txt
│ └── InFlux014-1_Annotation.csv
├── Rawdata/
│ └── <run_folder>/
└── ProcessedData/
└── <run_folder>_<YYYYMMDD>_out/
-
Influx_pipeline/workflow/- Contains the Snakemake workflow.
- Main file:
Snakefile
-
Influx_pipeline/config/- Contains workflow configuration files.
config_rockfish.yamlis the main cluster config used on RockFish.
-
Influx_pipeline/envs/- Stores environment recipes and related software notes.
- The pipeline currently runs from a shared project Conda environment.
-
Influx_pipeline/profiles/rockfish/- Snakemake profile for SLURM submission on RockFish.
- Controls job submission behavior, default memory/runtime, and thread overrides.
-
Influx_pipeline/logs/- Slurm controller logs and child job logs.
-
Influx_pipeline/benchmarks/- Reserved for future Snakemake benchmark outputs if benchmarking is added.
-
Influx_pipeline/containers/- Reserved for future container-based deployment if needed.
-
Influx_pipeline/.conda/influx_env/- Shared project Conda environment used to run the pipeline.
-
Influx_pipeline/run_Influx_pipeline.sh- Slurm wrapper script that launches the Snakemake controller itself on RockFish.
- Recommended way to run the pipeline on the cluster.
-
Metadata/- Stores shared static reference inputs such as:
- barcode reference file
- annotation sheet
- Stores shared static reference inputs such as:
-
Rawdata/- Stores input FASTQ folders for each InFlux run.
-
ProcessedData/- Stores outputs for each run.
- Output folders are typically named as:
<fastq_folder_name>_<YYYYMMDD>_out
This is the core workflow. The main rules are:
-
sanitize_barcodes- Reads the barcode reference file.
- Removes BOM artifacts and formatting issues.
- Converts sequences to uppercase.
- Writes
barcodes_clean.fa.
-
anchor_barcodes- Converts cleaned barcode sequences into a 5′-anchored FASTA.
- Writes
barcodes_anchored.fa.
-
cutadapt_e- Runs Cutadapt per sample for each configured error-rate label.
- Produces JSON reports and
.donesentinel files.
-
qc_per_sample_eps- Computes per-sample QC statistics using FASTQ read counts and Cutadapt JSON output.
-
qc_summary_all- Combines all per-sample QC files into a single summary TSV.
-
aggregate_counts_e- Aggregates barcode counts per sample into a single counts matrix.
-
counts_to_annotated_e- Merges the count matrix into the annotation sheet.
- Adds QC metrics and
spike_in_fraction.
-
annotated_to_me_e- Converts raw counts to molecular equivalence values using the configured spike-in columns.
-
titration_fit_platewise_e- Performs plate-wise virus titration line fitting.
- Produces CSV summaries and PDF visualizations.
-
percent_nt_by_fraction_e- Computes percent neutralization values from the line-fit outputs.
-
nt_fourpl_fit_e- Fits 4-parameter logistic neutralization curves.
- Produces final CSV and PDF outputs for
pmAbandserum.
This file defines the pipeline inputs and run parameters.
Key parameters include:
-
barcodes_fa- Path to the barcode FASTA/TXT reference file.
-
fastq_dir- Directory containing input FASTQ files.
-
fastq_glob- File patterns used to discover FASTQ files.
-
out_dir- Output directory for all results.
-
threads_per_job- Number of threads used by each Cutadapt job.
- Snakemake-level parallelism is controlled separately by the Slurm profile.
-
error_rate- Maximum tolerant error rate for barcode matching.
-
error_rates- Explicit list of error rates to run.
-
overlap- Minimum 5′ overlap required for barcode matching.
-
no_indels- Whether to disallow indels in the match.
-
match_read_wildcards- Whether to allow
Nin reads to match any base.
- Whether to allow
-
revcomp- Whether to also search the reverse complement.
-
annotated_sheet- Path to the sample annotation sheet.
-
pcr_spike_in_col- Column in the annotation sheet that names the spike-in barcode column to use.
-
pcr_spike_in_copies_col- Column in the annotation sheet containing copies per reaction.
-
beta_precision,censor_eps,multistart,profile_steps- Parameters used in the final 4PL fitting stage.
The workflow currently runs from a shared project Conda environment located at:
/data/hlarman1/InfluxDB/Influx_pipeline/.conda/influx_envThis environment was created to avoid system-level dependency issues on RockFish.
Example packages used by the workflow include:
- Python 3.10
- Snakemake 7.6.0
- Cutadapt 5.2
- NumPy
- pandas
- SciPy
- matplotlib
Submit the wrapper script:
sbatch /data/hlarman1/InfluxDB/Influx_pipeline/run_Influx_pipeline.shThe wrapper script behaviour:
- defines the input FASTQ folder
- derives the output folder name from the input folder plus the current date
- activates the shared project environment by using the environment's
bin/path directly - launches Snakemake with the RockFish profile
If you want to run the controller manually from an interactive session, the base command is:
snakemake -p \
-s workflow/Snakefile \
--configfile config/config_rockfish.yaml \
--profile profiles/rockfishThe RockFish profile is stored under:
profiles/rockfish/config.yamlIt controls:
- the maximum number of active Snakemake jobs
- default per-job memory
- default per-job runtime
- thread overrides for specific rules such as
cutadapt_e - the Slurm submission string used for child jobs
This design lets the workflow logic stay mostly unchanged while cluster-specific behavior is controlled outside the Snakefile.
Inside each run-specific output folder, you should expect files such as:
barcodes_clean.fabarcodes_anchored.fajson_e/e0/*.jsoncounts_e0.tsvqc/*.qc.tsvqc_summary_all.tsvannotated_counts_e0.csvMolecular_equivalence_e0.csvVirusTitration_LineFits_platewise_e0.csvVirusTitration_PlateWise_e0.pdfVirusTitration_PlateWise_split_e0.pdfpercent_NT_by_fraction_e0.csvvt100_denominators_e0.csvNT_4PL_fits_e0_pmAb.csvNT_4PL_fits_e0_serum.csvNT_4PL_plots_e0_pmAb.pdfNT_4PL_plots_e0_serum.pdfNT_4PL_plots_e0_pmAb_1up.pdfNT_4PL_plots_e0_serum_1up.pdf
There are two main logging layers:
These come from the SLURM job that runs run_Influx_pipeline.sh and contains log info of thr overall Snakemake orchestration. This is the best place to look for an overall log information.
Examples:
logs/controller-<jobid>.outlogs/controller-<jobid>.err
Each rule instance submitted by Snakemake can also write Slurm stdout/stderr logs and these logs are useful for debugging failed Cutadapt jobs for example.
Snakemake is output-aware. If a run is interrupted, rerunning the same command will usually resume from completed outputs rather than restarting from scratch.
Example:
sbatch /data/hlarman1/InfluxDB/Influx_pipeline/run_Influx_pipeline.sh