PhaseFinder on Biowulf
The PhaseFinder algorithm is designed to detect DNA inversion mediated phase variation in bacterial genomes using genomic or metagenomic sequencing data. It works by identifying regions flanked by inverted repeats, mimicking their inversion in silico, and identifying regions where sequencing reads support both orientations. Here, we define phase variation as "a process employed by bacteria to generate frequent and reversible changes within specific hypermutable loci, introducing phenotypic diversity into clonal populations”. Not every region detected by PhaseFinder will directly result in phase variation, but the results should be highly enriched for regions that do.
References:
- Jiang X, Hall AB, et al. Invertible promoters mediate bacterial phase variation, antibiotic resistance, and host adaptation in the gut. Science (2019) DOI: 10.1126/science.aau5238
Documentation
Important Notes
- Module Name: phasefinder (see the modules page for more information)
- PhaseFinder.py ratio multi-threaded with the -p/--threads flag.
- Environment variables set
- PHASEFINDER_HOME
- Example files in $PHASEFINDER_HOME/data
Interactive job
Interactive jobs should be used for debugging, graphics, or applications that cannot be run as batch jobs.
Allocate an interactive session and run the program.
Sample session (user input in bold):
[user@biowulf]$ sinteractive -c 16 salloc.exe: Pending job allocation 46116226 salloc.exe: job 46116226 queued and waiting for resources salloc.exe: job 46116226 has been allocated resources salloc.exe: Granted job allocation 46116226 salloc.exe: Waiting for resource configuration salloc.exe: Nodes cn3144 are ready for job [user@cn3144 ~]$ module load phasefinder [user@cn3144 ~]$ PhaseFinder.py locate -f $PHASEFINDER_HOME/data/test.fa -t test.einverted.tab -g 15 85 -p [user@cn3144 ~]$ PhaseFinder.py create -f $PHASEFINDER_HOME/data/test.fa -t test.einverted.tab -s 1000 -i test.ID.fasta [user@cn3144 ~]$ PhaseFinder.py ratio -i test.ID.fasta -1 $PHASEFINDER_HOME/data/p1.fq -2 $PHASEFINDER_HOME/data/p2.fq -p $SLURM_CPUS_PER_TASK -o out [user@cn3144 ~]$ exit salloc.exe: Relinquishing job allocation 46116226 [user@biowulf ~]$
Batch job
Most jobs should be run as batch jobs.
Create a batch input file (e.g. phasefinder.sh). For example:
#!/bin/bash set -e module load phasefinder PhaseFinder.py locate -f $PHASEFINDER_HOME/data/test.fa -t test.einverted.tab -g 15 85 -p PhaseFinder.py create -f $PHASEFINDER_HOME/data/test.fa -t test.einverted.tab -s 1000 -i test.ID.fasta PhaseFinder.py ratio -i test.ID.fasta -1 $PHASEFINDER_HOME/data/p1.fq -2 $PHASEFINDER_HOME/data/p2.fq -p $SLURM_CPUS_PER_TASK -o out
Submit this job using the Slurm sbatch command.
sbatch [--cpus-per-task=#] [--mem=#] phasefinder.sh
Swarm of Jobs
A swarm of jobs is an easy way to submit a set of independent commands requiring identical resources.
Create a swarmfile (e.g. phasefinder.swarm). For example:
PhaseFinder.py ratio -i test.ID.fasta -1 sample1_1.fq -2 sample1_2.fq -p $SLURM_CPUS_PER_TASK -o out PhaseFinder.py ratio -i test.ID.fasta -1 sample2_1.fq -2 sample2_2.fq -p $SLURM_CPUS_PER_TASK -o out PhaseFinder.py ratio -i test.ID.fasta -1 sample3_1.fq -2 sample3_2.fq -p $SLURM_CPUS_PER_TASK -o out PhaseFinder.py ratio -i test.ID.fasta -1 sample4_1.fq -2 sample4_2.fq -p $SLURM_CPUS_PER_TASK -o out
Submit this job using the swarm command.
swarm -f phasefinder.swarm [-g #] [-t #] --module phasefinderwhere
-g # | Number of Gigabytes of memory required for each process (1 line in the swarm command file) |
-t # | Number of threads/CPUs required for each process (1 line in the swarm command file). |
--module phasefinder | Loads the PhaseFinder module for each subjob in the swarm |