Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/pangenome.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ cactus-panpatch ./js chromfile.txt --outDir patched --batch

```
cactus-panpatch ./js chromfile.txt --outDir patched --batch --requireTelomeres \
--batchSystem slurm --slurmTime 10:00:00 --doubleMem true --maxMemory 1.5T --retryCount 10 \
--batchSystem slurm --defaultWalltime 36000 --doubleMem true --maxMemory 1.5T --retryCount 10 \
--consCores 16 --mgCores 32 --mapCores 16
```

Expand Down
14 changes: 8 additions & 6 deletions doc/progressive.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ cactus-hal2maf ./js evolverMammals.hal evolverMammals.maf.gz --refGenome simHuma
Exporting a MAF for each reference in an 8-way [ape alignment](https://cglgenomics.ucsc.edu/february-2024-t2t-apes/) on UCSC Slurm cluster:

```
for i in hs1 hg38 GCA_028858775.2 GCA_028885655.2 GCA_028885625.2 GCA_028878055.2 GCA_029281585.2 GCA_029289425.2; do cactus-hal2maf ./js_hal2maf8 ./8-t2t-apes-2023v2.hal ./8-t2t-apes-2023v2.${i}.maf.gz --filterGapCausingDupes --outType norm single --refGenome $i --chunkSize 500000 --batchCores 64 --noAncestors --batchCount 16 --batchSystem slurm --logFile ./8-t2t-apes-2023v2.${i}.gz.log --batchLogsDir batch-logs-8apes --slurmTime 200:00:00 --slurmPartition long;done
for i in hs1 hg38 GCA_028858775.2 GCA_028885655.2 GCA_028885625.2 GCA_028878055.2 GCA_029281585.2 GCA_029289425.2; do cactus-hal2maf ./js_hal2maf8 ./8-t2t-apes-2023v2.hal ./8-t2t-apes-2023v2.${i}.maf.gz --filterGapCausingDupes --outType norm single --refGenome $i --chunkSize 500000 --batchCores 64 --noAncestors --batchCount 16 --batchSystem slurm --logFile ./8-t2t-apes-2023v2.${i}.gz.log --batchLogsDir batch-logs-8apes --defaultWalltime 720000 --slurmPartition long;done
```

Note that this invocation creates two MAFs per reference (as dictated by the `--outType` option). Notably, the `.single.maf.gz` files will be filtered so that each genome appears at most once per block, which is often required by browsers and other MAF-reading tools.
Expand Down Expand Up @@ -342,7 +342,7 @@ cactus-phast ./js-vgp \
--geneAnnotation https://hgdownload.soe.ucsc.edu/goldenPath/hg38/database/ncbiRefSeq.txt.gz \
--bigwig --batchSystem slurm --chunkCores 32 --phyloFitCores 32 \
--substMod REV --modFreqs --precision HIGH \
--slurmPartition medium --slurmTime 10:00:00 \
--slurmPartition medium --defaultWalltime 36000 \
--doubleMem true
```

Expand Down Expand Up @@ -416,8 +416,10 @@ These are the most relevant options for running on a cluster

On a cluster with partitions and/or time limits, make sure to use

* `--slurmTime` to specify the time for each job. Unfortunately cactus does not yet try to set this itself, so you need to give one value that will be applied to all jobs, ex `--slurmTime 200:00:00`
* `--slurmPartition / --slurmGPUPartition` to specify the slurm partition where CPU / GPU jobs end up on. Cactus will try to figure this out on its own using the `--slurmTime` value along with whether or not the job needs GPU. But this option will allow you to override that.
* `--defaultWalltime` to specify the time, **in seconds**, for each job, ex `--defaultWalltime 720000` (200 hours). Slurm uses each job's walltime to choose a partition, so give the big jobs plenty of time here.
* `--fastWalltime` sets the walltime, **in seconds**, that Cactus gives its many small "coordination" jobs; it defaults to `1800` (30 minutes), which is very conservative for these jobs. On a cluster with a fast/short partition, this lets those little jobs get routed there instead of tying up a long partition; everything else falls back to `--defaultWalltime`. Pass `--fastWalltime 0` to disable it.
* `--slurmPartition / --slurmGPUPartition` to specify the slurm partition where CPU / GPU jobs end up on. Cactus will try to figure this out on its own from each job's walltime along with whether or not the job needs GPU. But this option will allow you to override that.
* `--slurmTime` is a global override that forces a single time onto *every* job, ignoring the per-job `--defaultWalltime` / `--fastWalltime` values above (so it also disables the fast-partition routing). Reach for it only as an escape hatch, e.g. if a job's time estimate turns out too low and it keeps getting killed: `--slurmTime 200:00:00`.

You can also use

Expand All @@ -436,13 +438,13 @@ source /private/groups/cgl/cactus/venv-cactus-latest/bin/activate
Some recommended options:

```
cactus ./js ./examples/evolverMammals.txt evolverMammals.hal --batchSystem slurm --batchLogsDir batch-logs --consCores 64 --maxMemory 1.4Ti --doubleMem true --slurmTime 200:00:00
cactus ./js ./examples/evolverMammals.txt evolverMammals.hal --batchSystem slurm --batchLogsDir batch-logs --consCores 64 --maxMemory 1.4Ti --doubleMem true --defaultWalltime 720000
```

To run the same command step by step,

```
cactus-prepare ./examples/evolverMammals.txt --outDir mammals-prepare --outHal mammals-prepare/evolverMammals.hal --cactusOptions "--maxMemory 1.4Ti --doubleMem true --slurmTime 200:00:00 --batchSystem slurm" --alignCores 64 --script > mammals.sh
cactus-prepare ./examples/evolverMammals.txt --outDir mammals-prepare --outHal mammals-prepare/evolverMammals.hal --cactusOptions "--maxMemory 1.4Ti --doubleMem true --defaultWalltime 720000 --batchSystem slurm" --alignCores 64 --script > mammals.sh
chmod+x mammals.sh
./mammals.sh
```
Expand Down
7 changes: 4 additions & 3 deletions src/cactus/blast/cactus_blast.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
import timeit

from cactus.progressive.progressive_decomposition import compute_outgroups, parse_seqfile, get_subtree, get_spanning_subtree, get_event_set, get_ancestor_scaled_tree
from cactus.shared.common import setupBinaries, importSingularityImage
from cactus.shared.common import setupBinaries, importSingularityImage, cactus_fast_walltime
from cactus.shared.common import cactusRootPath
from cactus.shared.configWrapper import ConfigWrapper
from cactus.shared.common import makeURL, catFiles
from cactus.shared.common import enableDumpStack
from cactus.shared.common import cactus_override_toil_options
from cactus.shared.common import cactus_override_toil_options, add_cactus_toil_options
from cactus.shared.common import getOptionalAttrib
from cactus.shared.version import cactus_commit
from cactus.progressive.cactus_prepare import human2bytesN
Expand All @@ -34,6 +34,7 @@

def main():
parser = Job.Runner.getDefaultArgumentParser()
add_cactus_toil_options(parser)

parser.add_argument("seqFile", help="Seq file")
parser.add_argument("outputFile", type=str, help="Output pairwise alignment file")
Expand Down Expand Up @@ -156,7 +157,7 @@ def runCactusBlastOnly(options):
input_seq_id_map[genome] = toil.importFile(seq)

paf_id = toil.start(Job.wrapJobFn(sanitize_then_make_paf_alignments, NXNewick().writeString(spanning_tree),
input_seq_id_map, options.root, config_node, options.outputFile))
input_seq_id_map, options.root, config_node, options.outputFile, walltime=cactus_fast_walltime()))

# export the alignments
toil.exportFile(paf_id, makeURL(options.outputFile))
Expand Down
11 changes: 6 additions & 5 deletions src/cactus/maf/cactus_hal2chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
from operator import itemgetter

from cactus.progressive.seqFile import SeqFile
from cactus.shared.common import setupBinaries, importSingularityImage
from cactus.shared.common import setupBinaries, importSingularityImage, cactus_fast_walltime
from cactus.shared.common import cactusRootPath
from cactus.shared.configWrapper import ConfigWrapper
from cactus.shared.common import makeURL, catFiles
from cactus.shared.common import enableDumpStack
from cactus.shared.common import cactus_override_toil_options
from cactus.shared.common import cactus_override_toil_options, add_cactus_toil_options
from cactus.shared.common import cactus_call
from cactus.shared.common import getOptionalAttrib, findRequiredNode
from cactus.shared.version import cactus_commit
Expand All @@ -41,6 +41,7 @@

def main():
parser = Job.Runner.getDefaultArgumentParser()
add_cactus_toil_options(parser)

parser.add_argument("halFile", help = "HAL file to convert to MAF")
parser.add_argument("outDir", help = "Output directory")
Expand Down Expand Up @@ -154,7 +155,7 @@ def main():
config.substituteAllPredefinedConstantsWithLiterals(options)

hal_id = toil.importFile(options.halFile)
chains_id_dict = toil.start(Job.wrapJobFn(hal2chains_workflow, config, options, hal_id))
chains_id_dict = toil.start(Job.wrapJobFn(hal2chains_workflow, config, options, hal_id, walltime=cactus_fast_walltime()))

#export the chains
for query_genome in chains_id_dict.keys():
Expand Down Expand Up @@ -183,8 +184,8 @@ def hal2chains_workflow(job, config, options, hal_id):
disk=int(hal_id.size * 1.2))
leaf_genomes = get_genomes_job.rv(0)
distance_matrix = get_genomes_job.rv(1)
chrom_info_job = get_genomes_job.addFollowOnJobFn(hal2chains_chrom_info_all, config, options, hal_id, leaf_genomes)
hal2chains_all_job = chrom_info_job.addFollowOnJobFn(hal2chains_all, config, options, hal_id, chrom_info_job.rv(), distance_matrix)
chrom_info_job = get_genomes_job.addFollowOnJobFn(hal2chains_chrom_info_all, config, options, hal_id, leaf_genomes, walltime=cactus_fast_walltime())
hal2chains_all_job = chrom_info_job.addFollowOnJobFn(hal2chains_all, config, options, hal_id, chrom_info_job.rv(), distance_matrix, walltime=cactus_fast_walltime())
return hal2chains_all_job.rv()

def hal2chains_check_tools(job, options):
Expand Down
19 changes: 10 additions & 9 deletions src/cactus/maf/cactus_hal2maf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
from operator import itemgetter

from cactus.progressive.seqFile import SeqFile
from cactus.shared.common import setupBinaries, importSingularityImage
from cactus.shared.common import setupBinaries, importSingularityImage, cactus_fast_walltime
from cactus.shared.common import cactusRootPath
from cactus.shared.configWrapper import ConfigWrapper
from cactus.shared.common import makeURL, catFiles
from cactus.shared.common import enableDumpStack
from cactus.shared.common import cactus_override_toil_options
from cactus.shared.common import cactus_override_toil_options, add_cactus_toil_options
from cactus.shared.common import cactus_call
from cactus.shared.common import getOptionalAttrib, findRequiredNode
from cactus.shared.common import clean_jobstore_files
Expand All @@ -44,6 +44,7 @@

def main():
parser = Job.Runner.getDefaultArgumentParser()
add_cactus_toil_options(parser)

parser.add_argument("halFile", help = "HAL file to convert to MAF")
parser.add_argument("outputMAF", help = "Output MAF (will be gzipped if ends in .gz). Suffix with .taf or .taf.gz if you want TAF output")
Expand Down Expand Up @@ -220,7 +221,7 @@ def main():

bed_id = toil.importFile(options.bedRanges) if options.bedRanges else None
hal_id = toil.importFile(options.halFile)
toil.start(Job.wrapJobFn(hal2maf_workflow, hal_id, bed_id, options, config))
toil.start(Job.wrapJobFn(hal2maf_workflow, hal_id, bed_id, options, config, walltime=cactus_fast_walltime()))

end_time = timeit.default_timer()
run_time = end_time - start_time
Expand All @@ -235,9 +236,9 @@ def hal2maf_workflow(job, hal_id, bed_id, options, config):

hal2maf_ranges_job = job.addChildJobFn(hal2maf_ranges, hal_id, bed_id, options, cores=1, disk=hal_id.size)
chunks, genome_list = hal2maf_ranges_job.rv(0), hal2maf_ranges_job.rv(1)
hal2maf_all_job = hal2maf_ranges_job.addFollowOnJobFn(hal2maf_all, hal_id, chunks, genome_list, options, config)
hal2maf_all_job = hal2maf_ranges_job.addFollowOnJobFn(hal2maf_all, hal_id, chunks, genome_list, options, config, walltime=cactus_fast_walltime())
hal2maf_merge_job = hal2maf_all_job.addFollowOnJobFn(hal2maf_merge_all, hal2maf_all_job.rv(), options, genome_list,
disk=hal_id.size)
disk=hal_id.size, walltime=cactus_fast_walltime())
hal2maf_ranges_job.addFollowOn(hal2maf_merge_job)
# note: merge job also handles exporting (and some cleanup), indexing and coverage

Expand Down Expand Up @@ -666,21 +667,21 @@ def hal2maf_merge_all(job, output_dicts, options, genome_list):
output_ext += '.gz'
if out_type != 'norm' and len(options.outType) > 1:
output_name += '.{}'.format(out_type)
export_job = merge_job.addFollowOnJobFn(export_file, merge_job.rv(), output_name + output_ext)
merge_job.addFollowOnJobFn(clean_jobstore_files, file_ids=maf_ids)
export_job = merge_job.addFollowOnJobFn(export_file, merge_job.rv(), output_name + output_ext, walltime=cactus_fast_walltime())
merge_job.addFollowOnJobFn(clean_jobstore_files, file_ids=maf_ids, walltime=cactus_fast_walltime())
if options.index:
index_job = merge_job.addFollowOnJobFn(taffy_index, merge_job.rv(), output_name + output_ext,
disk=int(1.1 * maf_size),
memory=cactus_clamp_memory(maf_size / 10))
index_job.addFollowOnJobFn(export_file, index_job.rv(), output_name + output_ext + '.tai')
index_job.addFollowOnJobFn(export_file, index_job.rv(), output_name + output_ext + '.tai', walltime=cactus_fast_walltime())


if options.coverage:
coverage_job = merge_job.addFollowOnJobFn(taffy_coverage, merge_job.rv(), output_name + output_ext,
genome_list, options,
disk=int(1.1 * maf_size),
memory=cactus_clamp_memory(maf_size / 10))
coverage_job.addFollowOnJobFn(export_file, coverage_job.rv(), output_name + output_ext + '.cov.tsv')
coverage_job.addFollowOnJobFn(export_file, coverage_job.rv(), output_name + output_ext + '.cov.tsv', walltime=cactus_fast_walltime())

return export_job.rv()

Expand Down
7 changes: 4 additions & 3 deletions src/cactus/maf/cactus_maf2bigmaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
from operator import itemgetter

from cactus.progressive.seqFile import SeqFile
from cactus.shared.common import setupBinaries, importSingularityImage
from cactus.shared.common import setupBinaries, importSingularityImage, cactus_fast_walltime
from cactus.shared.common import cactusRootPath
from cactus.shared.configWrapper import ConfigWrapper
from cactus.shared.common import makeURL, catFiles
from cactus.shared.common import enableDumpStack
from cactus.shared.common import cactus_override_toil_options
from cactus.shared.common import cactus_override_toil_options, add_cactus_toil_options
from cactus.shared.common import cactus_call
from cactus.shared.common import getOptionalAttrib, findRequiredNode
from cactus.shared.common import cactus_clamp_memory
Expand All @@ -36,6 +36,7 @@

def main():
parser = Job.Runner.getDefaultArgumentParser()
add_cactus_toil_options(parser)

parser.add_argument("mafFile", help = "MAF file to convert to BigMaf (can be gzipped)")
parser.add_argument("outFile", help = "Output bigMaf file (.bb)")
Expand Down Expand Up @@ -93,7 +94,7 @@ def main():
if options.halFile:
hal_id = toil.importFile(options.halFile)

bigmaf_id_dict = toil.start(Job.wrapJobFn(maf2bigmaf_workflow, config, options, maf_id, hal_id))
bigmaf_id_dict = toil.start(Job.wrapJobFn(maf2bigmaf_workflow, config, options, maf_id, hal_id, walltime=cactus_fast_walltime()))

#export the big maf
out_bm_path = makeURL(options.outFile)
Expand Down
Loading