Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs to explain cache #254

Merged
merged 5 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions docs/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,8 @@ requirements to run on these smaller datasets are:
For information on how to run the pipelines on larger datasets/computers/job-schedulers,
see :ref:`big job`.

If you are running the pipeline multiple times on the same dataset (e.g. different sets of
PGS) you can speed the pipeline up by cacheing the genotype harmonization and ancestry steps,
see :ref:`cache`.

If you are using an newer Mac computer with an M-series chip, see :ref:`arm`.
21 changes: 21 additions & 0 deletions docs/how-to/cache.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. _cache:

How do I speed up `pgsc_calc` computation times and avoid re-running code?
==========================================================================

If you intend to run `pgsc_calc` multiple times on the same target samples (e.g.
on different sets of PGS, with different variant matching flags) it is worth cacheing
information on invariant steps of the pipeline:

- Genotype harmonzation (variant relabeling steps)
- Steps of `--run_ancestry` that: match variants between the target and reference panel and
generate PCA loadings that can be used to adjust the PGS for ancestry.

To do this you must specify a directory that can store these information across runs using the
`--genotypes_cache` flag to the nextflow command (also see :ref:`param ref`). Future runs of the
pipeline that use the same cache directory should then skip these steps and proceed to run only the
steps needed to calculate new PGS. This is slightly different than using the `-resume command in
nextflow <https://www.nextflow.io/blog/2019/demystifying-nextflow-resume.html>`_ which mainly checks the
`work` directory and is more often used for restarting the pipeline when a specific step has failed
(e.g. for exceeding memory limits).

nebfield marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions docs/how-to/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Calculating polygenic scores
calculate_pgscatalog
multiple
ancestry
cache

Making genomic data and scorefiles compatible
---------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"genotypes_cache": {
"type": "string",
"default": "None",
"description": "A path to a directory that should contain relabelled genotypes",
"description": "Path to a directory that can store relabelled genotypes (and the reference panel intersections and PCA with --run_ancestry) to speed up new PGS calculations on previously harmonized samples",
"format": "directory-path"
},
"outdir": {
Expand Down
Loading