Giter Club home page Giter Club logo

crimson's Introduction

Crimson

ci coverage pypi

Crimson converts non-standard bioinformatics tool outputs to JSON or YAML.

Currently it accepts outputs of the following programs:

From those, you can convert the respective output files into JSON (the default) or YAML. You can also use crimson in your scripts by importing the parser functions themselves.

Installation

Crimson is available via the Python Package Index and you can install it via pip:

$ pip install crimson

It is tested on Python 2.7, Python 3.3, and Python 3.4, Python 3.5, Python 3.6, and against the following bioinformatics tools:

  • FastQC (version 0.10.1)
  • FusionCatcher (version 0.99.5a)
  • samtools (version 0.19.1, 1.1)
  • Picard (version 1.124)
  • STAR (version 2.3.0)
  • STAR-Fusion (version 0.6.0)
  • VEP (version 77)

Usage

Command-line

The general command is crimson {program_name} and by default the output is written to stdout. For example, to use the picard parser, you would execute:

$ crimson picard /path/to/a/picard.metrics

You can also specify a file name directly to write to a file. The following command will write the output to a file named converted.json:

$ crimson picard /path/to/a/picard.metrics converted.json

Some parsers may also accept additional input format. The FastQC parser, for example, also works if you give it a path to the FastQC output directory:

$ crimson fastqc /path/to/a/fastqc/dir

or path to a zipped result:

$ crimson fastqc /path/to/a/fastqc_result.zip

When in doubt, use the --help flag:

$ crimson --help            # for the general help
$ crimson fastqc --help     # for parser-specific (FastQC) help

Python Module

The function to import is located at crimson.{program_name}.parser. So to use the picard parser in your script, you can do this:

from crimson import picard

# You can supply the file name as string ...
parsed = picard.parse("/path/to/a/picard.metrics")

# ... or a file handle directly
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.

Contributing

If you are interested, Crimson accepts the following types contribution:

  • Documentation additions (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 or submitt a pull request.

License

Crimson is BSD-licensed. Refer to the LICENSE file for the full license.

crimson's People

Contributors

bow avatar ernfrid avatar

Stargazers

Keyth M Citizen  avatar

Watchers

David Brawand avatar James Cloos avatar Phil Davidson avatar

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.