BanzaiDB v0.1.1 - Database tool for the Banzai NGS pipeline (http://github.com/mscook/BanzaiDB)
Create the CLI parser
Returns: | a parser with subparsers: init, populate, update & query ——– |
---|
Create a new RethinkDB database
Parameters: | args – an argparse argument (force) |
---|
Main function - essentially calls the CLI parser & directs execution
Populate the RethinkDB
This is essentially a placeholder that directs the input data to its specific populate method.
Parameters: | args – an argparse argument (run_type) |
---|
Populate database with a mapping run. Only support for Nesoni at the moment
TODO: This should also handle BWA. Will need to differentiate between Nesoni & BWA runs and handle VCF files.
Parameters: | args – an argparse argument (run_path) which is the full path as a string to the Banzai run (inclusive of $PROJECTBASE). For example: /$PROJECTBASE/map/$REF.2014-04-28-mon-16-41-51 |
---|
Converts a single JSON element to CSV
Note
this will not handle nested JSON. Will need to used something like https://github.com/evidens/json2csv to achieve this
Parameters: |
|
---|
Convert a nesoni report.txt to JSON
All features in report are parsed
See: tables.rst
Parameters: | report_file – fullpath as a string to the report file |
---|---|
Returns: | a list of JSON |
From genome reference (GBK format) convert CDS, gene & RNA features to JSON
Note
also see tables.rst for detailed description of the JSON schema
Warning
do not think that this handles misc_features
Parameters: | genome_file – the fullpath as a string to the genbank file |
---|---|
Returns: | a JSON representing the the reference and a list of JSON containing information on the features |
Make a connection to the RethinkDB database
Pulls settings (host, port, database name & auth_key from BanzaiDBConfig())
Returns: | a connection context manager |
---|
Bases: exceptions.Exception
The conversion only takes a single JSON element, not a list of elements
Bases: exceptions.Exception
RethinkDB only likes database names that match “^[a-zA-Z0-9_]+$”
Bases: exceptions.Exception
The conversion of JSON to CSV does not support nested JSON
Generate a list of length number of distinct “good” random colors
Parameters: | number – int |
---|---|
Type: | int |
Return type: | a list of lists in the form: [[243, 137, 121], [232, 121, 243], [216, 121, 243]] |
Functions to parse a nesoni report .txt file
From an evidence string/element return a dictionary or obs/counts
Parameters: | evidence – an evidence string. It looks something like this - Ax27 AGCAx1 AGCAATTAATTAAAATAAx |
---|
Return fields for syn, non-syn or correlated