Giter VIP home page Giter VIP logo

angrymaciek / warlock Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 282 KB

Warlock is a snakemake workflow to spawn multiple demons (deme-based oncology models) as jobs running around on a cluster environment ๐Ÿ˜ˆ๐Ÿ˜ˆ

Home Page: https://github.com/AngryMaciek/warlock

License: Apache License 2.0

Shell 16.79% Python 71.09% Dockerfile 5.72% R 6.41%
mathematical-modelling oncology simulations applied-mathematics snakemake snakemake-workflow tumor tumor-evolution

warlock's Introduction

ci-pipeline CodeFactor Docker GitHub issues GitHub license Contributor Covenant DOI preprint Twitter

warlock ๐Ÿง™โ€โ™‚๏ธ

demon (deme-based oncology model) is a flexible framework for modelling intra-tumour population genetics with varied spatial structures and modes of cell dispersal. It is primarly designed for computational biologists and mathematicians who work in the field of ecology on a cellular level; investiaging mechanisms behind tumour evolution.

The following repository encapsulates demon into an automated and reproducible snakemake workflow in order to simplify parallel simulations to all users. Just as a regular warlock, it can spawn multiple demons (as cluster jobs), provided enough mystic powers (computational resources) are available.

Installation

The workflow is designed to run on Linux systems.
We have prepared a dedicated conda environment recipe which will contain all prerequisites required to execute the workflow. Thus Anaconda/Miniconda package manager is a natural dependency (see Appendix A for installation instructions.)

  1. Clone the repository and navigate inside that directory

    git clone https://github.com/AngryMaciek/warlock.git --recursive
    cd warlock

    Note: if you wish to compile a different version of demon (i.e. other branch) please remember to navigate to resources/demon_model first and git checkout a proper branch of that repository.

  2. Create and activate conda environment

    conda env create
    conda activate warlock
  3. Compile demon

    g++ resources/demon_model/src/demon.cpp -o resources/demon_model/bin/demon -I$HOME/miniconda3/envs/warlock/include -lm

    Note: remember to adjust miniconda3 (and its path) in the command above, in case you have a different manager installed on your system. All in all, the point is to provide the include directory of your warlock environment to the compiler.

  4. Create internal environments and install dependencies

    bash prepare-environments.sh
  5. Finally, feel free to verify the installation with a small test script

    bash testscript.sh

Configuration

For a detailed description of all available simulation parameters please inspect GitHub repository of the core demon model.

These parameters are now required to be set inside a YAML-formatted pipeline configuration file. A template for this file is available here. Please see an example configuration file designed for the CI tests here. Note that multiple values for distinct parameters might be provided in lists. Current implementation of the workflow prepares a Cartesian product of all parameter's values and runs demon with each of them in parallel.

Additionally, please notice that two absolute paths are required to be set in the same configuration file: path to this cloned repository as well as path for the analyses output directory.

Execution

This workflow should be executed via a top-level bash script: warlock.sh which has the following description:

This is the main script to call the _warlock_ workflow.
Available options:

  -c/--configfile {XXX} (REQUIRED)
  Path to the snakemake config file.

  -e/--environment {local/slurm} (REQUIRED)
  Environment to execute the workflow in:
  * local = execution on the local machine.
  * slurm = slurm cluster support.

  -n/--cores {XXX} (OPTIONAL)
  Number of cores available for the workflow.
  (Default = 1)

Local

Example command for a local workflow execution:

bash warlock.sh --configfile {PATH} --environment local

Docker container

We have additionally prepared a development/execution Docker image which one may use in order to run warlock in a fully encapsulated environment (that is, a container).
Assuming the Docker Engine is running locally please build the image with:

docker build -t warlock:latest .

To test the container one can execute the following bash command:

docker run --name warlock warlock bash -c "source ~/.bashrc; bash testscript.sh"

Finally, enter the container to start your work with:

docker run -it warlock:latest

Alternatively, please note that the image is also uploaded to DockerHub, one may download it with:

docker pull angrymaciek/warlock:latest

SLURM cluster

Example command for a cluster-supported workflow execution:

bash warlock.sh --configfile {PATH} --environment slurm

Please note that, depending on the complexity of the simulations, it might be required to adjust parameters for cluster jobs. If the expected required resources (memory or computation time) are high please adjust time and mem fields in the cluster submission configuration file, located at: /workflow/profiles/slurm/slurm-config.json.

Running large workflows with hundreds of cluster jobs might take very long; consider executing warlock in a terminal multiplexer, e.g. tmux.

Output

After each pipeline run the main output directory will contain three subdirectories: configfiles, simulations and logs. Each simulation run with a specific set of parameters is encoded by a 4-letter code. The first directory contains configuration files for each of the simulation runs; simulations contain all demon output files; logs keep captured standard output and error streams for the commands.

Community guidelines

For guidelines on how to contribute to the project or report issues, please see contributing instructions.
For other inquires feel free to contact project lead by email: โœ‰๏ธ

Citation

Results obtained with demon have already been published in:

Noble R, Burri D, Le Sueur C, Lemant J, Viossat Y, Kather JN, Beerenwinkel N. Spatial structure governs the mode of tumour evolution. Nat Ecol Evol. 2022 Feb;6(2):207-217. doi: https://doi.org/10.1038/s41559-021-01615-9

Noble R, Burley JT, Le Sueur C, Hochberg ME. When, why and how tumour clonal diversity predicts survival. Evol Appl. 2020 Jul 18;13(7):1558-1568. doi: https://doi.org/10.1111/eva.13057

Appendix A: Miniconda installation

To install the latest version of Miniconda on a Linux system please execute:

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
source .bashrc

For other platforms, see all available installers here.

warlock's People

Contributors

angrymaciek avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

warlock's Issues

ci: test the workflow

Refactor testfiles into a separate testdir, add various test config files.
Consult Rob for reasonable parameters

docs: agree on a proper name

We need to come up with a better name; demon-runner is just a placeholder (which I personally started to dislike heavily) as this is a runner (type of software) for the demon tool.

@robjohnnoble @vesmanojlovic @blair_colyer
Please write your suggestions in this issue. Most importantly, the name should be catchy. May or may not be descriptive, may or may not be an acronym depending on the choice. The more links we find between the name and "demon", "workflow", "pop.gen" etc. the better.

Also, and that is actually very important, there should not already exist another software with the same name in the same area (pop.gen/math.modeling).

mybinder does not start

Initial check.

  • I added a very descriptive title above.
  • I searched through the issues in this repository to find a similar problem, but didn't find any.
  • I searched through Google (including the 2nd page of results) and didn't find any relevant information.
  • I asked ChatGPT for help but did not get any meaningful response.

Please describe what triggered the error.

I clicked the mybinder shield in README

What did you expect to happen?

Start the Cloud notebook server

What went wrong?

Pushing image
Pushing image
Pushing image
Pushing image
Pushing image
Pushing image
Pushing image
Pushing image
Pushing image
Pushing image
Pushing image
Successfully pushed gesiscss/binder-r2d-g5b5b759-angrymaciek-2dwarlock-dd4b2f:bd6c4ac452a97a0882cad0743468e511aa3afbecBuilt image, launching...
Launching server...
Server requested
2023-05-04T10:09:33.050020Z [Normal] Successfully assigned gesis/jupyter-angrymaciek-2dwarlock-2delyf5tee to spko-css-app03
2023-05-04T10:09:33Z [Normal] Container image "jupyterhub/k8s-network-tools:2.0.0" already present on machine
2023-05-04T10:09:33Z [Normal] Created container block-cloud-metadata
2023-05-04T10:09:34Z [Normal] Started container block-cloud-metadata
2023-05-04T10:09:34Z [Normal] Pulling image "gesiscss/binder-r2d-g5b5b759-angrymaciek-2dwarlock-dd4b2f:bd6c4ac452a97a0882cad0743468e511aa3afbec"
2023-05-04T10:09:38Z [Warning] Failed to pull image "gesiscss/binder-r2d-g5b5b759-angrymaciek-2dwarlock-dd4b2f:bd6c4ac452a97a0882cad0743468e511aa3afbec": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/gesiscss/binder-r2d-g5b5b759-angrymaciek-2dwarlock-dd4b2f:bd6c4ac452a97a0882cad0743468e511aa3afbec": failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/gesiscss/binder-r2d-g5b5b759-angrymaciek-2dwarlock-dd4b2f/manifests/sha256:76fd0b95fd4ccc2fd853585228362675bb7ec9e5e289c3dc0a6c0e39489f5770: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
2023-05-04T10:09:38Z [Warning] Error: ErrImagePull
2023-05-04T10:09:38Z [Normal] Back-off pulling image "gesiscss/binder-r2d-g5b5b759-angrymaciek-2dwarlock-dd4b2f:bd6c4ac452a97a0882cad0743468e511aa3afbec"
2023-05-04T10:09:38Z [Warning] Error: ImagePullBackOff

Please specify your ๐˜ค๐˜ฐ๐˜ฏ๐˜ฅ๐˜ข version.

--

Operating System

Linux

Here you can specify more details regarding your operating system.

No response

Code of Conduct

Additional information

This seems like an error on Binder-DockerHub level; I should create an issue in a mybinder repo...

docs: README

Prepare a nice clean README with:

  • general info
  • shields
  • installation instruction
  • exec
  • instruction how to parse to output
  • conda
  • links to papers

add a devcontainer configuration

Add a .devcontainer.json file with configuration linked to the ../Dockerfile.
For some reason the container build on GitHub Codespaces but not through DevPod - clarify this!

// (same issue for fuzzyreg)

JOSS checklist

Go over the repository once again and clean-up according to the guidelines of JOSS for reviewers.


General checks

  • Repository: Is the source code for this software available at the repository url?
  • License: Does the repository contain a plain-text LICENSE file with the contents of an OSI approved software license?
  • Contribution and authorship: Has the submitting author made major contributions to the software? Does the full list of paper authors seem appropriate and complete?
  • Substantial scholarly effort: Does this submission meet the scope eligibility described in the JOSS guidelines

Functionality

  • Installation: Does installation proceed as outlined in the documentation?
  • Functionality: Have the functional claims of the software been confirmed?
  • Performance: If there are any performance claims of the software, have they been confirmed? (If there are no claims, please check off this item.)

Documentation

  • A statement of need: Do the authors clearly state what problems the software is designed to solve and who the target audience is?
  • Installation instructions: Is there a clearly-stated list of dependencies? Ideally these should be handled with an automated package management solution.
  • Example usage: Do the authors include examples of how to use the software (ideally to solve real-world analysis problems).
  • Functionality documentation: Is the core functionality of the software documented to a satisfactory level (e.g., API method documentation)?
  • Automated tests: Are there automated tests or manual steps described so that the functionality of the software can be verified?
  • Community guidelines: Are there clear guidelines for third parties wishing to 1) Contribute to the software 2) Report issues or problems with the software 3) Seek support

Software paper

  • Summary: Has a clear description of the high-level functionality and purpose of the software for a diverse, non-specialist audience been provided?
  • A statement of need: Do the authors clearly state what problems the software is designed to solve and who the target audience is?
  • State of the field: Do the authors describe how this software compares to other commonly-used packages?
  • Quality of writing: Is the paper well written (i.e., it does not require editing for structure, language, or writing quality)?
  • References: Is the list of references complete, and is everything cited appropriately that should be cited (e.g., papers, datasets, software)? Do references in the text use the proper citation syntax?

`docker.service` fails to start

Initial check.

  • I added a very descriptive title above.
  • I searched through the issues in this repository to find a similar problem, but didn't find any.
  • I searched through Google (including the 2nd page of results) and didn't find any relevant information.
  • I asked ChatGPT for help but did not get any meaningful response.

Please describe what triggered the error.

Installing docker and attempting to start it on Arch Linux via systemd.

What did you expect to happen?

Expected a local Docker engine to start running.

What went wrong?

ร— docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; preset: disabled)
     Active: failed (Result: exit-code) since Tue 2023-05-30 18:14:53 BST; 3min 21s ago
TriggeredBy: ร— docker.socket
       Docs: https://docs.docker.com
    Process: 55042 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
   Main PID: 55042 (code=exited, status=1/FAILURE)
        CPU: 111ms

May 30 18:14:53 vesheljinn systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
May 30 18:14:53 vesheljinn systemd[1]: Stopped Docker Application Container Engine.
May 30 18:14:53 vesheljinn systemd[1]: docker.service: Start request repeated too quickly.
May 30 18:14:53 vesheljinn systemd[1]: docker.service: Failed with result 'exit-code'.
May 30 18:14:53 vesheljinn systemd[1]: Failed to start Docker Application Container Engine.

Please specify your ๐˜ค๐˜ฐ๐˜ฏ๐˜ฅ๐˜ข version.

23.3.1

Operating System

Linux

Here you can specify more details regarding your operating system.

No response

Code of Conduct

Additional information

No response

feat: consider full macOS support

Include a local execution on a macOS system.

  • compilation commands in the CI
  • compilation notes into the README

Compilation command which works on macOS:

$ ~/miniconda3/envs/demon-runner/bin/clang++  workflow/src/demon.cpp -o workflow/bin/demon -I$HOME/miniconda3/envs/demon-runner/include -lm

demon requires gnuplot internally but it does not fail without that dependency it just does not generate intermediate plots (?). I leave it as is.

double-check final output of demon / linking

Should we link by output.dat or maybe some other file?
Or maybe we should create an artificial temp. file if and only if demon finished successfully, link rules by this file and then delete it?
Or maybe incorporate a tempfile at the end of demon?

Ask Rob

Minor comments

  • Compilation command needs to be updated in the binder notebook
  • refer in the README to the demon_model config
  • doi

feat: allow to clone a specific commit from demon

Is your feature request related to a problem? Please describe.
Sometimes the user would like to run a specific branch of demon with an adjusted version of the model.

Describe the solution you'd like
Allow to clone a specific branch/commit.

refactor: include various cool repo mechanisms

Include some new cool GitHub repo mechanisms I have learned recently:

  • add codefactor check + shield for code quality
  • run_demon stdout/err logs suffix file fix
  • add twitter shield for #warlock tweets
  • add local testscript for reviewers
  • add .gitattributes w/ langauges, .gitignore refactor
  • add PR workflows: title check + auto assign
  • configure Gitpod env for cloud dev: compile demon model separately
  • new & beautiful issue/PR templates
  • del PULL_REQUEST_TEMPLATE.md, adjust ci name, clean all templates
  • version file + autotag ci
  • refactor Contributing: better instructions, specific rules, more tests
  • add a Changelog + Changelog update workflow
  • add a Dockerfile run/dev

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.