Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Jul 8, 2024
0 parents commit 9389558
Show file tree
Hide file tree
Showing 39 changed files with 1,037 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: [bug]
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: [enhancement]
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Describe your changes

<!-- Describe your changes -->

## Checklist before requesting a review
- [ ] I have performed a self-review of my code

- Check the correct box. Does this PR contain:
- [ ] Breaking changes
- [ ] New functionality
- [ ] Major changes
- [ ] Minor changes
- [ ] Bug fixes

- [ ] Proposed changes are described in the CHANGELOG.md

- [ ] CI Tests succeed and look good!
21 changes: 21 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build

on:
push:
branches: [ 'main' ]
workflow_dispatch:
inputs:
version:
description: |
The version of the project to build. Example: `1.0.3`.
If not provided, a development build with a version name
based on the branch name will be built. Otherwise, a release
build with the provided version will be built.
required: false

jobs:
build:
uses: openproblems-bio/actions/.github/workflows/build.yml@main
with:
version: ${{ github.event.inputs.version }}
9 changes: 9 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Test

on:
push:
pull_request:

jobs:
build:
uses: openproblems-bio/actions/.github/workflows/test.yml@main
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources
resources_test
work
.nextflow*
target
.vscode
.DS_Store
output
trace-*
.ipynb_checkpoints
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "common"]
path = common
url = https://github.com/openproblems-bio/common_resources.git
Empty file added CHANGELOG.md
Empty file.
121 changes: 121 additions & 0 deletions INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Instructions

This is a guide on what to do after you have created a new task repository from the template. More in depth information about how to create a new task can be found in the [OpenProblems Documentation](https://openproblems.bio/documentation/create_task/).

## Requirments

A list of required software to start developing a new task can be found in the [OpenProblems Requirements](https://openproblems.bio/documentation/create_task/requirements).

## First things first

### `_viash.yaml`

* Update the `name` field to the name of the task in snake_case the nane should start with `task_`.
* Update the `description` field to a short description of the task.
* Add a keyword to the `keywords` field that describes the task.
* Update the `task_template` in the links/info field to the name of the task in snake_case.

### `task_info.yaml`

* Update the `src/api/task_info.yaml` file with the information you have provided in the task issue.
* Update the `<task_name>` in the `readme` field to the name of the task.

### `common` submodule

If the submodule does not show any files, you will need to initialize the `common` submodule by running the following command:

```bash
git submodule update --init --recursive
```

To update the repository with the latest changes from in the submodule, you can run the following command:

```bash
git pull --recurse-submodules
```

## Resources

The OpenProblems team has provided some test resources that can be used to test the task. These resources are stored in the `resources_test` folder. The `scripts/download_resources.sh` script can be used to download these resources.
If these resources are not sufficient, you can add more resources to the `resources_test` folder. The `scripts/download_resources.sh` script can be updated to download these resources. When using new test resources let the OP team know so they can be added to the s3 bucket.

```bash
scripts/download_resources.sh
```

## Next steps

### API files ([docs](https://openproblems.bio/documentation/create_task/design_api))

Update the API files in the `src/api` folder. These files define the input and output of the methods and metrics.

### Components ([docs](https://openproblems.bio/documentation/create_task/create_components))

To create a component, you can run the respective script in the `script` directory. Before running the script make sure to update the variables `task_name`, `component_name` and `component_lang` and save the file. For additionale components ou will only need to update the `component_name` and `component_lang` variables.

```bash
scripts/add_a_control_method.sh
```

```bash
scripts/add_a_method.sh
```

```bash
scripts/add_a_metric.sh
```

For each type of component there already is a first component created that you can modify.

1. Update the `.info` fields in the `config.vsh.yaml`.
2. Add any component specific arguments to the `config.vsh.yaml` file.
3. Add any additional reqources that are required for the component.
4. Update the docker engine image setup if additional packages are required.
5. If you know the required memory and or CPU you can adjust the nextflow `.directive.labels` field. In addition if your component requires a GPU you can add the `gpu` label to the field.
6. Update the `script.py` or `script.R` file with the code for the component.

> [!NOTE]
> You can remove the comments in the `config.vsh.yaml` file after you have updated the file.
### Testing Components ([docs](https://openproblems.bio/documentation/create_component/run_tests))

You can test the component by running the following command:

```bash
viash test /path/to/config.vsh.yaml
```

Y0u can also test all components by running the following command:

```bash
scripts/test_all_components.sh
```

It is possible to custumise the command in the above script by adding a `-q` argument to only perform the test on for example methods e.g. ` -q methods`.


## Dataset processor ([docs](https://openproblems.bio/documentation/create_task/dataset_processor))

The dataset processor is a script that removes all unnecesary info from the dataset for your task. This info is defined in the `api/file_common_dataset.yaml` file. From this filtered dataset several files are created that are used by the methods and metrics. Safeguarding data leaks and laking sure the structure of the data cannot be altered for a method or a metric.

To create the dataprocessor there is no template available. You can follow the guideline in the documentation. Store the processor in the `src/process_dataset` folder.

Be sure to update the `file_common_dataset.yaml` file with the correct information required for the methods/metrics.

> [!IMPORTANT]
> When using your own datasets please advise the openproblems team on how to add these datasets to the s3 bucket.
> As the dataset processor should make use of the `common` datasets folder in the `resources` or `resources_test` directory.
To create the resources and test_resources for the task we will create a nextflow workflow that will process the datasets. This workflow will be created together with the openproblems team.

## README

To create the task `README` file preform following command:

```bash
scripts/create_readme.sh
```

## Benchmarking ([docs](https://openproblems.bio/documentation/create_task/create_workflow))

When you are finished with creating your components and datset processor you can create a workflow to benchmark the components. This workflow will be created together with the openproblems team.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Open Problems in Single-Cell Analysis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Task Template

This repo is a template to create a new task for the OpenProblems v2. This repo contains several example files and components that can be used when updated with the task info.

> [!WARNING]
> This README will be overwritten when performing the `create_task_readme` script.
## Create a repository from this template

> [!IMPORTANT]
> Before creating a new repository, make sure you are part of the openProblems task team. This will be done when you create an issue for the task and you got the go ahead to create the task.
> For more information on how to create a new task, check out the [Create a new task](https://openproblems.bio/documentation/create_task/) documentation.
The instructions below will guide you through creating a new repository from this template ([creating-a-repository-from-a-template](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template#creating-a-repository-from-a-template)).


* Click the "Use this template" button on the top right of the repository.
* Use the Owner dropdown menu to select the `openproblems-bio` account.
* Type a name for your repository (task_...), and a description.
* Set the repository visibility to public.
* Click "Create repository from template".

## Clone the repository

To clone the repository with the submodule files, you can use the following command:

```bash
git clone --recursive [email protected]:openproblems-bio/task_spatial_simulators.git
```

If you already cloned the repository and forgot to use the `--recursive` flag, you can use the following command to update the submodules:

```bash
git submodule update --init --recursive
```

## What to do next

Check out the [instructions](common/INSTRUCTIONS.md) for more information on how to update the example files and components. These instructions also contain information on how to build out the task and basic commands.

For more information on the OpenProblems v2, check out the [Documentation](https://openproblems.bio/documentation/).
25 changes: 25 additions & 0 deletions _viash.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
viash_version: 0.9.0-RC6

name: task_template
organization: openproblems-bio
description: |
An OpenProblems benchmark task.
license: MIT
keywords: [single-cell, openproblems, benchmark]
links:
issue_tracker: https://github.com/openproblems-bio/task_template/issues
repository: https://github.com/openproblems-bio/task_template
docker_registry: ghcr.io
info:
test_resources:
- type: s3
path: s3://openproblems-data/resources_test/task_template
dest: resources_test/task_template
- type: s3
path: s3://openproblems-data/resources_test/common/
dest: resources_test/common

version: dev

config_mods: |
.runners[.type == "nextflow"].config.labels := { lowmem : "memory = 20.Gb", midmem : "memory = 50.Gb", highmem : "memory = 100.Gb", lowcpu : "cpus = 5", midcpu : "cpus = 15", highcpu : "cpus = 30", lowtime : "time = 1.h", midtime : "time = 4.h", hightime : "time = 8.h", veryhightime : "time = 24.h" }
1 change: 1 addition & 0 deletions common
Submodule common added at 04a1b2
3 changes: 3 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
workflow {
print("This is a dummy placeholder for pipeline execution. Please use the corresponding nf files for running pipelines.")
}
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
process.container = 'nextflow/bash:latest'
12 changes: 12 additions & 0 deletions scripts/add_a_control_method.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

task_name="task_template"
component_name="my_control_method"
component_lang="python" # change this to "r" if need be

common/create_component/create_component \
--task $task_name \
--language "$component_lang" \
--name "$component_name" \
--api_file src/api/comp_control_method.yaml \
--output "src/control_methods/$component_name"
12 changes: 12 additions & 0 deletions scripts/add_a_method.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

task_name="task_template"
component_name="my_method"
component_lang="python" # change this to "r" if need be

common/create_component/create_component \
--task $task_name \
--language "$component_lang" \
--name "$component_name" \
--api_file src/api/comp_method.yaml \
--output "src/methods/$component_name"
12 changes: 12 additions & 0 deletions scripts/add_a_metric.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

task_name="task_template"
component_name="my_metric"
component_lang="python" # change this to "r" if need be

common/create_component/create_component \
--task $task_name \
--language "$component_lang" \
--name "$component_name" \
--api_file src/api/comp_metric.yaml \
--output "src/metrics/$component_name"
5 changes: 5 additions & 0 deletions scripts/create_readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

common/create_task_readme/create_task_readme \
--task_dir src \
--output README.md
Loading

0 comments on commit 9389558

Please sign in to comment.