This repo saves all the scripts for processing the 28 sample pairs on Phx in 2025 from March to May. The paper that documented our investigations about running Nextflow-based software under Slurm, has been accepted by the USRSE 2025 conference and can be found here: <10.5281/zenodo.17118383>
The make_lastz_chains folder is the code cloned from the original repo, version 2.8.0, at the time. In the parallelization folder, the nextflow_wrapper.py script has the modifications we added to work with the Phx slurm. It controls the nextflow behaviors. More info: https://training.nextflow.io/2.1/basic_training/debugging/#dynamic-resources-allocation
The mamba env can be recreated from the yml file. Please see below for more details about the Kent binaries.
- Pull down this repo, or the original make_lastz_chains repo but patch the
parallelization/nextflow_wrapper.pyfile. - Create an
inputfolder and alogfolder in this repo folder. Put the input sample pairs in the input folder. Update thelastz_ref_query_list.txtif needed; pay attention to the tab/white space in this manifest file. Thecut_fields_separately.shwas used to clean up white spaces in the manifest file. - Modify the
test.shsbatch script. Manually submit three to four sample pairs at a time; too many main jobs running simultaneously would cause some issues for slurm and nextflow. - Since the nextflow child jobs are controlled by the wrapper script, extra time or memory flags are not needed in the main command.
- The smaller the
chunk size, the larger the count of the nextflow child jobs will be. If a run failed at thelastzor thechain_runstep, consider reducing the chunk size. The recommended chunk size for these runs is 40M for both reference and query sequences. - The slurm
.outfile has the nextflow logs, the.errfile has the main job log, which would be the same asworking_dir/run.log. Both slurm job files are important to keep. - A successful run will have a
.final.chain.gzfile, andpipeline_parameters.json,run.log,steps.json. A failed run will have lots of temp folders in the working directory. - If the job counts are high, the produced slurm logs would likely take up too much space in the home dir, and crash new jobs. If that's the case, remove slurm logs quickly via:
find /home/username/.local/var/log/slurm/ -maxdepth 1 -type f -delete
Or avoid generating slurm logs by adding this line to the test.sh script:
export SLURM_SKIP_EPILOG=1
- Pull down this repo, or the original make_lastz_chains repo but patch the
parallelization/nextflow_wrapper.pyfile withparallelization/nextflow_wrapper.py.arrayin this repo. - Modify the
test.shsbatch script to use Nextflow v25.
Then same as above. If the job runs normally, for the lastz. chain_run and fill_chain step, the child jobs will be batched into a couple of job arrays, instead of being submitted as individual sbatch jobs. This is very helpful for a busy cluster as the sub-jobs in a job array share the same fairshare score.
- Keep the original working directory of this failed run.
- Check the
working_dir/steps.jsonto find the failed step. - Modify the sbatch script to make sure the working directory name is the same, remove the
-fflag, and change the keyword for the--continue_from_stepflag:partition,lastz,cat,chain_run,chain_merge,fill_chains,clean_chains
Source: The readme file in the https://github.com/hillerlab/make_lastz_chains
The mamba env created on Phx has the UCSC Kent tools at version 455, which doesn't have some of the newest version's patches and cannot handle long sequences. So when the input sequences are extremly long, the workflow calls these older Kent tools and gets an "Assertion error" at the final step, the clean_chain step.
However, the newest version of Kent tools requires a newer GLIBC, which Phx doesn't have. The latest version of the Kent binaries has been downloaded in make_lastz_chains/HL_kent_binaries and HL_kent_binaries_bak; they are not called by the workflow, but they can be used manually.
In the progress tracking Google sheet, if a sample pair has the note like manually ran chainCleaner, Assertion error or manually ran chainCleaner, the Kent binaries used were make_lastz_chains/HL_kent_binaries_bak/chainCleaner_bakMay, as well as the chainFilter and the chainSort from the mamba env.
If the note was manually ran chainCleaner apptainer, chainFilter and gzip, done, Kent binaries used were v482 inside a Ubuntu 22.04-based apptainer. A copy of such container is at /packages/simg/ucsc-kent_v482.sif on Phx. The create_apptainer.sh file here has the commands for building such an apptainer.
- Request an interactive session with 20min and 30G memory as the first try. If getting the "Killed" error message when running
chainCleaner, increase the memory. - Check the
run.logfile in the working directory of this failed run and copy thechainCleanercommand at the end of the file. - Past the copied command in the second line below, then
cdinto the working directory, and run the command using thebefore_cleaning.chain.gzfile:
apptainer exec /packages/simg/ucsc-kent_v482.sif chainCleaner \
<paste the code block here>
Below is a block of example codes:
apptainer exec /packages/simg/ucsc-kent_v482.sif chainCleaner \
/path/to/project_dir/temp_chain_run/Pseudophryne_corroboree.Crinia_signifera.before_cleaning.chain.gz /path/to/project_dir/target.2bit /path/to/project_dir/query.2bit /path/to/project_dir/temp_chain_run/Pseudophryne_corroboree.Crinia_signifera.filled.chain__temp /path/to/project_dir/temp_chain_run/removed_suspects.bed -linearGap=loose -tSizes=/path/to/project_dir/target.chrom.sizes -qSizes=/path/to/project_dir/query.chrom.sizes -LRfoldThreshold=2.5 -doPairs -LRfoldThresholdPairs=10 -maxPairDistance=10000 -maxSuspectScore=100000 -minBrokenChainScore=75000
- After the
chainCleaner, there are two more steps to get the end product:
module load mamba/latest
source activate make_lastz_chains-2.0.8_base
cd temp_chain_run/
chainFilter -minScore=1000 xxx.filled.chain__temp > xxx.filled.chain
gzip -c xxx.filled.chain > xxx.final.chain.gz
The chainCleaner, chainFilter and gzip commands are adapted from make_lastz_chains/make_chains.py and make_lastz_chains/steps_implementations/clean_chain_step.py, using the same parameters.
The -c flag in the gzip command is to preserve the input file and ouput the compressed file with a new file name.
More info:
hillerlab/make_lastz_chains#92
hillerlab/make_lastz_chains#66
http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/
https://github.com/ucscGenomeBrowser/kent
https://www.nextflow.io/docs/stable/reference/process.html#array