mgnify-pipelines-toolkit


Namemgnify-pipelines-toolkit JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryCollection of scripts and tools for MGnify pipelines
upload_time2024-04-26 11:44:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseApache Software License 2.0
keywords bioinformatics pipelines metagenomics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mgnify-pipelines-toolkit

This Python package contains a collection of scripts and tools for including in MGnify pipelines. Scripts stored here are mainly for:

- One-off production scripts that perform specific tasks in pipelines
- Scripts that have few dependencies
- Scripts that don't have existing containers built to run them
- Scripts for which building an entire container would be too bulky of a solution to deploy in pipelines

This package is built and uploaded to PyPi and bioconda. The package bundles scripts and makes them executable from the command-line when this package is installed.

## How to install

This package is available both on [PyPi](https://pypi.org/project/mgnify-pipelines-toolkit/) and bioconda.

To install from PyPi with pip:

`pip install mgnify-pipelines-toolkit`

To install from bioconda with conda/mamba:

`conda install -c bioconda mgnify-pipelines-toolkit`

You should then be able to run the packages from the command-line. For example to run the `get_subunits.py` script:

`get_subunits -i ${easel_coords} -n ${meta.id}`

## Adding a new script to the package

### New script requirements

There are a few requirements for your script:

- It needs to have a named main function of some kind. See `mgnify_pipelines_toolkit/analysis/shared/get_subunits.py` and the `main()` function for an example
- Because this package is meant to be run from the command-line, make sure your script can easily pass arguments using tools like `argparse` or `click`
- A small amount of dependencies. This requirement is subjective, but for example if your script only requires a handful of basic packages like `Biopython`, `numpy`, `pandas`, etc., then it's fine. However if the script has a more extensive list of dependencies, a container is probably a better fit.

### How to add a new script

To add a new Python script, first copy it over to the `mgnify_pipelines_toolkit` directory in this repository, specifically to the subdirectory that makes the most sense. If none of the subdirectories make sense for your script, create a new one. If your script doesn't have a `main()` type function yet, write one.

Then, open `pyproject.toml` as you will need to add some bits. First, add any missing dependencies (include the version) to the `dependencies` field.

Then, if you created a new subdirectory to add your script in, go to the `packages` line under `[tool.setuptools]` and add the new subdirectory following the same syntax.

Then, scroll down to the `[project.scripts]` line. Here, you will create an alias command for running your script from the command-line. In the example line:

`get_subunits = "mgnify_pipelines_toolkit.analysis.shared.get_subunits:main"`

- `get_subunits` is the alias
- `mgnify_pipelines_toolkit.analysis.shared.get_subunits` will link the alias to the script with the path `mgnify_pipelines_toolkit/analysis/shared/get_subunits.py`
- `:main` will specifically call the function named `main()` when the alias is run.

When you have setup this command, executing `get_subunits` on the command-line will be the equivalent of doing:

`from mgnify_pipelines_toolkit.analysis.shared.get_subunits import main; main()`

You should then write at least one unit test for your addition. This package uses `pytest` at the moment for this purpose. A GitHub Action workflow will run all of the unit tests whenever a commit is pushed to any branch.

Finally, you will need to bump up the version in the `version` line.

At the moment, these should be the only steps required to setup your script in this package (which is subject to change).

### Building and uploading to PyPi

The building and pushing of the package is automated by GitHub Actions, which will activate only on a new release. Bioconda should then automatically pick up the new PyPi release and push it to their recipes, though it's worth keeping an eye on their automated pull requests just in case [here](https://github.com/bioconda/bioconda-recipes/pulls).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mgnify-pipelines-toolkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "bioinformatics, pipelines, metagenomics",
    "author": null,
    "author_email": "MGnify team <metagenomics-help@ebi.ac.uk>",
    "download_url": "https://files.pythonhosted.org/packages/25/c8/a8718d38c599ed9f9fc185075ad3cd91b7201a4f9062e63d89baf7f01b57/mgnify_pipelines_toolkit-0.1.2.tar.gz",
    "platform": null,
    "description": "# mgnify-pipelines-toolkit\n\nThis Python package contains a collection of scripts and tools for including in MGnify pipelines. Scripts stored here are mainly for:\n\n- One-off production scripts that perform specific tasks in pipelines\n- Scripts that have few dependencies\n- Scripts that don't have existing containers built to run them\n- Scripts for which building an entire container would be too bulky of a solution to deploy in pipelines\n\nThis package is built and uploaded to PyPi and bioconda. The package bundles scripts and makes them executable from the command-line when this package is installed.\n\n## How to install\n\nThis package is available both on [PyPi](https://pypi.org/project/mgnify-pipelines-toolkit/) and bioconda.\n\nTo install from PyPi with pip:\n\n`pip install mgnify-pipelines-toolkit`\n\nTo install from bioconda with conda/mamba:\n\n`conda install -c bioconda mgnify-pipelines-toolkit`\n\nYou should then be able to run the packages from the command-line. For example to run the `get_subunits.py` script:\n\n`get_subunits -i ${easel_coords} -n ${meta.id}`\n\n## Adding a new script to the package\n\n### New script requirements\n\nThere are a few requirements for your script:\n\n- It needs to have a named main function of some kind. See `mgnify_pipelines_toolkit/analysis/shared/get_subunits.py` and the `main()` function for an example\n- Because this package is meant to be run from the command-line, make sure your script can easily pass arguments using tools like `argparse` or `click`\n- A small amount of dependencies. This requirement is subjective, but for example if your script only requires a handful of basic packages like `Biopython`, `numpy`, `pandas`, etc., then it's fine. However if the script has a more extensive list of dependencies, a container is probably a better fit.\n\n### How to add a new script\n\nTo add a new Python script, first copy it over to the `mgnify_pipelines_toolkit` directory in this repository, specifically to the subdirectory that makes the most sense. If none of the subdirectories make sense for your script, create a new one. If your script doesn't have a `main()` type function yet, write one.\n\nThen, open `pyproject.toml` as you will need to add some bits. First, add any missing dependencies (include the version) to the `dependencies` field.\n\nThen, if you created a new subdirectory to add your script in, go to the `packages` line under `[tool.setuptools]` and add the new subdirectory following the same syntax.\n\nThen, scroll down to the `[project.scripts]` line. Here, you will create an alias command for running your script from the command-line. In the example line:\n\n`get_subunits = \"mgnify_pipelines_toolkit.analysis.shared.get_subunits:main\"`\n\n- `get_subunits` is the alias\n- `mgnify_pipelines_toolkit.analysis.shared.get_subunits` will link the alias to the script with the path `mgnify_pipelines_toolkit/analysis/shared/get_subunits.py`\n- `:main` will specifically call the function named `main()` when the alias is run.\n\nWhen you have setup this command, executing `get_subunits` on the command-line will be the equivalent of doing:\n\n`from mgnify_pipelines_toolkit.analysis.shared.get_subunits import main; main()`\n\nYou should then write at least one unit test for your addition. This package uses `pytest` at the moment for this purpose. A GitHub Action workflow will run all of the unit tests whenever a commit is pushed to any branch.\n\nFinally, you will need to bump up the version in the `version` line.\n\nAt the moment, these should be the only steps required to setup your script in this package (which is subject to change).\n\n### Building and uploading to PyPi\n\nThe building and pushing of the package is automated by GitHub Actions, which will activate only on a new release. Bioconda should then automatically pick up the new PyPi release and push it to their recipes, though it's worth keeping an eye on their automated pull requests just in case [here](https://github.com/bioconda/bioconda-recipes/pulls).\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "Collection of scripts and tools for MGnify pipelines",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [
        "bioinformatics",
        " pipelines",
        " metagenomics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fda5394354bd2e3afdc68abd34fa29a34a3e5a924bf773fa70bd207307d01e5",
                "md5": "85f2bbe779eb327bc3b085d05972220c",
                "sha256": "13c7ef911ff2fee8ec73fa11637900ff9c4df63aeca5e959e95631dfd87b25bd"
            },
            "downloads": -1,
            "filename": "mgnify_pipelines_toolkit-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "85f2bbe779eb327bc3b085d05972220c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 43847,
            "upload_time": "2024-04-26T11:44:26",
            "upload_time_iso_8601": "2024-04-26T11:44:26.663931Z",
            "url": "https://files.pythonhosted.org/packages/6f/da/5394354bd2e3afdc68abd34fa29a34a3e5a924bf773fa70bd207307d01e5/mgnify_pipelines_toolkit-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25c8a8718d38c599ed9f9fc185075ad3cd91b7201a4f9062e63d89baf7f01b57",
                "md5": "89389399f7d9e0cb9805423bdade9fc3",
                "sha256": "d120b42e175468d909c30aeed53c6e7343be57b13cb41a4cd5e7798bfa5e9d78"
            },
            "downloads": -1,
            "filename": "mgnify_pipelines_toolkit-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "89389399f7d9e0cb9805423bdade9fc3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 29947,
            "upload_time": "2024-04-26T11:44:28",
            "upload_time_iso_8601": "2024-04-26T11:44:28.213072Z",
            "url": "https://files.pythonhosted.org/packages/25/c8/a8718d38c599ed9f9fc185075ad3cd91b7201a4f9062e63d89baf7f01b57/mgnify_pipelines_toolkit-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-26 11:44:28",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mgnify-pipelines-toolkit"
}
        
Elapsed time: 0.26228s