# Crimson
[](https://pypi.org/project/crimson)
[](https://github.com/bow/crimson/actions?query=branch%3Amaster)
[](https://codeclimate.com/github/bow/crimson/test_coverage)
Crimson converts non-standard bioinformatics tool outputs to JSON or YAML.
Currently it can convert outputs of the following tools:
* [FastQC](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/>) (``fastqc``)
* [FusionCatcher](https://github.com/ndaniel/fusioncatcher) (``fusioncatcher``)
* [samtools](http://www.htslib.org/doc/samtools.html) flagstat (``flagstat``)
* [Picard](https://broadinstitute.github.io/picard/) metrics tools (``picard``)
* [STAR](https://github.com/alexdobin/STAR) log file (``star``)
* [STAR-Fusion](https://github.com/STAR-Fusion/STAR-Fusion) hits table (``star-fusion``)
* [Variant Effect Predictor](http://www.ensembl.org/info/docs/tools/vep/index.html)
plain text output (``vep``)
For each conversion, there are two execution options: as command line tool or as a Python
library function. The first alternative uses `crimson` as a command-line tool. The second one
requires importing the `crimson` library in your program.
## Installation
Crimson is available on the [Python Package Index](https://pypi.org/project/crimson/)
and you can install it via ``pip``:
```shell
$ pip install crimson
```
It is also available on
[BioConda](https://bioconda.github.io/recipes/crimson/README.html), both through the
`conda` package manager or as a
[Docker container](https://quay.io/repository/biocontainers/crimson?tab=tags).
For Docker execution, you may also use
[the GitHub Docker registry](https://github.com/bow/crimson/pkgs/container/crimson). This
registry hosts the latest version, but does not host versions 1.1.0 or earlier.
```shell
docker pull ghcr.io/bow/crimson
```
## Usage
### As a command line tool
The general command is `crimson {tool_name}`. By default, the output is written to
`stdout`. For example, to use the `picard` parser, you would execute:
```shell
$ crimson picard /path/to/a/picard.metrics
```
You can also write the output to a file by specifying a file name. The following
command writes the output to a file named `converted.json`:
```shell
$ crimson picard /path/to/a/picard.metrics converted.json
```
Some parsers may accept additional input formats. The FastQC parser, for example, also
accepts a path to a FastQC output directory as its input:
```shell
$ crimson fastqc /path/to/a/fastqc/dir
```
It also accepts a path to a zipped result:
```shell
$ crimson fastqc /path/to/a/fastqc_result.zip
```
When in doubt, use the ``--help`` flag:
```shell
$ crimson --help # for the general help
$ crimson fastqc --help # for the parser-specific help, in this case FastQC
```
### As a Python library function
The specific function to import is generally located at `crimson.{tool_name}.parser`. So to
use the `picard` parser in your program, you can do:
```python
from crimson import picard
# You can specify the input file name as a string or path-like object...
parsed = picard.parse("/path/to/a/picard.metrics")
# ... or a file handle
with open("/path/to/a/picard.metrics") as src:
parsed = picard.parse(src)
```
## Why?
* Not enough tools use standard output formats.
* Writing and re-writing the same parsers across different scripts is not a productive
way to spend the day.
## Local Development
Setting up a local development requires that you set up all of the supported Python
versions. We use [pyenv](https://github.com/pyenv/pyenv) for this.
```shell
# Clone the repository and cd into it.
$ git clone https://github.com/bow/crimson
$ cd crimson
# Create your local development environment. This command also installs
# all supported Python versions using `pyenv`.
$ make env
# Run the test and linter suite to verify the setup.
$ make lint test
# When in doubt, just run `make` without any arguments.
$ make
```
## Contributing
If you are interested, Crimson accepts the following types contribution:
* Documentation updates / tweaks (if anything seems unclear, feel free to open an issue)
* Bug reports
* Support for tools' outputs which can be converted to JSON or YAML
For any of these, feel free to open an issue in the [issue
tracker](https://github.com/bow/crimson/issues>) or submit a pull request.
## License
Crimson is BSD-licensed. Refer to the ``LICENSE`` file for the full license.
Raw data
{
"_id": null,
"home_page": "https://github.com/bow/crimson",
"name": "crimson",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "bioinformatics,json,yaml",
"author": "Wibowo Arindrarto",
"author_email": "contact@arindrarto.dev",
"download_url": "https://files.pythonhosted.org/packages/d3/4c/5cae5b14b05e34db95b6438372f83b663afbf175e0e7d8c15332e2a30aaa/crimson-1.1.1.tar.gz",
"platform": null,
"description": "# Crimson\n\n[](https://pypi.org/project/crimson)\n[](https://github.com/bow/crimson/actions?query=branch%3Amaster)\n[](https://codeclimate.com/github/bow/crimson/test_coverage)\n\n\nCrimson converts non-standard bioinformatics tool outputs to JSON or YAML.\n\nCurrently it can convert outputs of the following tools:\n\n * [FastQC](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/>) (``fastqc``)\n * [FusionCatcher](https://github.com/ndaniel/fusioncatcher) (``fusioncatcher``)\n * [samtools](http://www.htslib.org/doc/samtools.html) flagstat (``flagstat``)\n * [Picard](https://broadinstitute.github.io/picard/) metrics tools (``picard``)\n * [STAR](https://github.com/alexdobin/STAR) log file (``star``)\n * [STAR-Fusion](https://github.com/STAR-Fusion/STAR-Fusion) hits table (``star-fusion``)\n * [Variant Effect Predictor](http://www.ensembl.org/info/docs/tools/vep/index.html)\n plain text output (``vep``)\n\nFor each conversion, there are two execution options: as command line tool or as a Python\nlibrary function. The first alternative uses `crimson` as a command-line tool. The second one\nrequires importing the `crimson` library in your program.\n\n\n## Installation\n\nCrimson is available on the [Python Package Index](https://pypi.org/project/crimson/)\nand you can install it via ``pip``:\n\n```shell\n$ pip install crimson\n```\n\nIt is also available on\n[BioConda](https://bioconda.github.io/recipes/crimson/README.html), both through the\n`conda` package manager or as a\n[Docker container](https://quay.io/repository/biocontainers/crimson?tab=tags).\n\nFor Docker execution, you may also use\n[the GitHub Docker registry](https://github.com/bow/crimson/pkgs/container/crimson). This\nregistry hosts the latest version, but does not host versions 1.1.0 or earlier.\n\n```shell\ndocker pull ghcr.io/bow/crimson\n```\n\n\n## Usage\n\n### As a command line tool\n\nThe general command is `crimson {tool_name}`. By default, the output is written to\n`stdout`. For example, to use the `picard` parser, you would execute:\n\n```shell\n$ crimson picard /path/to/a/picard.metrics\n```\n\nYou can also write the output to a file by specifying a file name. The following\ncommand writes the output to a file named `converted.json`:\n\n```shell\n$ crimson picard /path/to/a/picard.metrics converted.json\n```\n\nSome parsers may accept additional input formats. The FastQC parser, for example, also\naccepts a path to a FastQC output directory as its input:\n\n\n```shell\n$ crimson fastqc /path/to/a/fastqc/dir\n```\n\nIt also accepts a path to a zipped result:\n\n```shell\n$ crimson fastqc /path/to/a/fastqc_result.zip\n```\n\nWhen in doubt, use the ``--help`` flag:\n\n```shell\n$ crimson --help # for the general help\n$ crimson fastqc --help # for the parser-specific help, in this case FastQC\n```\n\n### As a Python library function\n\nThe specific function to import is generally located at `crimson.{tool_name}.parser`. So to\nuse the `picard` parser in your program, you can do:\n\n```python\nfrom crimson import picard\n\n# You can specify the input file name as a string or path-like object...\nparsed = picard.parse(\"/path/to/a/picard.metrics\")\n\n# ... or a file handle\nwith open(\"/path/to/a/picard.metrics\") as src:\n parsed = picard.parse(src)\n```\n\n## Why?\n\n * Not enough tools use standard output formats.\n * Writing and re-writing the same parsers across different scripts is not a productive\n way to spend the day.\n\n\n## Local Development\n\nSetting up a local development requires that you set up all of the supported Python\nversions. We use [pyenv](https://github.com/pyenv/pyenv) for this.\n\n```shell\n# Clone the repository and cd into it.\n$ git clone https://github.com/bow/crimson\n$ cd crimson\n\n# Create your local development environment. This command also installs\n# all supported Python versions using `pyenv`.\n$ make env\n\n# Run the test and linter suite to verify the setup.\n$ make lint test\n\n# When in doubt, just run `make` without any arguments.\n$ make\n```\n\n\n## Contributing\n\nIf you are interested, Crimson accepts the following types contribution:\n\n * Documentation updates / tweaks (if anything seems unclear, feel free to open an issue)\n * Bug reports\n * Support for tools' outputs which can be converted to JSON or YAML\n\nFor any of these, feel free to open an issue in the [issue\ntracker](https://github.com/bow/crimson/issues>) or submit a pull request.\n\n\n## License\n\nCrimson is BSD-licensed. Refer to the ``LICENSE`` file for the full license.\n\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Bioinformatics tool outputs converter to JSON or YAML",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://github.com/bow/crimson",
"Repository": "https://github.com/bow/crimson"
},
"split_keywords": [
"bioinformatics",
"json",
"yaml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "96925e3a134c20e2ee02ff86ac2bcdfe781172937467e49207f7d73ca62c8800",
"md5": "9e3e4d0ff45f3b871137556a91cb686a",
"sha256": "837db07437d983ada803aef456c76f6c6c792124f8e7fffae413377c1bf4c431"
},
"downloads": -1,
"filename": "crimson-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9e3e4d0ff45f3b871137556a91cb686a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 22955,
"upload_time": "2023-07-28T21:32:25",
"upload_time_iso_8601": "2023-07-28T21:32:25.824711Z",
"url": "https://files.pythonhosted.org/packages/96/92/5e3a134c20e2ee02ff86ac2bcdfe781172937467e49207f7d73ca62c8800/crimson-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d34c5cae5b14b05e34db95b6438372f83b663afbf175e0e7d8c15332e2a30aaa",
"md5": "0f04a6a17086b3f3eb80e0666528e683",
"sha256": "bdc54961dbb29cfd9479c310f382475820e80f7158ebc2a732f756dc72b7978d"
},
"downloads": -1,
"filename": "crimson-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "0f04a6a17086b3f3eb80e0666528e683",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 20138,
"upload_time": "2023-07-28T21:32:27",
"upload_time_iso_8601": "2023-07-28T21:32:27.643336Z",
"url": "https://files.pythonhosted.org/packages/d3/4c/5cae5b14b05e34db95b6438372f83b663afbf175e0e7d8c15332e2a30aaa/crimson-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-28 21:32:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bow",
"github_project": "crimson",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "crimson"
}